diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | dw/fltkviewbase.cc | 7 | ||||
-rw-r--r-- | dw/fltkviewbase.hh | 2 | ||||
-rw-r--r-- | dw/ooffloatsmgr.cc | 4 | ||||
-rw-r--r-- | dw/textblock.cc | 52 | ||||
-rw-r--r-- | dw/textblock_linebreaking.cc | 19 | ||||
-rw-r--r-- | dw/widget.cc | 9 | ||||
-rw-r--r-- | lout/container.hh | 6 | ||||
-rw-r--r-- | test/dw_simple_container.hh | 2 |
9 files changed, 64 insertions, 38 deletions
@@ -31,6 +31,7 @@ dillo-3.1 [not released yet] - Make building of test/ files more robust. - Fix Makefile to pick up LIBJPEG_CPPFLAGS. - Work on collapsing spaces: more cases supported. + - Fix crash that's possible searching for text while page still being built. Patches: Sebastian Geerken +- Image buffer/cache improvements. Patch: Jorge Arellano Cid diff --git a/dw/fltkviewbase.cc b/dw/fltkviewbase.cc index 30a19d58..f7e331fc 100644 --- a/dw/fltkviewbase.cc +++ b/dw/fltkviewbase.cc @@ -27,8 +27,6 @@ #include <stdio.h> #include "../lout/msg.h" -extern Fl_Widget* fl_oldfocus; - using namespace lout::object; using namespace lout::container::typed; @@ -71,7 +69,7 @@ FltkViewBase::FltkViewBase (int x, int y, int w, int h, const char *label): canvasHeight = 1; bgColor = FL_WHITE; mouse_x = mouse_y = 0; - focused_child = NULL; + // focused_child = NULL; exposeArea = NULL; if (backBuffer == NULL) { backBuffer = new BackBuffer (); @@ -357,6 +355,8 @@ int FltkViewBase::handle (int event) case FL_LEAVE: theLayout->leaveNotify (this, getDwButtonState ()); break; +#if 0 + // BUG: starting with fltk-1.3.3, we can't use fl_oldfocus. case FL_FOCUS: if (focused_child && find(focused_child) < children()) { /* strangely, find() == children() if the child is not found */ @@ -366,6 +366,7 @@ int FltkViewBase::handle (int event) case FL_UNFOCUS: focused_child = fl_oldfocus; return 0; +#endif case FL_KEYBOARD: if (Fl::event_key() == FL_Tab) return manageTabToFocus(); diff --git a/dw/fltkviewbase.hh b/dw/fltkviewbase.hh index eb4ec322..88fd9041 100644 --- a/dw/fltkviewbase.hh +++ b/dw/fltkviewbase.hh @@ -56,7 +56,7 @@ protected: core::Layout *theLayout; int canvasWidth, canvasHeight; int mouse_x, mouse_y; - Fl_Widget *focused_child; + // Fl_Widget *focused_child; virtual int translateViewXToCanvasX (int x) = 0; virtual int translateViewYToCanvasY (int y) = 0; diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index a4cfed5a..145d7159 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -1807,6 +1807,10 @@ void OOFFloatsMgr::getFloatsSize (Requisition *cbReq, Side side, int *width, for (int i = 0; i < list->size(); i++) { Float *vloat = list->get(i); + DBG_OBJ_MSGF ("resize.oofm", 1, + "float %p has generator %p (container is %p)", + vloat->getWidget (), vloat->generatingBlock, container); + if (vloat->generatingBlock == container || wasAllocated (vloat->generatingBlock)) { ensureFloatSize (vloat); diff --git a/dw/textblock.cc b/dw/textblock.cc index d88b411f..564493b9 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -581,6 +581,9 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) DBG_OBJ_MSG_START (); for (lineIndex = 0; lineIndex < lines->size (); lineIndex++) { + DBG_OBJ_MSGF ("resize", 1, "line %d", lineIndex); + DBG_OBJ_MSG_START (); + // Especially for floats, allocation->width may be different // from the line break width, so that for centered and right // text, the offsets have to be recalculated again. However, if @@ -593,6 +596,8 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) line = lines->getRef (lineIndex); xCursor = line->textOffset; + DBG_OBJ_MSGF ("resize", 1, "xCursor = %d (initially)", xCursor); + for (wordIndex = line->firstWord; wordIndex <= line->lastWord; wordIndex++) { word = words->getRef (wordIndex); @@ -687,7 +692,12 @@ void Textblock::sizeAllocateImpl (core::Allocation *allocation) } xCursor += (word->size.width + word->effSpace); + DBG_OBJ_MSGF ("resize", 1, "xCursor = %d (after word %d)", + xCursor, wordIndex); + DBG_MSG_WORD("resize", 1, "<i>that is:</i> ", wordIndex, ""); } + + DBG_OBJ_MSG_END (); } DBG_OBJ_MSG_END (); @@ -2341,6 +2351,7 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) * (parent_ref is actually undefined, but likely has the value 0.) At the, * end of this function, the correct value is assigned. */ widget->parentRef = -1; + DBG_OBJ_SET_NUM_O (widget, "parentRef", widget->parentRef); widget->setStyle (style); @@ -3138,31 +3149,40 @@ Textblock *Textblock::getTextblockForLine (int lineNo) Textblock *Textblock::getTextblockForLine (int firstWord, int lastWord) { + DBG_OBJ_ENTER ("resize", 0, "getTextblockForLine", "%d, %d", + firstWord, lastWord); + DBG_OBJ_MSGF ("resize", 1, "words.size = %d", words->size ()); + + Textblock *textblock = NULL; + if (firstWord < words->size ()) { - //printf ("[%p] GET_TEXTBLOCK_FOR_LINE (%d, %d)\n", - // this, firstWord, lastWord); + DBG_MSG_WORD ("resize", 1, "<i>first word:</i> ", firstWord, ""); // A textblock is always between two line breaks, and so the // first word of the line. Word *word = words->getRef (firstWord); - if (word->content.type == core::Content::WIDGET_IN_FLOW && - word->content.widget->instanceOf (Textblock::CLASS_ID) && - // Exclude inline blocks (see definition of float container). - (word->content.widget->getStyle()->display - == core::style::DISPLAY_BLOCK || - word->content.widget->getStyle()->display - == core::style::DISPLAY_LIST_ITEM)) { - //printf (" word %d: ", firstWord); - //printWordShort (word); - //printf ("\n"); - - return (Textblock*)word->content.widget; + DBG_MSG_WORD ("resize", 1, "<i>first word:</i> ", firstWord, ""); + + if (word->content.type == core::Content::WIDGET_IN_FLOW) { + Widget *widget = word->content.widget; + if (widget->instanceOf (Textblock::CLASS_ID) && + // Exclude some cases where a textblock constitutes a new + // container (see definition of float container in + // Textblock::isContainingBlock). + widget->getStyle()->display != core::style::DISPLAY_INLINE_BLOCK && + widget->getStyle()->overflow == core::style::OVERFLOW_VISIBLE) + textblock = (Textblock*)widget; + + // (TODO: It would look nicer if there is one common place + // for such definitions. Will be fixed in "dillo_grows", not + // here.) } } - //printf (" nothing\n"); - return NULL; + DBG_OBJ_MSGF ("resize", 1, "=> %p", textblock); + DBG_OBJ_LEAVE (); + return textblock; } /** diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index f9ec1ecd..cdd99197 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -389,7 +389,8 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, nonTemporaryLines = lines->size (); } - PRINTF ("nonTemporaryLines = %d\n", nonTemporaryLines); + DBG_OBJ_MSGF ("construct.line", 1, "nonTemporaryLines = %d", + nonTemporaryLines); int lineIndex = lines->size () - 1; Line *line = lines->getRef (lineIndex); @@ -413,6 +414,12 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, line->rightOffset = misc::max (regardBorder ? newLineRightBorder : 0, boxRestWidth ()); + DBG_OBJ_MSGF ("construct.line", 1, + "regardBorder = %s, newLineLeftBorder = %d, " + "newLineRightBorder = %d", + regardBorder ? "true" : "false", newLineLeftBorder, + newLineRightBorder); + DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "leftOffset", line->leftOffset); DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "rightOffset", line->rightOffset); @@ -439,7 +446,6 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, prevLine->lastOofRefPositionedBeforeThisLine; } - DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "top", line->top); DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "maxLineWidth", line->maxLineWidth); @@ -456,6 +462,8 @@ Textblock::Line *Textblock::addLine (int firstWord, int lastWord, + prevLine->totalHeight (line->marginAscent - line->borderAscent); } + DBG_OBJ_ARRATTRSET_NUM ("lines", lineIndex, "top", line->top); + // Especially empty lines (possible when there are floats) have // zero height, which may cause endless loops. For this reasons, // the height should be positive (assuming the caller passed @@ -842,9 +850,8 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) if (wordIndex >= firstWordWithoutLine) { word->content.widget->parentRef = makeParentRefInFlow (lines->size ()); - PRINTF ("The %s %p is assigned parentRef = %d.\n", - word->content.widget->getClassName(), word->content.widget, - word->content.widget->parentRef); + DBG_OBJ_SET_NUM_O (word->content.widget, "parentRef", + word->content.widget->parentRef); } } @@ -1532,6 +1539,8 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex) marginDescent - word->content.widget->getStyle()->margin.bottom; word->content.widget->parentRef = makeParentRefInFlow (lineIndex); + DBG_OBJ_SET_NUM_O (word->content.widget, "parentRef", + word->content.widget->parentRef); } else { borderAscent = marginAscent = word->size.ascent; borderDescent = marginDescent = word->size.descent; diff --git a/dw/widget.cc b/dw/widget.cc index 9c517f24..8840fc3a 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -690,12 +690,6 @@ void Widget::sizeRequest (Requisition *requisition) enterSizeRequest (); - //printf ("The %stop-level %s %p with parentRef = %d: needsResize: %s, " - // "resizeQueued = %s\n", - // parent ? "non-" : "", getClassName(), this, parentRef, - // needsResize () ? "true" : "false", - // resizeQueued () ? "true" : "false"); - if (resizeQueued ()) { // This method is called outside of Layout::resizeIdle. setFlags (NEEDS_RESIZE); @@ -718,9 +712,6 @@ void Widget::sizeRequest (Requisition *requisition) } else *requisition = this->requisition; - //printf (" ==> Result: %d x (%d + %d)\n", - // requisition->width, requisition->ascent, requisition->descent); - leaveSizeRequest (); DBG_OBJ_LEAVE (); diff --git a/lout/container.hh b/lout/container.hh index f8c22439..3051970e 100644 --- a/lout/container.hh +++ b/lout/container.hh @@ -432,9 +432,9 @@ public: { ((untyped::Vector*)this->base)->put(newElement, newPos); } inline void insert(T *newElement, int pos) { ((untyped::Vector*)this->base)->insert(newElement, pos); } - inline bool insertSorted(T *newElement, - object::Comparator *comparator = - &object::standardComparator) + inline int insertSorted(T *newElement, + object::Comparator *comparator = + &object::standardComparator) { return ((untyped::Vector*)this->base)->insertSorted(newElement, comparator); } inline void remove(int pos) { ((untyped::Vector*)this->base)->remove(pos); } diff --git a/test/dw_simple_container.hh b/test/dw_simple_container.hh index 9f3b2ca6..423b1fab 100644 --- a/test/dw_simple_container.hh +++ b/test/dw_simple_container.hh @@ -1,5 +1,5 @@ #ifndef __DW_SIMPLE_CONTAINER_HH__ -#define __DWR_SIMPLE_CONTAINER_HH__ +#define __DW_SIMPLE_CONTAINER_HH__ #include "dw/core.hh" |