summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-06-05 15:22:31 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-09-04 14:31:27 +0200
commitf029a0e934ef81cba0ce18a59abe6dcdeafb8401 (patch)
tree79a1a66109f92b5cdc13d3deda58885713aa620c
parentfd08686e1fd375d7f39fa701e548d73d4a4be08f (diff)
downloadqtwebengine-chromium-f029a0e934ef81cba0ce18a59abe6dcdeafb8401.tar.gz
Work-around MSVC bug with base::Optional<LayoutUnit>
For some reason it can't be passed by copy. Change-Id: I76707f447c98bc4be8e6dfe0cd2c29f04e0b56fe Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--chromium/base/optional.h5
-rw-r--r--chromium/third_party/blink/renderer/core/layout/layout_box.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/layout/layout_grid.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/layout/layout_table_section.cc2
4 files changed, 8 insertions, 3 deletions
diff --git a/chromium/base/optional.h b/chromium/base/optional.h
index 79b466c1fab..acb45423086 100644
--- a/chromium/base/optional.h
+++ b/chromium/base/optional.h
@@ -910,6 +910,11 @@ constexpr Optional<T> make_optional(std::initializer_list<U> il,
return Optional<T>(in_place, il, std::forward<Args>(args)...);
}
+template<typename T>
+constexpr Optional<T> pass_optional(const Optional<T> &opt) {
+ return opt ? make_optional(*opt) : nullopt;
+}
+
// Partial specialization for a function template is not allowed. Also, it is
// not allowed to add overload function to std namespace, while it is allowed
// to specialize the template in std. Thus, swap() (kind of) overloading is
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_box.cc b/chromium/third_party/blink/renderer/core/layout/layout_box.cc
index b4b7de92a26..0dfc7f124ae 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_box.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_box.cc
@@ -2496,7 +2496,7 @@ scoped_refptr<const NGLayoutResult> LayoutBox::CachedLayoutResult(
scoped_refptr<const NGLayoutResult> new_result =
base::AdoptRef(new NGLayoutResult(*cached_layout_result, new_space,
- bfc_line_offset, bfc_block_offset));
+ bfc_line_offset, std::move(bfc_block_offset)));
if (needs_cached_result_update)
SetCachedLayoutResult(*new_result, break_token);
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_grid.cc b/chromium/third_party/blink/renderer/core/layout/layout_grid.cc
index a3edf797642..7e833ac8f2b 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_grid.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_grid.cc
@@ -425,7 +425,7 @@ LayoutUnit LayoutGrid::GuttersSize(
if (span <= 1)
return LayoutUnit();
- LayoutUnit gap = GridGap(direction, available_size);
+ LayoutUnit gap = GridGap(direction, base::pass_optional(available_size));
// Fast path, no collapsing tracks.
if (!grid.HasAutoRepeatEmptyTracks(direction))
diff --git a/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc b/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc
index bccd836a7ab..2d9fa626288 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc
@@ -2000,7 +2000,7 @@ void LayoutTableSection::AdjustRowForPagination(LayoutTableRow& row_object,
row_is_at_top_of_column =
!offset_from_top_of_page ||
offset_from_top_of_page <= OffsetForRepeatedHeader() ||
- offset_from_top_of_page <= Table()->VBorderSpacing();
+ offset_from_top_of_page <= LayoutUnit(Table()->VBorderSpacing());
}
if (!row_is_at_top_of_column)