diff options
-rw-r--r-- | dw/layout.cc | 6 | ||||
-rw-r--r-- | dw/layout.hh | 7 | ||||
-rw-r--r-- | dw/ooffloatsmgr.cc | 1 | ||||
-rw-r--r-- | dw/ooffloatsmgr.hh | 2 | ||||
-rw-r--r-- | dw/oofpositionedmgr.cc | 1 | ||||
-rw-r--r-- | dw/stackingcontextmgr.cc | 29 | ||||
-rw-r--r-- | dw/stackingcontextmgr.hh | 5 | ||||
-rw-r--r-- | dw/table.cc | 5 | ||||
-rw-r--r-- | dw/textblock.cc | 4 | ||||
-rw-r--r-- | dw/widget.cc | 41 | ||||
-rw-r--r-- | dw/widget.hh | 14 |
11 files changed, 83 insertions, 32 deletions
diff --git a/dw/layout.cc b/dw/layout.cc index 600f2088..60cea8e0 100644 --- a/dw/layout.cc +++ b/dw/layout.cc @@ -379,6 +379,7 @@ void Layout::addWidget (Widget *widget) if (widget->stackingContextMgr == NULL) { widget->stackingContextMgr = new StackingContextMgr (widget); DBG_OBJ_ASSOC (widget, widget->stackingContextMgr); + widget->stackingContextWidget = widget; } topLevel = widget; @@ -661,6 +662,9 @@ bool Layout::calcScrollInto (int requestedValue, int requestedSize, void Layout::draw (View *view, Rectangle *area) { + DBG_OBJ_ENTER ("draw", 0, "draw", "%d, %d, %d * %d", + area->x, area->y, area->width, area->height); + Rectangle widgetArea, intersection, widgetDrawArea; // First of all, draw background image. (Unlike background *color*, @@ -705,6 +709,8 @@ void Layout::draw (View *view, Rectangle *area) view->finishDrawing (&intersection); } } + + DBG_OBJ_LEAVE (); } int Layout::currHScrollbarThickness() diff --git a/dw/layout.hh b/dw/layout.hh index 63c3ed04..efead388 100644 --- a/dw/layout.hh +++ b/dw/layout.hh @@ -314,7 +314,12 @@ public: /* View */ - inline void expose (View *view, Rectangle *area) { draw (view, area); } + inline void expose (View *view, Rectangle *area) { + DBG_OBJ_ENTER ("draw", 0, "expose", "%d, %d, %d * %d", + area->x, area->y, area->width, area->height); + draw (view, area); + DBG_OBJ_LEAVE (); + } /** * \brief This function is called by a view, to delegate a button press diff --git a/dw/ooffloatsmgr.cc b/dw/ooffloatsmgr.cc index d5cc1671..eeca4681 100644 --- a/dw/ooffloatsmgr.cc +++ b/dw/ooffloatsmgr.cc @@ -1277,7 +1277,6 @@ int OOFFloatsMgr::calcFloatX (Float *vloat, Side side, int gbX, int gbWidth, return x; } - void OOFFloatsMgr::draw (View *view, Rectangle *area) { DBG_OBJ_ENTER ("draw", 0, "draw", "%d, %d, %d * %d", diff --git a/dw/ooffloatsmgr.hh b/dw/ooffloatsmgr.hh index e4b61772..274e5d3c 100644 --- a/dw/ooffloatsmgr.hh +++ b/dw/ooffloatsmgr.hh @@ -346,8 +346,6 @@ public: void markExtremesChange (int ref); core::Widget *getWidgetAtPoint (int x, int y); - static bool _isWidgetOutOfFlow (core::Widget *widget); - static bool _isWidgetHandledByOOFM (core::Widget *widget); void addWidgetInFlow (OOFAwareWidget *textblock, OOFAwareWidget *parentBlock, int externalIndex); int addWidgetOOF (core::Widget *widget, OOFAwareWidget *generatingBlock, diff --git a/dw/oofpositionedmgr.cc b/dw/oofpositionedmgr.cc index 2fa32342..449ea322 100644 --- a/dw/oofpositionedmgr.cc +++ b/dw/oofpositionedmgr.cc @@ -184,7 +184,6 @@ void OOFPositionedMgr::draw (View *view, Rectangle *area) DBG_OBJ_LEAVE (); } - void OOFPositionedMgr::addWidgetInFlow (OOFAwareWidget *widget, OOFAwareWidget *parent, int externalIndex) diff --git a/dw/stackingcontextmgr.cc b/dw/stackingcontextmgr.cc index e57c73f0..373756e2 100644 --- a/dw/stackingcontextmgr.cc +++ b/dw/stackingcontextmgr.cc @@ -31,30 +31,33 @@ namespace core { StackingContextMgr::StackingContextMgr (Widget *widget) { DBG_OBJ_CREATE ("dw::core::StackingContextMgr"); - scWidgets = new Vector<Widget> (1, false); - DBG_OBJ_SET_NUM ("scWidgets.size", scWidgets->size()); + + this->widget = widget; + + childSCWidgets = new Vector<Widget> (1, false); + DBG_OBJ_SET_NUM ("childSCWidgets.size", childSCWidgets->size()); minZIndex = maxZIndex = 0; // Just to have some defined values. } StackingContextMgr::~StackingContextMgr () { - delete scWidgets; + delete childSCWidgets; DBG_OBJ_DELETE (); } void StackingContextMgr::addChildSCWidget (Widget *widget) { - if (scWidgets->size () == 0) + if (childSCWidgets->size () == 0) minZIndex = maxZIndex = widget->getStyle()->zIndex; else { minZIndex = min (minZIndex, widget->getStyle()->zIndex); maxZIndex = max (maxZIndex, widget->getStyle()->zIndex); } - scWidgets->put (widget); - DBG_OBJ_SET_NUM ("scWidgets.size", scWidgets->size()); - DBG_OBJ_ARRSET_PTR ("scWidgets", scWidgets->size() - 1, widget); + childSCWidgets->put (widget); + DBG_OBJ_SET_NUM ("childSCWidgets.size", childSCWidgets->size()); + DBG_OBJ_ARRSET_PTR ("childSCWidgets", childSCWidgets->size() - 1, widget); } void StackingContextMgr::drawBottom (View *view, Rectangle *area) @@ -85,8 +88,8 @@ void StackingContextMgr::draw (View *view, Rectangle *area, int startZIndex, DBG_OBJ_MSGF ("draw", 1, "drawing zIndex = %d", zIndex); DBG_OBJ_MSG_START (); - for (int i = 0; i < scWidgets->size (); i++) { - Widget *child = scWidgets->get (i); + for (int i = 0; i < childSCWidgets->size (); i++) { + Widget *child = childSCWidgets->get (i); DBG_OBJ_MSGF ("draw", 2, "widget %p has zIndex = %d", child, child->getStyle()->zIndex); Rectangle childArea; @@ -132,12 +135,13 @@ Widget *StackingContextMgr::getWidgetAtPoint (int x, int y, int startZIndex, DBG_OBJ_MSGF ("events", 1, "searching zIndex = %d", zIndex); DBG_OBJ_MSG_START (); - for (int i = 0; i < scWidgets->size () && widgetAtPoint == NULL; i++) { - Widget *child = scWidgets->get (i); + for (int i = 0; i < childSCWidgets->size () && widgetAtPoint == NULL; + i++) { + Widget *child = childSCWidgets->get (i); DBG_OBJ_MSGF ("events", 2, "widget %p has zIndex = %d", child, child->getStyle()->zIndex); if (child->getStyle()->zIndex == zIndex && child->wasAllocated ()) - widgetAtPoint = scWidgets->get(i)->getWidgetAtPoint (x, y); + widgetAtPoint = childSCWidgets->get(i)->getWidgetAtPoint (x, y); } DBG_OBJ_MSG_END (); @@ -148,7 +152,6 @@ Widget *StackingContextMgr::getWidgetAtPoint (int x, int y, int startZIndex, return widgetAtPoint; } - } // namespace core } // namespace dw diff --git a/dw/stackingcontextmgr.hh b/dw/stackingcontextmgr.hh index 684fac23..5c6a0d2f 100644 --- a/dw/stackingcontextmgr.hh +++ b/dw/stackingcontextmgr.hh @@ -13,15 +13,14 @@ namespace dw { namespace core { -class OOFAwareWidget; - /** * \brief See \ref dw-stacking-context. */ class StackingContextMgr { private: - lout::container::typed::Vector<Widget> *scWidgets; + Widget *widget; + lout::container::typed::Vector<Widget> *childSCWidgets; int minZIndex, maxZIndex; void draw (View *view, Rectangle *area, int startZIndex, int endZIndex); diff --git a/dw/table.cc b/dw/table.cc index ce45b7ad..5e4083ff 100644 --- a/dw/table.cc +++ b/dw/table.cc @@ -358,6 +358,9 @@ bool Table::isBlockLevel () void Table::draw (core::View *view, core::Rectangle *area) { + DBG_OBJ_ENTER ("draw", 0, "draw", "%d, %d, %d * %d", + area->x, area->y, area->width, area->height); + // Can be optimized, by iterating on the lines in area. drawWidgetBox (view, area, false); @@ -389,6 +392,8 @@ void Table::draw (core::View *view, core::Rectangle *area) } drawOOF (view, area); + + DBG_OBJ_LEAVE (); } void Table::removeChild (Widget *child) diff --git a/dw/textblock.cc b/dw/textblock.cc index a9920a1c..ae4c6cb4 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -1452,8 +1452,8 @@ void Textblock::drawLine (Line *line, core::View *view, core::Rectangle *area) DBG_OBJ_MSGF ("draw", 1, "line from %d to %d (%d words), at (%d, %d)", line->firstWord, line->lastWord, words->size (), xWidget, yWidgetBase); - DBG_MSG_WORD ("draw", 0, "<i>line starts with: </i>", line->firstWord, ""); - DBG_MSG_WORD ("draw", 0, "<i>line ends with: </i>", line->lastWord, ""); + DBG_MSG_WORD ("draw", 1, "<i>line starts with: </i>", line->firstWord, ""); + DBG_MSG_WORD ("draw", 1, "<i>line ends with: </i>", line->lastWord, ""); for (int wordIndex = line->firstWord; wordIndex <= line->lastWord && xWidget < area->x + area->width; diff --git a/dw/widget.cc b/dw/widget.cc index 553439ff..be103756 100644 --- a/dw/widget.cc +++ b/dw/widget.cc @@ -130,6 +130,10 @@ Widget::~Widget () */ bool Widget::intersects (Rectangle *area, Rectangle *intersection) { + DBG_OBJ_ENTER ("draw", 0, "intersects", "%d, %d, %d * %d", + area->x, area->y, area->width, area->height); + bool r; + if (wasAllocated ()) { Rectangle parentArea, childArea; @@ -137,19 +141,42 @@ bool Widget::intersects (Rectangle *area, Rectangle *intersection) parentArea.x += parent->allocation.x; parentArea.y += parent->allocation.y; + DBG_OBJ_MSGF ("draw", 2, "parentArea: %d, %d, %d * %d", + parentArea.x, parentArea.y, parentArea.width, + parentArea.height); + childArea.x = allocation.x; childArea.y = allocation.y; childArea.width = allocation.width; childArea.height = getHeight (); + + DBG_OBJ_MSGF ("draw", 2, "childArea: %d, %d, %d * %d", + childArea.x, childArea.y, childArea.width, + childArea.height); if (parentArea.intersectsWith (&childArea, intersection)) { + DBG_OBJ_MSGF ("draw", 2, "intersection: %d, %d, %d * %d", + intersection->x, intersection->y, intersection->width, + intersection->height); + intersection->x -= allocation.x; intersection->y -= allocation.y; - return true; - } else - return false; - } else - return false; + r = true; + + DBG_OBJ_MSGF ("draw", 1, "=> %d, %d, %d * %d", + intersection->x, intersection->y, intersection->width, + intersection->height); + } else { + r = false; + DBG_OBJ_MSG ("draw", 1, "=> no intersection"); + } + } else { + r = false; + DBG_OBJ_MSG ("draw", 1, "=> not allocated"); + } + + DBG_OBJ_LEAVE (); + return r; } void Widget::setParent (Widget *parent) @@ -187,7 +214,8 @@ void Widget::setParent (Widget *parent) stackingContextWidget = stackingContextWidget->parent; assert (stackingContextWidget); stackingContextWidget->stackingContextMgr->addChildSCWidget (this); - } + } else + stackingContextWidget = parent->stackingContextWidget; notifySetParent(); } @@ -1122,6 +1150,7 @@ void Widget::setStyle (style::Style *style) StackingContextMgr::isEstablishingStackingContext (this)) { stackingContextMgr = new StackingContextMgr (this); DBG_OBJ_ASSOC_CHILD (stackingContextMgr); + stackingContextWidget = this; } if (sizeChanged) diff --git a/dw/widget.hh b/dw/widget.hh index 9acb6605..4ad397ee 100644 --- a/dw/widget.hh +++ b/dw/widget.hh @@ -196,11 +196,20 @@ protected: style::Box extraSpace; /** - * \brief Set iff this widget constitutes a stacking context, as - * defined by CSS. + * \brief Set iff this widget constitutes a stacking context, as defined by + * CSS. */ StackingContextMgr *stackingContextMgr; + /** + * \brief The bottom-most ancestor (or this) for which stackingContextMgr is + * set. + */ + Widget *stackingContextWidget; + + inline StackingContextMgr *getNextStackingContextMgr () + { return stackingContextWidget->stackingContextMgr; } + /*inline void printFlags () { DBG_IF_RTFL { char buf[10 * 3 - 1 + 1]; @@ -262,7 +271,6 @@ protected: inline void unsetFlags (Flags f) { flags = (Flags)(flags & ~f); printFlag (f); } - inline void queueDraw () { queueDrawArea (0, 0, allocation.width, getHeight()); } void queueDrawArea (int x, int y, int width, int height); |