From b1c1192d459d59624101eabc1fc6811fabd24943 Mon Sep 17 00:00:00 2001 From: corvid Date: Tue, 11 Nov 2014 17:36:11 +0000 Subject: ChangeLog --- ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog b/ChangeLog index 028fad1b..f226bb49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,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 -- cgit v1.2.3 From dcba927ada3bf7a373758efe0c50f39f0f92da0d Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 11 Nov 2014 20:57:33 +0100 Subject: fix typo in include guard in test --- test/dw_simple_container.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dw_simple_container.hh b/test/dw_simple_container.hh index bb1a37af..fdb67bec 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" -- cgit v1.2.3 From d8c89bded3b3b0be3d42fdd71e48ec1ac21513ad Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Fri, 14 Nov 2014 14:18:55 +0100 Subject: Fixed RTFL glitch. --- dw/outofflowmgr.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index eb56edbb..90f7172c 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -672,10 +672,8 @@ void OutOfFlowMgr::containerSizeChangedForChildren () { DBG_OBJ_ENTER0 ("resize", 0, "containerSizeChangedForChildren"); - DBG_OBJ_MSGF ("resize", 0, - "%d left floats, %d right floats %d abspos", - leftFloatsAll->size (), rightFloatsAll->size (), - absolutelyPositioned->size()); + DBG_OBJ_MSGF ("resize", 0, "%d left floats, %d right floats", + leftFloatsAll->size (), rightFloatsAll->size ()); for (int i = 0; i < leftFloatsAll->size (); i++) leftFloatsAll->get(i)->getWidget()->containerSizeChanged (); -- cgit v1.2.3 From d6210add0244512b1dee53fd15b734a1ee980791 Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Fri, 14 Nov 2014 18:11:22 +0100 Subject: Fixed bug in (unused) Vector::insertSorted(). --- lout/container.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } -- cgit v1.2.3 From ca01dd7f3ba8fdd11e9f385d557877edd2aa956e Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Sat, 15 Nov 2014 01:39:27 +0100 Subject: Fixed a CPU hogging bug. --- dw/outofflowmgr.cc | 7 ++++++- dw/textblock.cc | 49 ++++++++++++++++++++++++++++++-------------- dw/textblock_linebreaking.cc | 9 +++++++- 3 files changed, 48 insertions(+), 17 deletions(-) diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 90f7172c..11b88ae0 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1230,7 +1230,7 @@ int OutOfFlowMgr::calcFloatX (Float *vloat, Side side, int gbX, int gbWidth, // Left floats are always aligned on the left side of the // generator (content, not allocation) ... x = gbX + vloat->generatingBlock->getStyle()->boxOffsetX(); - DBG_OBJ_MSGF ("resize.oofm", 1, "left: x = %d + %d = %d", + DBG_OBJ_MSGF ("resize.common", 1, "left: x = %d + %d = %d", gbX, vloat->generatingBlock->getStyle()->boxOffsetX(), x); // ... but when the float exceeds the line break width of the // container, it is corrected (but not left of the container). @@ -1795,6 +1795,11 @@ void OutOfFlowMgr::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, + containingBlock); + if (vloat->generatingBlock == containingBlock || wasAllocated (vloat->generatingBlock)) { ensureFloatSize (vloat); diff --git a/dw/textblock.cc b/dw/textblock.cc index 47ed7bdb..dd0aa100 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -626,6 +626,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 @@ -638,6 +641,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); @@ -732,7 +737,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, "that is: ", wordIndex, ""); } + + DBG_OBJ_MSG_END (); } DBG_OBJ_MSG_END (); @@ -3117,31 +3127,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, "first word: ", 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"); + DBG_MSG_WORD ("resize", 1, "first word: ", firstWord, ""); - return (Textblock*)word->content.widget; + 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_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 66391952..9a2a1a7c 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); -- cgit v1.2.3 From 474dc2e3c3f0a9443a86766067f021db08bfc741 Mon Sep 17 00:00:00 2001 From: corvid Date: Sun, 16 Nov 2014 05:35:16 +0000 Subject: can't use fl_oldfocus anymore -- this will make focus behaviour somewhat screwy http://lists.dillo.org/pipermail/dillo-dev/2014-November/010273.html A couple of months ago, Lauri Kasanen made some changes to fltk's linker stuff, and I guess we're seeing the effect here. As for focus behaviour being screwy, if you click on a page to give it focus, then move the cursor away and then back onto the page, it won't get focus again -- focus will go to an input or the location bar or something. --- dw/fltkviewbase.cc | 7 ++++--- dw/fltkviewbase.hh | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) 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 #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; -- cgit v1.2.3 From f83977c78fb00b0c1d57235e4e9784af822d39ba Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Mon, 17 Nov 2014 20:25:01 +0100 Subject: RTFL messages. --- dw/outofflowmgr.cc | 2 ++ dw/textblock.cc | 1 + dw/textblock_linebreaking.cc | 7 ++++--- dw/widget.cc | 9 --------- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/dw/outofflowmgr.cc b/dw/outofflowmgr.cc index 11b88ae0..cd42a9a5 100644 --- a/dw/outofflowmgr.cc +++ b/dw/outofflowmgr.cc @@ -1356,6 +1356,7 @@ void OutOfFlowMgr::addWidgetOOF (Widget *widget, Textblock *generatingBlock, "widget", vloat->getWidget ()); widget->parentRef = createRefLeftFloat (leftFloatsAll->size() - 1); + DBG_OBJ_SET_NUM_O (widget, "parentRef", widget->parentRef); tbInfo->leftFloatsGB->put (vloat); if (wasAllocated (generatingBlock)) { @@ -1384,6 +1385,7 @@ void OutOfFlowMgr::addWidgetOOF (Widget *widget, Textblock *generatingBlock, "widget", vloat->getWidget ()); widget->parentRef = createRefRightFloat (rightFloatsAll->size() - 1); + DBG_OBJ_SET_NUM_O (widget, "parentRef", widget->parentRef); tbInfo->rightFloatsGB->put (vloat); if (wasAllocated (generatingBlock)) { diff --git a/dw/textblock.cc b/dw/textblock.cc index dd0aa100..8c2accb4 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2352,6 +2352,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); diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 9a2a1a7c..4b181152 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -842,9 +842,8 @@ int Textblock::wrapWordInFlow (int wordIndex, bool wrapAll) if (wordIndex >= firstWordWithoutLine) { word->content.widget->parentRef = OutOfFlowMgr::createRefNormalFlow (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); } } @@ -1509,6 +1508,8 @@ void Textblock::accumulateWordForLine (int lineIndex, int wordIndex) word->content.widget->parentRef = OutOfFlowMgr::createRefNormalFlow (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 1e7a05d1..ccded039 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -480,12 +480,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); @@ -507,9 +501,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 (); -- cgit v1.2.3 From 1897da6e8181c5dbd8c4e38ab0af72553158e75c Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Mon, 17 Nov 2014 21:10:04 +0100 Subject: RTFL messages. --- dw/textblock_linebreaking.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dw/textblock_linebreaking.cc b/dw/textblock_linebreaking.cc index 4b181152..f8a46897 100644 --- a/dw/textblock_linebreaking.cc +++ b/dw/textblock_linebreaking.cc @@ -446,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); @@ -463,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 -- cgit v1.2.3 From 2db5a9e3e790863db2f67e727512f2373d4c82dc Mon Sep 17 00:00:00 2001 From: Sebastian Geerken Date: Tue, 18 Nov 2014 11:48:08 +0100 Subject: Fixed bug related to floats. --- dw/textblock.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dw/textblock.cc b/dw/textblock.cc index 8c2accb4..d42be1e3 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -3149,7 +3149,7 @@ Textblock *Textblock::getTextblockForLine (int firstWord, int lastWord) // Exclude some cases where a textblock constitutes a new // container (see definition of float container in // Textblock::isContainingBlock). - widget->getStyle()->display != core::style::DISPLAY_BLOCK && + widget->getStyle()->display != core::style::DISPLAY_INLINE_BLOCK && widget->getStyle()->overflow == core::style::OVERFLOW_VISIBLE) textblock = (Textblock*)widget; -- cgit v1.2.3