Retire some instanceOf
usage.
More can be retired. Eventually, I think I can eliminate the poor-man's RTTI in `Identity::Class`.
This commit is contained in:
@ -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 <Textblock>()) {
|
||||
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 <Textblock>() &&
|
||||
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 <RegardingBorder>() &&
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user