diff --git a/components/offline_pages/core/prefetch/prefetch_dispatcher_impl.cc b/components/offline_pages/core/prefetch/prefetch_dispatcher_impl.cc
index 208a69d..750f83c 100644
--- a/components/offline_pages/core/prefetch/prefetch_dispatcher_impl.cc
+++ b/components/offline_pages/core/prefetch/prefetch_dispatcher_impl.cc
@@ -59,6 +59,8 @@
 
 void PrefetchDispatcherImpl::SchedulePipelineProcessing() {
   needs_pipeline_processing_ = true;
+  service_->GetLogger()->RecordActivity(
+      "Dispatcher: Scheduled more pipeline processing.");
 }
 
 void PrefetchDispatcherImpl::EnsureTaskScheduled() {
@@ -76,6 +78,10 @@
   if (!service_->GetPrefetchConfiguration()->IsPrefetchingEnabled())
     return;
 
+  service_->GetLogger()->RecordActivity("Dispatcher: Received " +
+                                        std::to_string(prefetch_urls.size()) +
+                                        " suggested URLs.");
+
   PrefetchStore* prefetch_store = service_->GetPrefetchStore();
   std::unique_ptr<Task> add_task = base::MakeUnique<AddUniqueUrlsTask>(
       this, prefetch_store, name_space, prefetch_urls);
@@ -105,7 +111,8 @@
     std::unique_ptr<ScopedBackgroundTask> background_task) {
   if (!service_->GetPrefetchConfiguration()->IsPrefetchingEnabled())
     return;
-  service_->GetLogger()->RecordActivity("Beginning Background Task.");
+  service_->GetLogger()->RecordActivity(
+      "Dispatcher: Beginning background task.");
 
   background_task_ = std::move(background_task);
 
@@ -114,6 +121,7 @@
 }
 
 void PrefetchDispatcherImpl::QueueReconcileTasks() {
+  service_->GetLogger()->RecordActivity("Dispatcher: Adding reconcile tasks.");
   // Note: For optimal results StaleEntryFinalizerTask should be executed before
   // other reconciler tasks that deal with external systems so that entries
   // finalized by it will promptly effect any external processing they relate
@@ -138,6 +146,7 @@
 }
 
 void PrefetchDispatcherImpl::QueueActionTasks() {
+  service_->GetLogger()->RecordActivity("Dispatcher: Adding action tasks.");
   std::unique_ptr<Task> download_archives_task =
       base::MakeUnique<DownloadArchivesTask>(service_->GetPrefetchStore(),
                                              service_->GetPrefetchDownloader());
@@ -168,6 +177,9 @@
   if (!service_->GetPrefetchConfiguration()->IsPrefetchingEnabled())
     return;
 
+  service_->GetLogger()->RecordActivity(
+      "Dispatcher: Stopping background task.");
+
   DisposeTask();
 }
 
@@ -205,6 +217,8 @@
   if (!service_->GetPrefetchConfiguration()->IsPrefetchingEnabled())
     return;
 
+  service_->GetLogger()->RecordActivity("Dispatcher: Received GCM message.");
+
   PrefetchStore* prefetch_store = service_->GetPrefetchStore();
   task_queue_.AddTask(base::MakeUnique<MarkOperationDoneTask>(
       this, prefetch_store, operation_name));
diff --git a/components/offline_pages/core/prefetch/prefetch_downloader_impl.cc b/components/offline_pages/core/prefetch/prefetch_downloader_impl.cc
index 8b3245b..e1495c1 100644
--- a/components/offline_pages/core/prefetch/prefetch_downloader_impl.cc
+++ b/components/offline_pages/core/prefetch/prefetch_downloader_impl.cc
@@ -9,6 +9,7 @@
 #include "base/strings/string_util.h"
 #include "components/download/public/download_params.h"
 #include "components/download/public/download_service.h"
+#include "components/offline_pages/core/offline_event_logger.h"
 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h"
 #include "components/offline_pages/core/prefetch/prefetch_server_urls.h"
 #include "components/offline_pages/core/prefetch/prefetch_service.h"
@@ -57,6 +58,10 @@
     return;
   }
 
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Start download of '" + download_location +
+      "', download_id=" + download_id);
+
   download::DownloadParams params;
   net::NetworkTrafficAnnotationTag traffic_annotation =
       net::DefineNetworkTrafficAnnotation("prefetch_download", R"(
@@ -118,6 +123,7 @@
     const std::set<std::string>& outstanding_download_ids,
     const std::map<std::string, std::pair<base::FilePath, int64_t>>&
         success_downloads) {
+  prefetch_service_->GetLogger()->RecordActivity("Downloader: Service ready.");
   DCHECK_EQ(download::DownloadService::ServiceStatus::READY,
             download_service_->GetStatus());
   service_started_ = true;
@@ -136,10 +142,14 @@
 }
 
 void PrefetchDownloaderImpl::OnDownloadServiceUnavailable() {
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Service unavailable.");
   // TODO(jianli): Report UMA.
 }
 
 void PrefetchDownloaderImpl::OnDownloadServiceShutdown() {
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Service shutdown.");
   service_started_ = false;
 }
 
