Reland "Avoid copying Lengths (non-layout uses)"
This reverts commit ae5e5a5785d23ad6ca824b1ff399fe31b9060b77.
Reason for revert: The cause for the link failure is unknown but not the fault of the CL. (See for example https://crbug.com/921967 for similar failures.)
Original change's description:
> Revert "Avoid copying Lengths (non-layout uses)"
>
> This reverts commit 784f852591a08f9bce6005cbb1df682cc5608af0.
>
> Reason for revert: Causes link failures on Android FYI Release (Nexus 6P)
>
> Original change's description:
> > Avoid copying Lengths (non-layout uses)
> >
> > Copying/assigning a Length is not just a trivial copy, so when possible,
> > use a const Length& to avoid making a copy (saving some small bit of
> > footprint and hopefully a few CPU cycles too).
> >
> > Change-Id: I8bcf5c6e6b99027110a20b1ef95d5f6607673ddc
> > Reviewed-on: https://chromium-review.googlesource.com/c/1411919
> > Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
> > Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#623209}
>
> TBR=fs@opera.com,mstensho@chromium.org
>
> Change-Id: Ifd8aad2dc3c78703a7f544564417ceb15cddcdda
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://chromium-review.googlesource.com/c/1414993
> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#623248}
TBR=fs@opera.com,cwallez@chromium.org,mstensho@chromium.org
Change-Id: Id247820a5c902209354452d495537ab02efb7605
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/1414939
Reviewed-by: Fredrik Söderquist <fs@opera.com>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#623251}
diff --git a/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc b/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc
index 9911e24..148e0a7 100644
--- a/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc
+++ b/third_party/blink/renderer/core/frame/page_scale_constraints_set.cc
@@ -64,7 +64,7 @@
void PageScaleConstraintsSet::UpdatePageDefinedConstraints(
const ViewportDescription& description,
- Length legacy_fallback_width) {
+ const Length& legacy_fallback_width) {
page_defined_constraints_ =
description.Resolve(FloatSize(icb_size_), legacy_fallback_width);
diff --git a/third_party/blink/renderer/core/frame/page_scale_constraints_set.h b/third_party/blink/renderer/core/frame/page_scale_constraints_set.h
index 5a666d2..6144ae4 100644
--- a/third_party/blink/renderer/core/frame/page_scale_constraints_set.h
+++ b/third_party/blink/renderer/core/frame/page_scale_constraints_set.h
@@ -68,7 +68,7 @@
return page_defined_constraints_;
}
void UpdatePageDefinedConstraints(const ViewportDescription&,
- Length legacy_fallback_width);
+ const Length& legacy_fallback_width);
void AdjustForAndroidWebViewQuirks(const ViewportDescription&,
int layout_fallback_width,
float device_scale_factor,
diff --git a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc
index 7c8e72c..62b9ee0 100644
--- a/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc
+++ b/third_party/blink/renderer/core/html/forms/text_control_inner_elements.cc
@@ -180,7 +180,7 @@
// We'd like to remove line-height if it's unnecessary because
// overflow:scroll clips editing text by line-height.
- Length logical_height = start_style.LogicalHeight();
+ const Length& logical_height = start_style.LogicalHeight();
// Here, we remove line-height if the INPUT fixed height is taller than the
// line-height. It's not the precise condition because logicalHeight
// includes border and padding if box-sizing:border-box, and there are cases
diff --git a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
index 8f1f32c..ac14855 100644
--- a/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
+++ b/third_party/blink/renderer/core/html/html_image_fallback_helper.cc
@@ -36,8 +36,8 @@
}
static bool ImageSmallerThanAltImage(int pixels_for_alt_image,
- const Length width,
- const Length height) {
+ const Length& width,
+ const Length& height) {
// We don't have a layout tree so can't compute the size of an image
// relative dimensions - so we just assume we should display the alt image.
if (!width.IsFixed() && !height.IsFixed())
diff --git a/third_party/blink/renderer/core/page/viewport_description.cc b/third_party/blink/renderer/core/page/viewport_description.cc
index 5d8a3c15..ea6df77 100644
--- a/third_party/blink/renderer/core/page/viewport_description.cc
+++ b/third_party/blink/renderer/core/page/viewport_description.cc
@@ -86,7 +86,7 @@
PageScaleConstraints ViewportDescription::Resolve(
const FloatSize& initial_viewport_size,
- Length legacy_fallback_width) const {
+ const Length& legacy_fallback_width) const {
float result_width = kValueAuto;
Length copy_max_width = max_width;
diff --git a/third_party/blink/renderer/core/page/viewport_description.h b/third_party/blink/renderer/core/page/viewport_description.h
index 05d1aa0..64cf5bf9 100644
--- a/third_party/blink/renderer/core/page/viewport_description.h
+++ b/third_party/blink/renderer/core/page/viewport_description.h
@@ -96,7 +96,7 @@
// All arguments are in CSS units.
PageScaleConstraints Resolve(const FloatSize& initial_viewport_size,
- Length legacy_fallback_width) const;
+ const Length& legacy_fallback_width) const;
// When --use-zoom-for-dsf is enabled, if the type is kFixed, these Length
// values (i.e., |min_width|, |max_width|, |min_height|, and |max_height|)
diff --git a/third_party/blink/renderer/core/style/style_reflection.h b/third_party/blink/renderer/core/style/style_reflection.h
index cb2de27..68dcb1c 100644
--- a/third_party/blink/renderer/core/style/style_reflection.h
+++ b/third_party/blink/renderer/core/style/style_reflection.h
@@ -45,7 +45,7 @@
bool operator!=(const StyleReflection& o) const { return !(*this == o); }
CSSReflectionDirection Direction() const { return direction_; }
- Length Offset() const { return offset_; }
+ const Length& Offset() const { return offset_; }
const NinePieceImage& Mask() const { return mask_; }
void SetDirection(CSSReflectionDirection dir) { direction_ = dir; }