MCPcopy Create free account
hub / github.com/dillo-browser/dillo / DeepIterator

Method DeepIterator

dw/iterator.cc:497–588  ·  view source on GitHub ↗

* \brief Create a new deep iterator from an existing dw::core::Iterator. * * The content of the return value will be the content of \em it. If within * the widget tree, there is no non-widget content, the resulting deep * iterator is empty (denoted by dw::core::DeepIterator::stack == NULL). * * Notes: * * * The mask of \em i" must include DW_CONTENT_WIDGET, but * dw::core:

Source from the content-addressed store, hash-verified

495 * </ol>
496 */
497DeepIterator::DeepIterator (Iterator *it)
498{
499 //printf ("Starting creating DeepIterator %p ...\n", this);
500 //printf ("Initial iterator: ");
501 //it->print ();
502 //printf ("\n");
503
504 // Widgets out of flow are either followed widtin containers, or
505 // generators. Both (and also nothing at all) is not allowed. See
506 // also comment in getRespectiveParent.
507 int oofMask =
508 it->getMask() & (Content::WIDGET_OOF_CONT | Content::WIDGET_OOF_REF);
509 assert (oofMask == Content::WIDGET_OOF_CONT ||
510 oofMask == Content::WIDGET_OOF_REF);
511
512 //DEBUG_MSG (1, "a_Dw_ext_iterator_new: %s\n", a_Dw_iterator_text (it));
513
514 // Clone input iterator, so the iterator passed as parameter
515 // remains untouched.
516 it = it->cloneIterator ();
517 this->mask = it->getMask ();
518
519 hasContents = true;
520
521 // If it points to a widget, find a near non-widget content,
522 // since an DeepIterator should never return widgets.
523 if (it->getContent()->type & Content::ANY_WIDGET) {
524 Iterator *it2;
525
526 // The second argument of searchDownward is actually a matter of
527 // taste :-)
528 if ((it2 = searchDownward (it, mask, false)) ||
529 (it2 = searchSideward (it, mask, false)) ||
530 (it2 = searchSideward (it, mask, true))) {
531 it->unref ();
532 it = it2;
533 } else {
534 // This may happen, when a page does not contain any non-widget
535 // content.
536 //DEBUG_MSG (1, "a_Dw_ext_iterator_new got totally helpless!\n");
537 it->unref ();
538 hasContents = false;
539 }
540 }
541
542 //DEBUG_MSG (1, " => %s\n", a_Dw_iterator_text (it));
543
544 if (hasContents) {
545 // If this widget has parents, we must construct appropriate iterators.
546 //
547 // \todo There may be a faster way instead of iterating through the
548 // parent widgets.
549
550 //printf ("Starting with: ");
551 //it->print ();
552 //printf ("\n");
553
554 // Construct the iterators.

Callers

nothing calls this directly

Calls 8

getMaskMethod · 0.80
cloneIteratorMethod · 0.80
getContentMethod · 0.45
unrefMethod · 0.45
getWidgetMethod · 0.45
iteratorMethod · 0.45
putMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected