instanceOf now uses RTTI and checks its answer.
Some checks failed
CI / ubuntu-latest-html-tests (push) Has been cancelled
CI / ubuntu-latest-no-tls (push) Has been cancelled
CI / ubuntu-latest-mbedtls2 (push) Has been cancelled
CI / ubuntu-latest-openssl-3 (push) Has been cancelled
CI / ubuntu-latest-with-old-std (push) Has been cancelled
CI / ubuntu-20-04-openssl-1-1 (push) Has been cancelled
CI / alpine-mbedtls-3_6_0 (push) Has been cancelled
CI / macOS-13-openssl-1-1 (push) Has been cancelled
CI / macOS-13-openssl-3 (push) Has been cancelled
CI / freebsd-14-openssl-3 (push) Has been cancelled
CI / windows-mbedtls (push) Has been cancelled

Next I'll just remove it, but this commit lets me
have something in history such that I can fall back to
check for bugs that might get introduced.
This commit is contained in:
2025-08-09 05:27:43 -04:00
parent c107600de6
commit 6ec7e50758
7 changed files with 28 additions and 14 deletions

View File

@ -131,7 +131,7 @@ bool OOFAwareWidget::isOOFContainer (Widget *widget, int oofmIndex)
switch (oofmIndex) {
case OOFM_FLOATS:
return widget->instanceOf (OOFAwareWidget::CLASS_ID) &&
return widget->instanceOf <OOFAwareWidget>() &&
(// For floats, only some OOF aware widgets are considered as
// containers.
((OOFAwareWidget*)widget)->isPossibleOOFContainer (OOFM_FLOATS) &&
@ -145,7 +145,7 @@ bool OOFAwareWidget::isOOFContainer (Widget *widget, int oofmIndex)
// is also a text block, so possible float container)
// within a table widget, which is not a suitable float
// container parent).
!(widget->getParent()->instanceOf (OOFAwareWidget::CLASS_ID) &&
!(widget->getParent()->instanceOf <OOFAwareWidget>() &&
((OOFAwareWidget*)widget->getParent())
->isPossibleOOFContainerParent (OOFM_FLOATS)) ||
// Inline blocks are containing blocks, too.
@ -163,7 +163,7 @@ bool OOFAwareWidget::isOOFContainer (Widget *widget, int oofmIndex)
case OOFM_RELATIVE:
case OOFM_ABSOLUTE:
return widget->instanceOf (OOFAwareWidget::CLASS_ID) &&
return widget->instanceOf <OOFAwareWidget>() &&
(widget->getParent() == NULL ||
OOFAwareWidget::testWidgetPositioned (widget));
@ -192,7 +192,7 @@ void OOFAwareWidget::notifySetParent ()
widget != NULL && oofContainer[oofmIndex] == NULL;
widget = widget->getParent ())
if (isOOFContainer (widget, oofmIndex)) {
assert (widget->instanceOf (OOFAwareWidget::CLASS_ID));
assert (widget->instanceOf <OOFAwareWidget>());
oofContainer[oofmIndex] = (OOFAwareWidget*)widget;
}

View File

@ -66,7 +66,7 @@ void OOFPosRelMgr::calcWidgetRefSize (Widget *widget, Requisition *size)
// (Notice also that Widget::sizeRequest has to be called in all
// cases.)
if (widget->instanceOf (OOFAwareWidget::CLASS_ID))
if (widget->instanceOf <OOFAwareWidget>())
*size = *((OOFAwareWidget*)widget)->getRequisitionWithoutOOF ();

View File

@ -607,7 +607,7 @@ AlignedTableCell *Table::getCellRef ()
int n = curCol + row * numCols;
if (childDefined (n)) {
child = children->get(n)->cell.widget;
if (child->instanceOf (AlignedTableCell::CLASS_ID))
if (child->instanceOf <AlignedTableCell>())
return (AlignedTableCell*)child;
}
}

View File

@ -2523,7 +2523,7 @@ 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::CLASS_ID)) {
if (widget->instanceOf <Textblock>()) {
for (int i = 0; i < NUM_OOFM; i++)
searchOutOfFlowMgr(i)->addWidgetInFlow ((Textblock*)widget, this,
words->size ());
@ -2765,7 +2765,7 @@ void Textblock::addParbreak (int space, core::style::Style *style)
consider normal flow, no floats etc.) */
for (Widget *widget = this;
widget->getParent() != NULL &&
widget->getParent()->instanceOf (Textblock::CLASS_ID) &&
widget->getParent()->instanceOf <Textblock>() &&
!isWidgetOOF (widget);
widget = widget->getParent ()) {
Textblock *textblock2 = (Textblock*)widget->getParent ();
@ -2959,7 +2959,7 @@ void Textblock::handOverBreak (core::style::Style *style)
Line *lastLine = lines->getRef (lines->size () - 1);
if (lastLine->breakSpace != 0 && (parent = getParent()) &&
parent->instanceOf (Textblock::CLASS_ID) &&
parent->instanceOf <Textblock>() &&
parent->getStyle()->display != core::style::DISPLAY_BLOCK) {
Textblock *textblock2 = (Textblock*) parent;
textblock2->addParbreak(lastLine->breakSpace, style);
@ -3193,7 +3193,7 @@ int Textblock::getGeneratorWidth ()
// We only examine instances of dw::Textblock, since they are relevant
// for floats, for which this method is only called.
if(word->content.type == core::Content::WIDGET_IN_FLOW &&
word->content.widget->instanceOf(Textblock::CLASS_ID)) {
word->content.widget->instanceOf<Textblock>()) {
Textblock *tbChild = (Textblock*)word->content.widget;
if(tbChild->findSizeRequestReference(this, &xRel, NULL))
wChild = max(wChild, xRel + tbChild->getGeneratorWidth());
@ -3291,7 +3291,7 @@ RegardingBorder *Textblock::getWidgetRegardingBorderForLine (int firstWord,
if (word->content.type == core::Content::WIDGET_IN_FLOW) {
Widget *widget = word->content.widget;
if (widget->instanceOf (RegardingBorder::CLASS_ID) &&
if (widget->instanceOf <RegardingBorder>() &&
// Exclude cases where a textblock constitutes a new floats
// container.
!isOOFContainer (widget, OOFM_FLOATS))