summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2019-07-11 14:57:46 +0000
committerGitHub <noreply@github.com>2019-07-11 14:57:46 +0000
commit69970c911be3c9189006c61fea7c059bf4f7e005 (patch)
tree897c26912343bbc34a3820bc2e3a9a2030ab4781 /layout/base
parent04a7c6bb4e4048369e0a635dc02e9d83bbd59f87 (diff)
parent570cad82795beeb1eb7011c09be295afa11373ce (diff)
downloadUXP-69970c911be3c9189006c61fea7c059bf4f7e005.tar
UXP-69970c911be3c9189006c61fea7c059bf4f7e005.tar.gz
UXP-69970c911be3c9189006c61fea7c059bf4f7e005.tar.lz
UXP-69970c911be3c9189006c61fea7c059bf4f7e005.tar.xz
UXP-69970c911be3c9189006c61fea7c059bf4f7e005.zip
Merge pull request #1171 from win7-7/FrameProperties-iterate-once-pr
Iterate the frame property list once to collect which child list properties we have
Diffstat (limited to 'layout/base')
-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.
*/