@@ -147,6 +157,8 @@
     const std::string& download_id,
     const base::FilePath& file_path,
     int64_t file_size) {
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Download succeeded, download_id=" + download_id);
   NotifyDispatcher(prefetch_service_,
                    PrefetchDownloadResult(download_id, file_path, file_size));
 }
@@ -154,12 +166,17 @@
 void PrefetchDownloaderImpl::OnDownloadFailed(const std::string& download_id) {
   PrefetchDownloadResult result;
   result.download_id = download_id;
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Download failed, download_id=" + download_id);
   NotifyDispatcher(prefetch_service_, result);
 }
 
 void PrefetchDownloaderImpl::OnStartDownload(
     const std::string& download_id,
     download::DownloadParams::StartResult result) {
+  prefetch_service_->GetLogger()->RecordActivity(
+      "Downloader: Download started, download_id=" + download_id +
+      ", result=" + std::to_string(static_cast<int>(result)));
   if (result != download::DownloadParams::StartResult::ACCEPTED)
     OnDownloadFailed(download_id);
 }
diff --git a/components/offline_pages/core/prefetch/prefetch_service_impl.cc b/components/offline_pages/core/prefetch/prefetch_service_impl.cc
index ca6f514..679af76b 100644
--- a/components/offline_pages/core/prefetch/prefetch_service_impl.cc
+++ b/components/offline_pages/core/prefetch/prefetch_service_impl.cc
@@ -50,6 +50,9 @@
   prefetch_downloader_->SetPrefetchService(this);
   prefetch_gcm_handler_->SetService(this);
   suggested_articles_observer_->SetPrefetchService(this);
+  // TODO(dimich): OK for experiments, only takes a little memory if experiment
+  // is enabled. Remove before stable launch.
+  logger_.SetIsLogging(true);
 }
 
 PrefetchServiceImpl::~PrefetchServiceImpl() = default;
diff --git a/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors-expected.txt b/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors-expected.txt
new file mode 100644
index 0000000..f288ae7c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors-expected.txt
@@ -0,0 +1,18 @@
+a Float
+PASS
+
+a Float
+PASS
+
+a Float
+PASS
+
+a Float
+PASS
+
+a Float
+PASS
+
+a Float
+PASS
+crbug.com/754136: Floats should account for border/padding/margin on inline ancestors when deciding when they fit.
diff --git a/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors.html b/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors.html
new file mode 100644
index 0000000..8c84484
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/block/float-avoids-padding-inline-ancestors.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<script src="../../resources/ahem.js"></script>
+<style>
+body {
+  margin: 0px;
+  padding: 0px;
+  font: 20px/20px Ahem;
+}
+.container {
+  width: 300px;
+  border: 2px solid black;
+}
+.padded {
+  border: 2px dotted lime;
+  background: yellow;
+}
+.float {
+  float: right;
+  width: 50px;
+  border: 2px dotted red;
+}
+</style>
+<script src="../../resources/check-layout.js"></script>
+<div class="container">
+  <span class="padded" style="padding-right: 160px;">
+  <span class="padded" style="padding-right: 100px;">
+    a
+    <span class="float" data-offset-y=22>Float</span>
+  </span>
+  </span>
+</div>
+<br>
+<div class="container">
+  <span class="padded" style="padding-right: 260px;">
+    a
+    <span class="float" data-offset-y=66>Float</span>
+  </span>
+</div>
+<br>
+<div class="container">
+  <span class="padded" style="border-right: 160px solid lime;">
+  <span class="padded" style="border-right: 100px solid lime;">
+    a
+    <span class="float" data-offset-y=110>Float</span>
+  </span>
+  </span>
+</div>
+<br>
+<div class="container">
+  <span class="padded" style="border-right: 260px solid lime;">
+    a
+    <span class="float" data-offset-y=154>Float</span>
+  </span>
+</div>
+<br>
+<div class="container">
+  <span class="padded" style="margin-right: 160px;">
+  <span class="padded" style="margin-right: 100px;">
+    a
+    <span class="float" data-offset-y=198>Float</span>
+  </span>
+  </span>
+</div>
+<br>
+<div class="container">
+  <span class="padded" style="margin-right: 260px;">
+    a
+    <span class="float" data-offset-y=242>Float</span>
+  </span>
+</div>
+<p>crbug.com/754136: Floats should account for border/padding/margin on inline ancestors when deciding when they fit.</p>
+<script>
+    checkLayout(".float");
+</script>
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
index 2d2c41a4..f57a134 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/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-mac10.10/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
index 1c21422..39e4c719 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
index bdfefd5d..3430ed7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
index 2f3fb3da..d46f51f4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.10/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.10/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-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
index 8a77894..9a6e028 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
index 819eea8..3a76371 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.11/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.11/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-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
index 9f61b90..8294915 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
index 91d9d1d..3c14ff02 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/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-mac10.9/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
index 927bf6da..83da574 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
index 1291ba8..1c76473 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
index 927db80..990b3211 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mac10.9/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mac10.9/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-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
index 8a77894..9a6e028 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
index 819eea8..3a76371 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-retina/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-retina/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/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 efddb8e..6d065b5 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 e6732c4..387aab6c 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/win7/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
index 0d439a65..5e7269c9 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/Source/core/html/forms/resources/suggestionPicker.js b/third_party/WebKit/Source/core/html/forms/resources/suggestionPicker.js
index 88bd0f9..e56b93ea 100644
--- a/third_party/WebKit/Source/core/html/forms/resources/suggestionPicker.js
+++ b/third_party/WebKit/Source/core/html/forms/resources/suggestionPicker.js
@@ -133,7 +133,7 @@
   var maxContentWidth = 0;
   var contentElements = this._containerElement.getElementsByClassName('content');
   for (var i = 0; i < contentElements.length; ++i) {
-    maxContentWidth = Math.max(maxContentWidth, contentElements[i].offsetWidth);
+    maxContentWidth = Math.max(maxContentWidth, contentElements[i].getBoundingClientRect().width);
   }
   this._containerElement.classList.remove('measuring-width');
   return maxContentWidth;
