mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 03:12:44 +00:00 
			
		
		
		
	 57dc179b1f
			
		
	
	
		57dc179b1f
		
	
	
	
	
		
			
			This will make it easier to support both string types at the same time while we convert code, and tracking down remaining uses. One big exception is Value::to_string() in LibJS, where the name is dictated by the ToString AO.
		
			
				
	
	
		
			57 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Martin Falisse <mfalisse@outlook.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #include "GridTrackPlacement.h"
 | |
| #include <AK/DeprecatedString.h>
 | |
| 
 | |
| namespace Web::CSS {
 | |
| 
 | |
| GridTrackPlacement::GridTrackPlacement(int span_count_or_position, bool has_span)
 | |
|     : m_type(has_span ? Type::Span : Type::Position)
 | |
|     , m_span_count_or_position(span_count_or_position)
 | |
| {
 | |
| }
 | |
| 
 | |
| GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, int span_count_or_position, bool has_span)
 | |
|     : m_type(has_span ? Type::Span : Type::Position)
 | |
|     , m_span_count_or_position(span_count_or_position)
 | |
|     , m_line_name(line_name)
 | |
| {
 | |
| }
 | |
| 
 | |
| GridTrackPlacement::GridTrackPlacement(DeprecatedString line_name, bool has_span)
 | |
|     : m_type(has_span ? Type::Span : Type::Position)
 | |
|     , m_line_name(line_name)
 | |
| {
 | |
| }
 | |
| 
 | |
| GridTrackPlacement::GridTrackPlacement()
 | |
|     : m_type(Type::Auto)
 | |
| {
 | |
| }
 | |
| 
 | |
| DeprecatedString GridTrackPlacement::to_deprecated_string() const
 | |
| {
 | |
|     StringBuilder builder;
 | |
|     if (is_auto()) {
 | |
|         builder.append("auto"sv);
 | |
|         return builder.to_deprecated_string();
 | |
|     }
 | |
|     if (is_span()) {
 | |
|         builder.append("span"sv);
 | |
|         builder.append(" "sv);
 | |
|     }
 | |
|     if (m_span_count_or_position != 0) {
 | |
|         builder.append(DeprecatedString::number(m_span_count_or_position));
 | |
|         builder.append(" "sv);
 | |
|     }
 | |
|     if (has_line_name()) {
 | |
|         builder.append(m_line_name);
 | |
|     }
 | |
|     return builder.to_deprecated_string();
 | |
| }
 | |
| 
 | |
| }
 |