mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:58:12 +00:00
LibWeb: Move Attribute into the DOM namespace
This commit is contained in:
parent
2d4650714f
commit
cb895edad4
3 changed files with 9 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <AK/FlyString.h>
|
||||
|
||||
namespace Web {
|
||||
namespace Web::DOM {
|
||||
|
||||
class Attribute {
|
||||
public:
|
||||
|
|
|
@ -94,7 +94,7 @@ Optional<String> extract_character_encoding_from_meta_element(String const& stri
|
|||
return TextCodec::get_standardized_encoding(encoding);
|
||||
}
|
||||
|
||||
Optional<Attribute> prescan_get_attribute(const ByteBuffer& input, size_t& position)
|
||||
Optional<DOM::Attribute> prescan_get_attribute(const ByteBuffer& input, size_t& position)
|
||||
{
|
||||
if (!prescan_skip_whitespace_and_slashes(input, position))
|
||||
return {};
|
||||
|
@ -109,7 +109,7 @@ Optional<Attribute> prescan_get_attribute(const ByteBuffer& input, size_t& posit
|
|||
} else if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ')
|
||||
goto spaces;
|
||||
else if (input[position] == '/' || input[position] == '>')
|
||||
return Attribute(attribute_name.to_string(), "");
|
||||
return DOM::Attribute(attribute_name.to_string(), "");
|
||||
else
|
||||
attribute_name.append_as_lowercase(input[position]);
|
||||
++position;
|
||||
|
@ -121,7 +121,7 @@ spaces:
|
|||
if (!prescan_skip_whitespace_and_slashes(input, position))
|
||||
return {};
|
||||
if (input[position] != '=')
|
||||
return Attribute(attribute_name.to_string(), "");
|
||||
return DOM::Attribute(attribute_name.to_string(), "");
|
||||
++position;
|
||||
|
||||
value:
|
||||
|
@ -134,13 +134,13 @@ value:
|
|||
++position;
|
||||
for (; !prescan_should_abort(input, position); ++position) {
|
||||
if (input[position] == quote_character)
|
||||
return Attribute(attribute_name.to_string(), attribute_value.to_string());
|
||||
return DOM::Attribute(attribute_name.to_string(), attribute_value.to_string());
|
||||
else
|
||||
attribute_value.append_as_lowercase(input[position]);
|
||||
}
|
||||
return {};
|
||||
} else if (input[position] == '>')
|
||||
return Attribute(attribute_name.to_string(), "");
|
||||
return DOM::Attribute(attribute_name.to_string(), "");
|
||||
else
|
||||
attribute_value.append_as_lowercase(input[position]);
|
||||
|
||||
|
@ -150,7 +150,7 @@ value:
|
|||
|
||||
for (; !prescan_should_abort(input, position); ++position) {
|
||||
if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '>')
|
||||
return Attribute(attribute_name.to_string(), attribute_value.to_string());
|
||||
return DOM::Attribute(attribute_name.to_string(), attribute_value.to_string());
|
||||
else
|
||||
attribute_value.append_as_lowercase(input[position]);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ bool prescan_should_abort(const ByteBuffer& input, const size_t& position);
|
|||
bool prescan_is_whitespace_or_slash(const u8& byte);
|
||||
bool prescan_skip_whitespace_and_slashes(const ByteBuffer& input, size_t& position);
|
||||
Optional<String> extract_character_encoding_from_meta_element(String const&);
|
||||
Optional<Attribute> prescan_get_attribute(const ByteBuffer& input, size_t& position);
|
||||
Optional<DOM::Attribute> prescan_get_attribute(const ByteBuffer& input, size_t& position);
|
||||
Optional<String> run_prescan_byte_stream_algorithm(const ByteBuffer& input);
|
||||
String run_encoding_sniffing_algorithm(const ByteBuffer& input);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue