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-06-25 20:19:53 +0000
commit2d74719816cd64e9a5153a761ea742a53bcbe7d8 (patch)
tree87bee8f151c98c52cda601efae4661cba67e6a46
parent9573a72b03ebc97443271319e44da3a35288ef98 (diff)
downloadqtwebengine-chromium-2d74719816cd64e9a5153a761ea742a53bcbe7d8.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
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h2
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc6
6 files changed, 12 insertions, 7 deletions
diff --git a/chromium/base/optional.h b/chromium/base/optional.h
index 1c1413d9201..58c0f307a02 100644
--- a/chromium/base/optional.h
+++ b/chromium/base/optional.h
@@ -888,6 +888,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 5313c3963a3..432db98a639 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_box.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_box.cc
@@ -2458,7 +2458,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 21ba0e07c91..6c60f3252ec 100644
--- a/chromium/third_party/blink/renderer/core/layout/layout_grid.cc
+++ b/chromium/third_party/blink/renderer/core/layout/layout_grid.cc
@@ -422,7 +422,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 f77493898a2..6f8c932ade1 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
@@ -2034,7 +2034,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)
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
index fd52237443d..0348bff9bf8 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
+++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_constraint_space.h
@@ -363,7 +363,7 @@ class CORE_EXPORT NGConstraintSpace final {
// This value is calculated *after* an initial pass of the tree, and should
// only be present during subsequent passes.
base::Optional<LayoutUnit> FloatsBfcBlockOffset() const {
- return HasRareData() ? rare_data_->floats_bfc_block_offset : base::nullopt;
+ return (HasRareData() && rare_data_->floats_bfc_block_offset) ? base::make_optional(*rare_data_->floats_bfc_block_offset) : base::nullopt;
}
// Return the types (none, left, right, both) of preceding adjoining
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc b/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc
index b6c86d4b949..6f8fb66f908 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc
+++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_layout_result.cc
@@ -57,9 +57,9 @@ NGLayoutResult::NGLayoutResult(const NGLayoutResult& other,
exclusion_space_(MergeExclusionSpaces(other,
space_.ExclusionSpace(),
bfc_line_offset,
- bfc_block_offset)),
+ base::pass_optional(bfc_block_offset))),
bfc_line_offset_(bfc_line_offset),
- bfc_block_offset_(bfc_block_offset),
+ bfc_block_offset_(std::move(bfc_block_offset)),
end_margin_strut_(other.end_margin_strut_),
intrinsic_block_size_(other.intrinsic_block_size_),
minimal_space_shortage_(other.minimal_space_shortage_),
@@ -84,7 +84,7 @@ NGLayoutResult::NGLayoutResult(NGContainerFragmentBuilder* builder,
unpositioned_list_marker_(builder->unpositioned_list_marker_),
exclusion_space_(std::move(builder->exclusion_space_)),
bfc_line_offset_(builder->bfc_line_offset_),
- bfc_block_offset_(builder->bfc_block_offset_),
+ bfc_block_offset_(base::pass_optional(builder->bfc_block_offset_)),
end_margin_strut_(builder->end_margin_strut_),
has_valid_space_(cache_space && builder->space_),
has_forced_break_(false),