diff --git a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
index bc5addd..8d729801 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -425,26 +425,47 @@
   return child.MarginEnd() + child.PaddingEnd() + child.BorderEnd();
 }
 
+enum CollapsibleWhiteSpace {
+  IgnoreCollapsibleWhiteSpace,
+  UseCollapsibleWhiteSpace
+};
+
 inline bool ShouldAddBorderPaddingMargin(LineLayoutItem child,
-                                         bool& check_side) {
-  if (!child || (child.IsText() && !LineLayoutText(child).TextLength()))
+                                         bool& check_side,
+                                         CollapsibleWhiteSpace white_space) {
+  if (!child)
     return true;
+  if (child.IsText()) {
+    // A caller will only be interested in adding BPM from objects separated by
+    // collapsible whitespace if they haven't already been added to the line's
+    // width, such as when adding end-BPM when about to place a float after a
+    // linebox.
+    if (white_space == UseCollapsibleWhiteSpace &&
+        LineLayoutText(child).IsAllCollapsibleWhitespace())
+      return true;
+    if (!LineLayoutText(child).TextLength())
+      return true;
+  }
   check_side = false;
   return check_side;
 }
 
-inline LayoutUnit InlineLogicalWidthFromAncestorsIfNeeded(LineLayoutItem child,
-                                                          bool start = true,
-                                                          bool end = true) {
+inline LayoutUnit InlineLogicalWidthFromAncestorsIfNeeded(
+    LineLayoutItem child,
+    bool start = true,
+    bool end = true,
+    CollapsibleWhiteSpace white_space = IgnoreCollapsibleWhiteSpace) {
   unsigned line_depth = 1;
   LayoutUnit extra_width;
   LineLayoutItem parent = child.Parent();
   while (parent.IsLayoutInline() && line_depth++ < kCMaxLineDepth) {
     LineLayoutInline parent_as_layout_inline(parent);
     if (!IsEmptyInline(parent_as_layout_inline)) {
-      if (start && ShouldAddBorderPaddingMargin(child.PreviousSibling(), start))
+      if (start && ShouldAddBorderPaddingMargin(child.PreviousSibling(), start,
+                                                white_space))
         extra_width += BorderPaddingMarginStart(parent_as_layout_inline);
-      if (end && ShouldAddBorderPaddingMargin(child.NextSibling(), end))
+      if (end &&
+          ShouldAddBorderPaddingMargin(child.NextSibling(), end, white_space))
         extra_width += BorderPaddingMarginEnd(parent_as_layout_inline);
       if (!start && !end)
         return extra_width;
@@ -506,6 +527,14 @@
     // otherwise, place it after moving to next line (in newLine() func).
     // FIXME: Bug 110372: Properly position multiple stacked floats with
     // non-rectangular shape outside.
+    // When fitting the float on the line we need to treat the width on the line
+    // so far as though end-border, -padding and -margin from
+    // inline ancestors has been applied to the end of the previous inline box.
+    float width_from_ancestors =
+        InlineLogicalWidthFromAncestorsIfNeeded(float_box, false, true,
+                                                UseCollapsibleWhiteSpace)
+            .ToFloat();
+    width_.AddUncommittedWidth(width_from_ancestors);
     if (width_.FitsOnLine(
             block_.LogicalWidthForFloat(*floating_object).ToFloat(),
             kExcludeWhitespace)) {
@@ -517,6 +546,7 @@
     } else {
       floats_fit_on_line_ = false;
     }
+    width_.AddUncommittedWidth(-width_from_ancestors);
   }
   // Update prior line break context characters, using U+FFFD (OBJECT
   // REPLACEMENT CHARACTER) for floating element.