From 0734577a6989047134835744568b72e52eaa79d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Sun, 8 Jun 2014 21:27:42 +0300 Subject: [PATCH] Fixed|libappfw: LogWidget's rewrapping behavior after refactoring Every call to TextDrawable::update() potentially changes the visible contents of the drawable, so its return value always should be acted upon. --- doomsday/libappfw/src/widgets/logwidget.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doomsday/libappfw/src/widgets/logwidget.cpp b/doomsday/libappfw/src/widgets/logwidget.cpp index c96b3ceb25..e0721b6fdb 100644 --- a/doomsday/libappfw/src/widgets/logwidget.cpp +++ b/doomsday/libappfw/src/widgets/logwidget.cpp @@ -149,7 +149,7 @@ public Font::RichFormat::IStyle void update(int yBottom, Rangei const &visiblePixels) { - if(!_height) return; + if(!_height || drawable.isBeingWrapped()) return; // Determine which lines might be visible. int const lineSpacing = drawable.font().lineSpacing().value(); @@ -197,7 +197,7 @@ public Font::RichFormat::IStyle //int const oldHeight = _height; // Prepare the visible lines for drawing. - drawable.update(); + //drawable.update(); /*{ //_dirty = false; @@ -812,20 +812,26 @@ public Font::RichFormat::IStyle void updateEntries() { int oldHeight = self.contentHeight(); + bool needNotify = false; for(int idx = cache.size() - 1; idx >= 0; --idx) { CacheEntry *entry = cache[idx]; + int prevHeight = entry->height(); + int delta = entry->updateHeightOnly(); if(delta) { + // We won't notify when content height changes because of rewrapping. + if(!prevHeight) needNotify = true; + // The new height will be effective on the next frame. modifyContentHeight(delta); } } - if(self.contentHeight() > oldHeight) + if(needNotify && self.contentHeight() > oldHeight) { emit self.contentHeightIncreased(self.contentHeight() - oldHeight); }