mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
Everywhere: Use HashMap::update() where applicable
This commit is contained in:
parent
0b96690f0c
commit
73967ee90c
|
|
@ -1202,8 +1202,7 @@ Interface& Parser::parse()
|
|||
interface.extend_with_partial_interface(*partial_interface);
|
||||
}
|
||||
|
||||
for (auto& dictionary : import.dictionaries)
|
||||
interface.dictionaries.set(dictionary.key, dictionary.value);
|
||||
interface.dictionaries.update(import.dictionaries);
|
||||
|
||||
for (auto& partial_dictionary : import.partial_dictionaries) {
|
||||
auto& it = interface.partial_dictionaries.ensure(partial_dictionary.key);
|
||||
|
|
@ -1216,8 +1215,7 @@ Interface& Parser::parse()
|
|||
interface.enumerations.set(enumeration.key, move(enumeration_copy));
|
||||
}
|
||||
|
||||
for (auto& typedef_ : import.typedefs)
|
||||
interface.typedefs.set(typedef_.key, typedef_.value);
|
||||
interface.typedefs.update(import.typedefs);
|
||||
|
||||
for (auto& mixin : import.mixins) {
|
||||
if (auto it = interface.mixins.find(mixin.key); it != interface.mixins.end() && it->value != mixin.value)
|
||||
|
|
@ -1225,8 +1223,7 @@ Interface& Parser::parse()
|
|||
interface.mixins.set(mixin.key, mixin.value);
|
||||
}
|
||||
|
||||
for (auto& callback_function : import.callback_functions)
|
||||
interface.callback_functions.set(callback_function.key, callback_function.value);
|
||||
interface.callback_functions.update(import.callback_functions);
|
||||
}
|
||||
|
||||
// Resolve mixins
|
||||
|
|
|
|||
|
|
@ -309,17 +309,13 @@ void Interface::extend_with_partial_interface(Interface const& partial)
|
|||
{
|
||||
for (auto const& attribute : partial.attributes) {
|
||||
auto attribute_copy = attribute;
|
||||
for (auto const& [key, value] : partial.extended_attributes) {
|
||||
attribute_copy.extended_attributes.set(key, value);
|
||||
}
|
||||
attribute_copy.extended_attributes.update(partial.extended_attributes);
|
||||
attributes.append(move(attribute_copy));
|
||||
}
|
||||
|
||||
for (auto const& static_attribute : partial.static_attributes) {
|
||||
auto static_attribute_copy = static_attribute;
|
||||
for (auto const& [key, value] : partial.extended_attributes) {
|
||||
static_attribute_copy.extended_attributes.set(key, value);
|
||||
}
|
||||
static_attribute_copy.extended_attributes.update(partial.extended_attributes);
|
||||
static_attributes.append(move(static_attribute_copy));
|
||||
}
|
||||
|
||||
|
|
@ -327,17 +323,13 @@ void Interface::extend_with_partial_interface(Interface const& partial)
|
|||
|
||||
for (auto const& function : partial.functions) {
|
||||
auto function_copy = function;
|
||||
for (auto const& [key, value] : partial.extended_attributes) {
|
||||
function_copy.extended_attributes.set(key, value);
|
||||
}
|
||||
function_copy.extended_attributes.update(partial.extended_attributes);
|
||||
functions.append(move(function_copy));
|
||||
}
|
||||
|
||||
for (auto const& static_function : partial.static_functions) {
|
||||
auto static_function_copy = static_function;
|
||||
for (auto const& [key, value] : partial.extended_attributes) {
|
||||
static_function_copy.extended_attributes.set(key, value);
|
||||
}
|
||||
static_function_copy.extended_attributes.update(partial.extended_attributes);
|
||||
static_functions.append(move(static_function_copy));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,8 +278,7 @@ public:
|
|||
}
|
||||
m_string_table.m_table.set(entry.key, entry.value);
|
||||
}
|
||||
for (auto const& entry : other.m_string_table.m_inverse_table)
|
||||
m_string_table.m_inverse_table.set(entry.key, entry.value);
|
||||
m_string_table.m_inverse_table.update(other.m_string_table.m_inverse_table);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -416,8 +416,7 @@ static WebIDL::ExceptionOr<Vector<BaseKeyframe>> process_a_keyframes_argument(JS
|
|||
if (keyframe_a.computed_offset.value() == keyframe_b.computed_offset.value()) {
|
||||
keyframe_a.easing = keyframe_b.easing;
|
||||
keyframe_a.composite = keyframe_b.composite;
|
||||
for (auto const& [property_name, property_value] : keyframe_b.unparsed_properties())
|
||||
keyframe_a.unparsed_properties().set(property_name, property_value);
|
||||
keyframe_a.unparsed_properties().update(keyframe_b.unparsed_properties());
|
||||
processed_keyframes.remove(i + 1);
|
||||
i--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -983,10 +983,8 @@ static void cascade_custom_properties(DOM::Element& element, Optional<CSS::Pseud
|
|||
}
|
||||
|
||||
if (!pseudo_element.has_value()) {
|
||||
if (auto const inline_style = element.inline_style()) {
|
||||
for (auto const& it : inline_style->custom_properties())
|
||||
custom_properties.set(it.key, it.value);
|
||||
}
|
||||
if (auto const inline_style = element.inline_style())
|
||||
custom_properties.update(inline_style->custom_properties());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -515,8 +515,7 @@ static WebIDL::ExceptionOr<String> serialize_element(DOM::Element const& element
|
|||
// To copy a namespace prefix map map means to copy the map's keys into a new empty namespace prefix map,
|
||||
// and to copy each of the values in the namespace prefix list associated with each keys' value into a new list
|
||||
// which should be associated with the respective key in the new map.
|
||||
for (auto const& map_entry : namespace_prefix_map)
|
||||
map.set(map_entry.key, map_entry.value);
|
||||
map.update(namespace_prefix_map);
|
||||
|
||||
// 7. Let local prefixes map be an empty map. The map has unique Node prefix strings as its keys, with corresponding namespaceURI Node values
|
||||
// as the map's key values (in this map, the null namespace is represented by the empty string).
|
||||
|
|
|
|||
|
|
@ -461,9 +461,7 @@ Gfx::ShapeFeatures InlineLevelIterator::create_and_merge_font_features() const
|
|||
// FIXME 2. If the font is defined via an @font-face rule, the font features implied by the font-feature-settings descriptor in the @font-face rule.
|
||||
|
||||
// 3. Font features implied by the value of the ‘font-variant’ property, the related ‘font-variant’ subproperties and any other CSS property that uses OpenType features (e.g. the ‘font-kerning’ property).
|
||||
for (auto& it : shape_features_map()) {
|
||||
merged_features.set(it.key, it.value);
|
||||
}
|
||||
merged_features.update(shape_features_map());
|
||||
|
||||
// FIXME 4. Feature settings determined by properties other than ‘font-variant’ or ‘font-feature-settings’. For example, setting a non-default value for the ‘letter-spacing’ property disables common ligatures.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user