summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Box.h4
-rw-r--r--Userland/Libraries/LibWeb/Layout/FormattingContext.cpp10
-rw-r--r--Userland/Libraries/LibWeb/Layout/ImageBox.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/ReplacedBox.h6
4 files changed, 12 insertions, 12 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Box.h b/Userland/Libraries/LibWeb/Layout/Box.h
index d3522b29be..1841af67c1 100644
--- a/Userland/Libraries/LibWeb/Layout/Box.h
+++ b/Userland/Libraries/LibWeb/Layout/Box.h
@@ -123,11 +123,11 @@ public:
virtual Optional<float> intrinsic_width() const { return {}; }
virtual Optional<float> intrinsic_height() const { return {}; }
- virtual Optional<float> intrinsic_ratio() const { return {}; }
+ virtual Optional<float> intrinsic_aspect_ratio() const { return {}; }
bool has_intrinsic_width() const { return intrinsic_width().has_value(); }
bool has_intrinsic_height() const { return intrinsic_height().has_value(); }
- bool has_intrinsic_ratio() const { return intrinsic_ratio().has_value(); }
+ bool has_intrinsic_aspect_ratio() const { return intrinsic_aspect_ratio().has_value(); }
protected:
Box(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
diff --git a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
index 8ba52cacfd..70db3082cf 100644
--- a/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
+++ b/Userland/Libraries/LibWeb/Layout/FormattingContext.cpp
@@ -263,8 +263,8 @@ float FormattingContext::tentative_width_for_replaced_element(const ReplacedBox&
// 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value of 'width' is:
//
// (used height) * (intrinsic ratio)
- else if ((specified_height.is_auto() && width.is_auto() && !box.has_intrinsic_width() && box.has_intrinsic_height() && box.has_intrinsic_ratio()) || (width.is_auto() && box.has_intrinsic_ratio())) {
- used_width = compute_height_for_replaced_element(box) * box.intrinsic_ratio().value();
+ else if ((specified_height.is_auto() && width.is_auto() && !box.has_intrinsic_width() && box.has_intrinsic_height() && box.has_intrinsic_aspect_ratio()) || (width.is_auto() && box.has_intrinsic_aspect_ratio())) {
+ used_width = compute_height_for_replaced_element(box) * box.intrinsic_aspect_ratio().value();
}
else if (width.is_auto() && box.has_intrinsic_width()) {
@@ -348,8 +348,8 @@ float FormattingContext::tentative_height_for_replaced_element(const ReplacedBox
// an intrinsic height, then that intrinsic height is the used value of 'height'.
if (specified_width.is_auto() && height.is_auto() && box.has_intrinsic_height())
used_height = box.intrinsic_height().value();
- else if (height.is_auto() && box.has_intrinsic_ratio())
- used_height = compute_width_for_replaced_element(box) / box.intrinsic_ratio().value();
+ else if (height.is_auto() && box.has_intrinsic_aspect_ratio())
+ used_height = compute_width_for_replaced_element(box) / box.intrinsic_aspect_ratio().value();
else if (height.is_auto() && box.has_intrinsic_height())
used_height = box.intrinsic_height().value();
else if (height.is_auto())
@@ -369,7 +369,7 @@ float FormattingContext::compute_height_for_replaced_element(const ReplacedBox&
float used_height = tentative_height_for_replaced_element(box, specified_height);
- if (specified_width.is_auto() && specified_height.is_auto() && box.has_intrinsic_ratio()) {
+ if (specified_width.is_auto() && specified_height.is_auto() && box.has_intrinsic_aspect_ratio()) {
float w = tentative_width_for_replaced_element(box, specified_width);
float h = used_height;
used_height = solve_replaced_size_constraint(w, h, box).height();
diff --git a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
index 8977c549d0..975c99d47d 100644
--- a/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/ImageBox.cpp
@@ -48,9 +48,9 @@ void ImageBox::prepare_for_replaced_layout()
}
if (m_image_loader.width() && m_image_loader.height()) {
- set_intrinsic_ratio((float)m_image_loader.width() / (float)m_image_loader.height());
+ set_intrinsic_aspect_ratio((float)m_image_loader.width() / (float)m_image_loader.height());
} else {
- set_intrinsic_ratio({});
+ set_intrinsic_aspect_ratio({});
}
}
diff --git a/Userland/Libraries/LibWeb/Layout/ReplacedBox.h b/Userland/Libraries/LibWeb/Layout/ReplacedBox.h
index 4fd132ee96..a9ccdd5d5c 100644
--- a/Userland/Libraries/LibWeb/Layout/ReplacedBox.h
+++ b/Userland/Libraries/LibWeb/Layout/ReplacedBox.h
@@ -21,11 +21,11 @@ public:
virtual Optional<float> intrinsic_width() const final { return m_intrinsic_width; }
virtual Optional<float> intrinsic_height() const final { return m_intrinsic_height; }
- virtual Optional<float> intrinsic_ratio() const final { return m_intrinsic_ratio; }
+ virtual Optional<float> intrinsic_aspect_ratio() const final { return m_intrinsic_aspect_ratio; }
void set_intrinsic_width(float width) { m_intrinsic_width = width; }
void set_intrinsic_height(float height) { m_intrinsic_height = height; }
- void set_intrinsic_ratio(float ratio) { m_intrinsic_ratio = ratio; }
+ void set_intrinsic_aspect_ratio(float ratio) { m_intrinsic_aspect_ratio = ratio; }
virtual void prepare_for_replaced_layout() { }
@@ -37,7 +37,7 @@ protected:
private:
Optional<float> m_intrinsic_width;
Optional<float> m_intrinsic_height;
- Optional<float> m_intrinsic_ratio;
+ Optional<float> m_intrinsic_aspect_ratio;
};
}