aboutsummaryrefslogtreecommitdiff
path: root/src/css.hh
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-10-12 09:58:07 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-10-12 09:58:07 +0200
commit0cb94cd0c167ab0bf7940de10ba0075a20eac064 (patch)
treeafa6c002480c18f5022aefa606d96e727146dbfb /src/css.hh
parentff717a2d9bc7dad370e3eb9a7919ea8a12e46416 (diff)
implement optional deep copy for CssPropertyList
Diffstat (limited to 'src/css.hh')
-rw-r--r--src/css.hh19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/css.hh b/src/css.hh
index 1ed8c39b..4ed854d1 100644
--- a/src/css.hh
+++ b/src/css.hh
@@ -304,10 +304,25 @@ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> {
refCount = 0;
this->ownerOfStrings = ownerOfStrings;
};
- inline CssPropertyList(const CssPropertyList &p) :
+ inline CssPropertyList(const CssPropertyList &p, bool deep = false) :
lout::misc::SimpleVector <CssProperty> (p) {
refCount = 0;
- ownerOfStrings = false;
+ if (deep) {
+ for (int i = 0; i < size (); i++) {
+ CssProperty *p = getRef(i);
+ switch (p->type) {
+ case CSS_TYPE_STRING:
+ case CSS_TYPE_SYMBOL:
+ p->value.strVal = dStrdup (p->value.strVal);
+ break;
+ default:
+ break;
+ }
+ }
+ ownerOfStrings = true;
+ } else {
+ ownerOfStrings = false;
+ }
};
~CssPropertyList ();