diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2016-07-16 18:56:16 -0400 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2016-07-16 18:56:16 -0400 |
commit | 5bbb6755f5e54308b88d27121b07dd6b0c0c368c (patch) | |
tree | 80d38cd6f0fcc597b4ff984a8462897e9426e0bd | |
parent | f2267daa5f920d03bb15294d1be47fbddfdfa793 (diff) |
Fix Layout::resizeIdle()
This was three year old bug, that went undiscovered (hg#2863).
The patch is simpler than it looks, it's just a while cycle enclosing
the body, indentation makes it look large.
How to reproduce:
1. Load [5] at normal size, wait for most images to load, search for "re-re"
with Find Text, press page down (you'll see an image), go Bck/Fwd, check
the image is there. If not, you can place the cursor where the image was,
if you get a hand cursor, Dillo thinks it is there. Wait for the tooltip
and drag it a bit downwards to the right, Dillo will repaint from the image
data.
[5] http://tinyurl.com/huvf6pn
-rw-r--r-- | dw/layout.cc | 151 |
1 files changed, 73 insertions, 78 deletions
diff --git a/dw/layout.cc b/dw/layout.cc index 28633c85..b931edda 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -864,94 +864,89 @@ void Layout::resizeIdle () enterResizeIdle (); - //static int calls = 0; - //printf ("Layout::resizeIdle calls = %d\n", ++calls); + static int calls = 0; - assert (resizeIdleId != -1); + while (resizeIdleId != -1) { + printf ("Layout::resizeIdle calls = %d\n", ++calls); - for (typed::Iterator <Widget> it = queueResizeList->iterator(); - it.hasNext (); ) { - Widget *widget = it.getNext (); + for (typed::Iterator <Widget> it = queueResizeList->iterator(); + it.hasNext (); ) { + Widget *widget = it.getNext (); - //printf (" the %stop-level %s %p was queued (extremes changed: %s)\n", - // widget->parent ? "non-" : "", widget->getClassName(), widget, - // widget->extremesQueued () ? "yes" : "no"); - - if (widget->resizeQueued ()) { - widget->setFlags (Widget::NEEDS_RESIZE); - widget->unsetFlags (Widget::RESIZE_QUEUED); - } + if (widget->resizeQueued ()) { + widget->setFlags (Widget::NEEDS_RESIZE); + widget->unsetFlags (Widget::RESIZE_QUEUED); + } - if (widget->allocateQueued ()) { - widget->setFlags (Widget::NEEDS_ALLOCATE); - widget->unsetFlags (Widget::ALLOCATE_QUEUED); - } + if (widget->allocateQueued ()) { + widget->setFlags (Widget::NEEDS_ALLOCATE); + widget->unsetFlags (Widget::ALLOCATE_QUEUED); + } - if (widget->extremesQueued ()) { - widget->setFlags (Widget::EXTREMES_CHANGED); - widget->unsetFlags (Widget::EXTREMES_QUEUED); + if (widget->extremesQueued ()) { + widget->setFlags (Widget::EXTREMES_CHANGED); + widget->unsetFlags (Widget::EXTREMES_QUEUED); + } } - } - queueResizeList->clear (); - - // Reset already here, since in this function, queueResize() may be - // called again. - resizeIdleId = -1; - - // If this method is triggered by a viewport change, we can save - // time when the toplevel widget is not affected (as for a toplevel - // image resource). - if (topLevel && (topLevel->needsResize () || topLevel->needsAllocate ())) { - Requisition requisition; - Allocation allocation; - - topLevel->sizeRequest (&requisition); - DBG_OBJ_MSGF ("resize", 1, "toplevel size: %d * (%d + %d)", - requisition.width, requisition.ascent, requisition.descent); - - // This method is triggered by Widget::queueResize, which will, - // in any case, set NEEDS_ALLOCATE (indirectly, as ALLOCATE_QUEUED). - // This assertion helps to find inconsistences. (Cases where - // this method is triggered by a viewport change, but the - // toplevel widget is not affected, are filtered out some lines - // above: "if (topLevel && topLevel->needsResize ())".) - assert (topLevel->needsAllocate ()); - - allocation.x = allocation.y = 0; - allocation.width = requisition.width; - allocation.ascent = requisition.ascent; - allocation.descent = requisition.descent; - topLevel->sizeAllocate (&allocation); - - canvasWidth = requisition.width; - canvasAscent = requisition.ascent; - canvasDescent = requisition.descent; - - emitter.emitCanvasSizeChanged (canvasWidth, canvasAscent, canvasDescent); - - // Tell the view about the new world size. - view->setCanvasSize (canvasWidth, canvasAscent, canvasDescent); - - if (usesViewport) { - int currHThickness = currHScrollbarThickness(); - int currVThickness = currVScrollbarThickness(); - - if (!canvasHeightGreater && - canvasAscent + canvasDescent > viewportHeight - currHThickness) { - canvasHeightGreater = true; - DBG_OBJ_SET_SYM ("canvasHeightGreater", - canvasHeightGreater ? "true" : "false"); - containerSizeChanged (); + queueResizeList->clear (); + + // Reset here, since below, queueResize() may be called again. + resizeIdleId = -1; + + // If this method is triggered by a viewport change, we can save + // time when the toplevel widget is not affected (as for a toplevel + // image resource). + if (topLevel && (topLevel->needsResize () || topLevel->needsAllocate ())) { + Requisition requisition; + Allocation allocation; + + topLevel->sizeRequest (&requisition); + DBG_OBJ_MSGF ("resize", 1, "toplevel size: %d * (%d + %d)", + requisition.width, requisition.ascent, + requisition.descent); + + // This method is triggered by Widget::queueResize, which will, + // in any case, set NEEDS_ALLOCATE (indirectly, as ALLOCATE_QUEUED). + // This assertion helps to find inconsistencies. (Cases where + // this method is triggered by a viewport change, but the + // toplevel widget is not affected, are filtered out some lines + // above: "if (topLevel && topLevel->needsResize ())".) + assert (topLevel->needsAllocate ()); + + allocation.x = allocation.y = 0; + allocation.width = requisition.width; + allocation.ascent = requisition.ascent; + allocation.descent = requisition.descent; + topLevel->sizeAllocate (&allocation); + + canvasWidth = requisition.width; + canvasAscent = requisition.ascent; + canvasDescent = requisition.descent; + emitter.emitCanvasSizeChanged (canvasWidth, + canvasAscent, canvasDescent); + // Tell the view about the new world size. + view->setCanvasSize (canvasWidth, canvasAscent, canvasDescent); + + if (usesViewport) { + int currHThickness = currHScrollbarThickness(); + int currVThickness = currVScrollbarThickness(); + + if (!canvasHeightGreater && + canvasAscent + canvasDescent > viewportHeight - currHThickness) { + canvasHeightGreater = true; + DBG_OBJ_SET_SYM ("canvasHeightGreater", + canvasHeightGreater ? "true" : "false"); + containerSizeChanged (); + } + + // Set viewport sizes. + view->setViewportSize (viewportWidth, viewportHeight, + currHThickness, currVThickness); } - // Set viewport sizes. - view->setViewportSize (viewportWidth, viewportHeight, - currHThickness, currVThickness); + // views are redrawn via Widget::resizeDrawImpl () } - - // views are redrawn via Widget::resizeDrawImpl () } - updateAnchor (); DBG_OBJ_MSGF ("resize", 1, |