summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp
diff options
context:
space:
mode:
authormartinfalisse <martinmotteditfalisse@gmail.com>2022-08-24 12:21:58 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-25 13:47:48 +0200
commitca286fc220c534989da6b8c0e04b31f43041a7e7 (patch)
treee3a8982fc92283d6462dfcbdc1c68a8547a4662e /Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp
parentfc369709730ddff69a2d20c4dd36e28d4f4ee194 (diff)
downloadserenity-ca286fc220c534989da6b8c0e04b31f43041a7e7.zip
LibWeb: Add GridTrackPlacement for grid-[column/row]-[start/end]
Add GridTrackPlacement to use with grid-column-start and related CSS properties.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp b/Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp
new file mode 100644
index 0000000000..1c13eec2dd
--- /dev/null
+++ b/Userland/Libraries/LibWeb/CSS/GridTrackPlacement.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2022, Martin Falisse <mfalisse@outlook.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include "GridTrackPlacement.h"
+#include <AK/String.h>
+
+namespace Web::CSS {
+
+GridTrackPlacement::GridTrackPlacement(int position, bool has_span)
+ : m_position(position)
+ , m_has_span(has_span)
+{
+}
+
+GridTrackPlacement::GridTrackPlacement(int position)
+ : m_position(position)
+{
+}
+
+GridTrackPlacement::GridTrackPlacement()
+{
+}
+
+String GridTrackPlacement::to_string() const
+{
+ StringBuilder builder;
+ if (m_has_span)
+ builder.append("span "sv);
+ builder.append(String::number(m_position));
+ return builder.to_string();
+}
+
+}