summaryrefslogtreecommitdiffstats
path: root/layout/base/FrameProperties.h
diff options
context:
space:
mode:
authorJeroen Vreeken <jeroen@vreeken.net>2019-07-18 11:02:12 +0200
committerJeroen Vreeken <jeroen@vreeken.net>2019-07-18 11:02:12 +0200
commitf820636a8300b44751750354a01be21895b4b536 (patch)
treeab217ad50a145a8c7a1094fbafd5d3d30260e7cd /layout/base/FrameProperties.h
parent6b6aa59ffc97ac76b4429db38eedac8474f5fda7 (diff)
parent45cb5ab7291f44d3e06de4e71e5b0a9e80f6a0b6 (diff)
downloadUXP-f820636a8300b44751750354a01be21895b4b536.tar
UXP-f820636a8300b44751750354a01be21895b4b536.tar.gz
UXP-f820636a8300b44751750354a01be21895b4b536.tar.lz
UXP-f820636a8300b44751750354a01be21895b4b536.tar.xz
UXP-f820636a8300b44751750354a01be21895b4b536.zip
Merge branch 'master' of github.com:JeroenVreeken/UXP
Diffstat (limited to 'layout/base/FrameProperties.h')
-rw-r--r--layout/base/FrameProperties.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/layout/base/FrameProperties.h b/layout/base/FrameProperties.h
index bba3ee06b..71a79138a 100644
--- a/layout/base/FrameProperties.h
+++ b/layout/base/FrameProperties.h
@@ -161,6 +161,11 @@ public:
}
/**
+ * Return true if we have no properties, otherwise return false.
+ */
+ bool IsEmpty() const { return mProperties.IsEmpty(); }
+
+ /**
* Set a property value. This requires a linear search through
* the properties of the frame. Any existing value for the property
* is destroyed.
@@ -241,6 +246,28 @@ public:
{
DeleteInternal(aProperty, aFrame);
}
+
+ /**
+ * Call @aFunction for each property or until @aFunction returns false.
+ */
+ template<class F>
+ void ForEach(F aFunction) const
+ {
+#ifdef DEBUG
+ size_t len = mProperties.Length();
+#endif
+ for (const auto& prop : mProperties) {
+ bool shouldContinue = aFunction(prop.mProperty, prop.mValue);
+#ifdef DEBUG
+ MOZ_ASSERT(len == mProperties.Length(),
+ "frame property list was modified by ForEach callback!");
+#endif
+ if (!shouldContinue) {
+ return;
+ }
+ }
+ }
+
/**
* Remove and destroy all property values for the frame.
*/