diff --git a/dw/textblock.cc b/dw/textblock.cc index 9c0ac6e..e8a82ec 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -2523,9 +2523,9 @@ void Textblock::addWidget (core::Widget *widget, core::style::Style *style) widget->setParent (this); // TODO Replace (perhaps) later "textblock" by "OOF aware widget". - if (widget->instanceOf ()) { + if (auto *const tb= dynamic_cast< Textblock * >( widget )) { for (int i = 0; i < NUM_OOFM; i++) - searchOutOfFlowMgr(i)->addWidgetInFlow ((Textblock*)widget, this, + searchOutOfFlowMgr(i)->addWidgetInFlow (tb, this, words->size ()); } @@ -2958,10 +2958,10 @@ void Textblock::handOverBreak (core::style::Style *style) Widget *parent; Line *lastLine = lines->getRef (lines->size () - 1); - if (lastLine->breakSpace != 0 && (parent = getParent()) && - parent->instanceOf () && + if (Textblock *textblock2; + lastLine->breakSpace != 0 && (parent = getParent()) && + ( textblock2= dynamic_cast< Textblock * >( parent ) ) && parent->getStyle()->display != core::style::DISPLAY_BLOCK) { - Textblock *textblock2 = (Textblock*) parent; textblock2->addParbreak(lastLine->breakSpace, style); } } @@ -3291,11 +3291,12 @@ RegardingBorder *Textblock::getWidgetRegardingBorderForLine (int firstWord, if (word->content.type == core::Content::WIDGET_IN_FLOW) { Widget *widget = word->content.widget; - if (widget->instanceOf () && + if (auto *const rb= dynamic_cast< RegardingBorder * >( widget ); + rb && // Exclude cases where a textblock constitutes a new floats // container. !isOOFContainer (widget, OOFM_FLOATS)) - widgetRegardingBorder = (RegardingBorder*)widget; + widgetRegardingBorder = rb; } } diff --git a/src/html.cc b/src/html.cc index c7417f2..aa47728 100644 --- a/src/html.cc +++ b/src/html.cc @@ -798,8 +798,8 @@ bool DilloHtml::HtmlLinkReceiver::click (Widget *widget, int link, int img, /* Change the link color to "visited" as visual feedback */ for (Widget *w = widget; w; w = w->getParent()) { _MSG(" ->%s\n", w->getClassName()); - if (w->instanceOf()) { - ((Textblock*)w)->changeLinkColor (link, html->visited_color); + if (auto *tb= dynamic_cast< Textblock *>( w )) { + tb->changeLinkColor (link, html->visited_color); break; } }