Skip to content

Commit 93e34b8

Browse files
author
openwebf-bot
committed
Committing clang-format changes
1 parent 9faa2a5 commit 93e34b8

21 files changed

+183
-243
lines changed

bridge/bindings/qjs/cppgc/member.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class ScriptWrappable;
2525
template <typename T, typename = std::is_base_of<ScriptWrappable, T>>
2626
class Member {
2727
public:
28-
2928
struct KeyHasher {
3029
std::size_t operator()(const Member& k) const { return k.raw_; }
3130
};

bridge/core/dom/child_list_mutation_scope.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ bool ChildListMutationAccumulator::IsEmpty() {
138138
void ChildListMutationAccumulator::Trace(GCVisitor* visitor) const {
139139
visitor->TraceMember(target_);
140140

141-
for(auto& entry : removed_nodes_) {
141+
for (auto& entry : removed_nodes_) {
142142
visitor->TraceMember(entry);
143143
}
144-
for(auto& entry : added_nodes_) {
144+
for (auto& entry : added_nodes_) {
145145
visitor->TraceMember(entry);
146146
}
147147

bridge/core/dom/child_list_mutation_scope.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* Copyright (C) 2022-present The WebF authors. All rights reserved.
3-
*/
2+
* Copyright (C) 2022-present The WebF authors. All rights reserved.
3+
*/
44

55
#ifndef WEBF_CORE_DOM_CHILD_LIST_MUTATION_SCOPE_H_
66
#define WEBF_CORE_DOM_CHILD_LIST_MUTATION_SCOPE_H_
77

8+
#include "document.h"
89
#include "foundation/macros.h"
910
#include "mutation_observer_interest_group.h"
10-
#include "document.h"
1111
#include "static_node_list.h"
1212

1313
namespace webf {
@@ -61,8 +61,7 @@ class ChildListMutationScope final {
6161

6262
public:
6363
explicit ChildListMutationScope(Node& target) {
64-
if (target.ownerDocument()->HasMutationObserversOfType(
65-
kMutationTypeChildList)) {
64+
if (target.ownerDocument()->HasMutationObserversOfType(kMutationTypeChildList)) {
6665
accumulator_ = ChildListMutationAccumulator::GetOrCreate(target);
6766
// Register another user of the accumulator.
6867
accumulator_->EnterMutationScope();
@@ -93,7 +92,6 @@ class ChildListMutationScope final {
9392
std::shared_ptr<ChildListMutationAccumulator> accumulator_ = nullptr;
9493
};
9594

96-
97-
}
95+
} // namespace webf
9896

9997
#endif // WEBF_CORE_DOM_CHILD_LIST_MUTATION_SCOPE_H_

bridge/core/dom/container_node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
#include "container_node.h"
3030
#include "bindings/qjs/cppgc/garbage_collected.h"
3131
#include "bindings/qjs/cppgc/gc_visitor.h"
32+
#include "child_list_mutation_scope.h"
3233
#include "child_node_list.h"
3334
#include "core/html/html_all_collection.h"
3435
#include "document.h"
3536
#include "document_fragment.h"
3637
#include "node_traversal.h"
37-
#include "child_list_mutation_scope.h"
3838

3939
namespace webf {
4040

bridge/core/dom/document.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,9 @@ class Document : public ContainerNode, public TreeScope {
100100

101101
ScriptValue location() const;
102102

103-
bool HasMutationObserversOfType(MutationType type) const {
104-
return mutation_observer_types_ & type;
105-
}
103+
bool HasMutationObserversOfType(MutationType type) const { return mutation_observer_types_ & type; }
106104
bool HasMutationObservers() const { return mutation_observer_types_; }
107-
void AddMutationObserverTypes(MutationType types) {
108-
mutation_observer_types_ |= types;
109-
}
105+
void AddMutationObserverTypes(MutationType types) { mutation_observer_types_ |= types; }
110106

111107
void IncrementNodeCount() { node_count_++; }
112108
void DecrementNodeCount() {

bridge/core/dom/mutation_observer.cc

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
#include "mutation_observer.h"
3636
#include "mutation_observer_options.h"
37-
#include "node.h"
3837
#include "mutation_observer_registration.h"
38+
#include "node.h"
3939

4040
namespace webf {
4141

@@ -54,14 +54,14 @@ MutationObserver::MutationObserver(ExecutingContext* context, const std::shared_
5454

5555
MutationObserver::~MutationObserver() = default;
5656

57-
void MutationObserver::observe(Node* node, const std::shared_ptr<MutationObserverInit>& observer_init, ExceptionState& exception_state) {
58-
57+
void MutationObserver::observe(Node* node,
58+
const std::shared_ptr<MutationObserverInit>& observer_init,
59+
ExceptionState& exception_state) {
5960
assert(node != nullptr);
6061

6162
MutationObserverOptions options = 0;
6263

63-
if (observer_init->hasAttributeOldValue() &&
64-
observer_init->attributeOldValue())
64+
if (observer_init->hasAttributeOldValue() && observer_init->attributeOldValue())
6565
options |= kAttributeOldValue;
6666

6767
std::set<AtomicString> attribute_filter;
@@ -71,21 +71,16 @@ void MutationObserver::observe(Node* node, const std::shared_ptr<MutationObserve
7171
options |= kAttributeFilter;
7272
}
7373

74-
bool attributes =
75-
observer_init->hasAttributes() && observer_init->attributes();
74+
bool attributes = observer_init->hasAttributes() && observer_init->attributes();
7675
if (attributes || (!observer_init->hasAttributes() &&
77-
(observer_init->hasAttributeOldValue() ||
78-
observer_init->hasAttributeFilter())))
76+
(observer_init->hasAttributeOldValue() || observer_init->hasAttributeFilter())))
7977
options |= kMutationTypeAttributes;
8078

81-
if (observer_init->hasCharacterDataOldValue() &&
82-
observer_init->characterDataOldValue())
79+
if (observer_init->hasCharacterDataOldValue() && observer_init->characterDataOldValue())
8380
options |= kCharacterDataOldValue;
8481

85-
bool character_data =
86-
observer_init->hasCharacterData() && observer_init->characterData();
87-
if (character_data || (!observer_init->hasCharacterData() &&
88-
observer_init->hasCharacterDataOldValue()))
82+
bool character_data = observer_init->hasCharacterData() && observer_init->characterData();
83+
if (character_data || (!observer_init->hasCharacterData() && observer_init->hasCharacterDataOldValue()))
8984
options |= kMutationTypeCharacterData;
9085

9186
if (observer_init->childList())
@@ -103,23 +98,22 @@ void MutationObserver::observe(Node* node, const std::shared_ptr<MutationObserve
10398
}
10499
if (options & kAttributeFilter) {
105100
exception_state.ThrowException(ctx(), ErrorType::TypeError,
106-
"The options object may only set 'attributeFilter' when 'attributes' "
107-
"is true or not present.");
101+
"The options object may only set 'attributeFilter' when 'attributes' "
102+
"is true or not present.");
108103
return;
109104
}
110105
}
111-
if (!((options & kMutationTypeCharacterData) ||
112-
!(options & kCharacterDataOldValue))) {
106+
if (!((options & kMutationTypeCharacterData) || !(options & kCharacterDataOldValue))) {
113107
exception_state.ThrowException(ctx(), ErrorType::TypeError,
114-
"The options object may only set 'characterDataOldValue' to true when "
115-
"'characterData' is true or not present.");
108+
"The options object may only set 'characterDataOldValue' to true when "
109+
"'characterData' is true or not present.");
116110
return;
117111
}
118112

119113
if (!(options & kMutationTypeAll)) {
120114
exception_state.ThrowException(ctx(), ErrorType::TypeError,
121-
"The options object must set at least one of 'attributes', "
122-
"'characterData', or 'childList' to true.");
115+
"The options object must set at least one of 'attributes', "
116+
"'characterData', or 'childList' to true.");
123117
return;
124118
}
125119

@@ -169,14 +163,13 @@ std::set<Member<Node>> MutationObserver::GetObservedNodes() const {
169163
}
170164

171165
void MutationObserver::Trace(GCVisitor* visitor) const {
172-
for(auto& record : records_) {
166+
for (auto& record : records_) {
173167
visitor->TraceMember(record);
174168
}
175169

176-
for(auto& re : registrations_) {
170+
for (auto& re : registrations_) {
177171
re->Trace(visitor);
178172
}
179173
}
180174

181-
182175
} // namespace webf

bridge/core/dom/mutation_observer.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@
3535
#ifndef WEBF_MUTATION_OBSERVER_H
3636
#define WEBF_MUTATION_OBSERVER_H
3737

38+
#include "bindings/qjs/cppgc/member.h"
3839
#include "bindings/qjs/exception_state.h"
3940
#include "bindings/qjs/script_wrappable.h"
40-
#include "bindings/qjs/cppgc/member.h"
41-
#include "qjs_mutation_observer_init.h"
4241
#include "mutation_record.h"
42+
#include "qjs_mutation_observer_init.h"
4343

4444
namespace webf {
4545

@@ -49,13 +49,13 @@ class MutationObserverInit;
4949
class MutationObserverRegistration;
5050

5151
using MutationObserverSet = std::set<Member<MutationObserver>>;
52-
using MutationObserverRegistrationSet =
53-
std::set<std::shared_ptr<MutationObserverRegistration>>;
52+
using MutationObserverRegistrationSet = std::set<std::shared_ptr<MutationObserverRegistration>>;
5453
using MutationObserverVector = std::vector<Member<MutationObserver>>;
5554
using MutationRecordVector = std::vector<MutationRecord*>;
5655

5756
class MutationObserver final : public ScriptWrappable {
5857
DEFINE_WRAPPERTYPEINFO();
58+
5959
public:
6060
enum ObservationFlags { kSubtree = 1 << 3, kAttributeFilter = 1 << 4 };
6161
enum DeliveryFlags {
@@ -67,8 +67,7 @@ class MutationObserver final : public ScriptWrappable {
6767
public:
6868
~Delegate() = default;
6969
virtual ExecutingContext* GetExecutingContext() const = 0;
70-
virtual void Deliver(const MutationRecordVector& records,
71-
MutationObserver&) = 0;
70+
virtual void Deliver(const MutationRecordVector& records, MutationObserver&) = 0;
7271
virtual void Trace(GCVisitor* visitor) const {}
7372
};
7473

@@ -92,7 +91,7 @@ class MutationObserver final : public ScriptWrappable {
9291

9392
bool HasPendingActivity() const { return !records_.empty(); }
9493

95-
void Trace(webf::GCVisitor *visitor) const override;
94+
void Trace(webf::GCVisitor* visitor) const override;
9695

9796
private:
9897
std::vector<Member<MutationRecord>> records_;

bridge/core/dom/mutation_observer_interest_group.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ std::shared_ptr<MutationObserverInterestGroup> MutationObserverInterestGroup::Cr
5353

5454
MutationObserverInterestGroup::MutationObserverInterestGroup(
5555
std::unordered_map<MutationObserver*, MutationRecordDeliveryOptions>& observers,
56-
webf::MutationRecordDeliveryOptions old_value_flag): old_value_flag_(old_value_flag) {
56+
webf::MutationRecordDeliveryOptions old_value_flag)
57+
: old_value_flag_(old_value_flag) {
5758
assert(!observers.empty());
5859
observers_.swap(observers);
5960
}
@@ -66,8 +67,7 @@ bool MutationObserverInterestGroup::IsOldValueRequested() {
6667
return false;
6768
}
6869

69-
void MutationObserverInterestGroup::EnqueueMutationRecord(
70-
MutationRecord* mutation) {
70+
void MutationObserverInterestGroup::EnqueueMutationRecord(MutationRecord* mutation) {
7171
MutationRecord* mutation_with_null_old_value = nullptr;
7272

7373
for (auto& iter : observers_) {
@@ -80,8 +80,7 @@ void MutationObserverInterestGroup::EnqueueMutationRecord(
8080
if (mutation->oldValue().IsNull())
8181
mutation_with_null_old_value = mutation;
8282
else
83-
mutation_with_null_old_value =
84-
MutationRecord::CreateWithNullOldValue(mutation);
83+
mutation_with_null_old_value = MutationRecord::CreateWithNullOldValue(mutation);
8584
}
8685
observer->EnqueueMutationRecord(mutation_with_null_old_value);
8786
}

0 commit comments

Comments
 (0)