Hey all,

addStyleClass() and removeStyleClass() of WWebWidget when called with force
= true
argument does not update the corresponding property of the DOM element.
The flag BIT_STYLECLASS_CHANGED should be always set when we
set styleClass_ of lookImpl_ regardless force or not force.
The applied patch solves this problem.

Regards,
Dmitriy
diff --git a/src/Wt/WWebWidget.C b/src/Wt/WWebWidget.C
index cc4c53d..1b1333d 100644
--- a/src/Wt/WWebWidget.C
+++ b/src/Wt/WWebWidget.C
@@ -675,10 +675,7 @@ void WWebWidget::addStyleClass(const WT_USTRING& styleClass, bool force)
       = WT_USTRING::fromUTF8(Utils::addWord(lookImpl_->styleClass_.toUTF8(),
 					    styleClass.toUTF8()));
 
-    if (!force) {
-      flags_.set(BIT_STYLECLASS_CHANGED);
-      repaint(RepaintPropertyAttribute);
-    }
+    flags_.set(BIT_STYLECLASS_CHANGED);
   }
 
   if (force && isRendered()) {
@@ -689,7 +686,8 @@ void WWebWidget::addStyleClass(const WT_USTRING& styleClass, bool force)
     Utils::erase(transientImpl_->removedStyleClasses_, styleClass);
 
     repaint(RepaintPropertyAttribute);
-  }
+  } else if (!force)
+    repaint(RepaintPropertyAttribute);
 }
 
 void WWebWidget::removeStyleClass(const WT_USTRING& styleClass, bool force)
@@ -707,10 +705,7 @@ void WWebWidget::removeStyleClass(const WT_USTRING& styleClass, bool force)
     lookImpl_->styleClass_
       = WT_USTRING::fromUTF8(Utils::eraseWord(lookImpl_->styleClass_.toUTF8(),
 					      styleClass.toUTF8()));
-    if (!force) {
-      flags_.set(BIT_STYLECLASS_CHANGED);
-      repaint(RepaintPropertyAttribute);
-    }
+    flags_.set(BIT_STYLECLASS_CHANGED);
   }
 
   if (force && isRendered()) {
@@ -721,7 +716,8 @@ void WWebWidget::removeStyleClass(const WT_USTRING& styleClass, bool force)
     Utils::erase(transientImpl_->addedStyleClasses_, styleClass);
 
     repaint(RepaintPropertyAttribute);
-  }
+  } else if (!force)
+    repaint(RepaintPropertyAttribute);
 }
 
 void WWebWidget::addStyleClass(const char *styleClass, bool force)
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to