Procházet zdrojové kódy

LibWeb/CSS: Revert to PercentageOr::resolve() to be templated

In 4bc38300ad9e7ca7665bd6afa0ab9c0557807286 this function was modified
to accept only Angle instead of being templated, with the purpose of
preventing Length from being passed.

This change reverts the function to being templated but adds a
constraint specifically forbidding Length. This adjustment will allow
for the future use of Frequency, Number, Time, etc., if we would want.
Aliaksandr Kalenik před 1 rokem
rodič
revize
9b7b97b2f6
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      Userland/Libraries/LibWeb/CSS/PercentageOr.h

+ 2 - 1
Userland/Libraries/LibWeb/CSS/PercentageOr.h

@@ -100,7 +100,8 @@ public:
         return resolved(layout_node, reference_value).to_px(layout_node);
         return resolved(layout_node, reference_value).to_px(layout_node);
     }
     }
 
 
-    Angle resolved(Layout::Node const& layout_node, Angle reference_value) const
+    T resolved(Layout::Node const& layout_node, T reference_value) const
+    requires(!IsSame<T, Length>)
     {
     {
         return m_value.visit(
         return m_value.visit(
             [&](T const& t) {
             [&](T const& t) {