int main(int argc, char** argv) { ros::init(argc, argv, "gl_wrapper_test"); ros::NodeHandle nh; try { RenderPtr render; render = RenderPtr(new Render(argc, argv)); render->start(display); } catch(FatalException& e) { ROS_ERROR_STREAM(e.what()); exit(1); } catch(Exception& e) { ROS_ERROR_STREAM(e.what()); exit(1); } catch(...) { ROS_ERROR_STREAM("Unknown exception was thrown."); exit(1); } return 0; }
void RenderMathMLToken::createWrapperIfNeeded() { if (!firstChild()) { RenderPtr<RenderMathMLBlock> wrapper = createAnonymousMathMLBlock(); RenderMathMLBlock::addChild(wrapper.leakPtr()); } }
void RenderMathMLFenced::makeFences() { RenderPtr<RenderMathMLOperator> openFence = createMathMLOperator(m_open, MathMLOperatorDictionary::Prefix, MathMLOperatorDictionary::Fence); RenderMathMLRow::addChild(openFence.leakPtr(), firstChild()); RenderPtr<RenderMathMLOperator> closeFence = createMathMLOperator(m_close, MathMLOperatorDictionary::Postfix, MathMLOperatorDictionary::Fence); m_closeFenceRenderer = closeFence.get(); RenderMathMLRow::addChild(closeFence.leakPtr()); }
RenderPtr<RenderElement> SVGMaskElement::createElementRenderer(Ref<RenderStyle>&& style) { RenderPtr<RenderElement> maskRenderer = createRenderer<RenderSVGResourceMasker>(*this, WTF::move(style)); // Pass along existing render layer clients. for (auto* clientLayer : m_clientLayers) static_cast<RenderSVGResourceMasker*>(maskRenderer.get())->addClientRenderLayer(clientLayer); return maskRenderer; }
RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(UChar uChar, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag) { auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX); newStyle.get().setFlexDirection(FlowColumn); newStyle.get().setMarginEnd(Length((flag == MathMLOperatorDictionary::Fence ? gFenceMarginEms : gSeparatorMarginEndEms) * style().fontSize(), Fixed)); if (flag == MathMLOperatorDictionary::Fence) newStyle.get().setMarginStart(Length(gFenceMarginEms * style().fontSize(), Fixed)); RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(element(), std::move(newStyle), uChar, form, flag); newOperator->initializeStyle(); return newOperator; }
void RenderMathMLFenced::addChild(RenderObject* child, RenderObject* beforeChild) { // make the fences if the render object is empty if (isEmpty()) updateFromElement(); // FIXME: Adding or removing a child should possibly cause all later separators to shift places if they're different, as later child positions change by +1 or -1. This should also handle surrogate pairs. See https://bugs.webkit.org/show_bug.cgi?id=125938. RenderPtr<RenderMathMLOperator> separatorRenderer; if (m_separators.get()) { unsigned int count = 0; for (Node* position = child->node(); position; position = position->previousSibling()) { if (position->isElementNode()) count++; } if (!beforeChild) { // We're adding at the end (before the closing fence), so a new separator would go before the new child, not after it. --count; } // |count| is now the number of element children that will be before our new separator, i.e. it's the 1-based index of the separator. if (count > 0) { UChar separator; // Use the last separator if we've run out of specified separators. if (count > m_separators.get()->length()) separator = (*m_separators.get())[m_separators.get()->length() - 1]; else separator = (*m_separators.get())[count - 1]; StringBuilder builder; builder.append(separator); separatorRenderer = createMathMLOperator(builder.toString(), MathMLOperatorDictionary::Infix, MathMLOperatorDictionary::Separator); } } if (beforeChild) { // Adding |x| before an existing |y| e.g. in element (y) - first insert our new child |x|, then its separator, to get (x, y). RenderMathMLRow::addChild(child, beforeChild); if (separatorRenderer) RenderMathMLRow::addChild(separatorRenderer.leakPtr(), beforeChild); } else { // Adding |y| at the end of an existing element e.g. (x) - insert the separator first before the closing fence, then |y|, to get (x, y). if (separatorRenderer) RenderMathMLRow::addChild(separatorRenderer.leakPtr(), m_closeFenceRenderer); RenderMathMLRow::addChild(child, m_closeFenceRenderer); } }
// FIXME: It's cleaner to only call updateFromElement when an attribute has changed. The body of // this method should probably be moved to a private stretchHeightChanged or checkStretchHeight // method. Probably at the same time, addChild/removeChild methods should be made to work for // dynamic DOM changes. void RenderMathMLOperator::updateFromElement() { RenderElement* savedRenderer = element().renderer(); // Destroy our current children destroyLeftoverChildren(); // Since we share a node with our children, destroying our children may set our node's // renderer to 0, so we need to restore it. element().setRenderer(savedRenderer); RenderPtr<RenderMathMLBlock> container = createRenderer<RenderMathMLBlock>(element(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX)); // This container doesn't offer any useful information to accessibility. container->setIgnoreInAccessibilityTree(true); container->initializeStyle(); RenderPtr<RenderText> text; if (m_operator) text = createRenderer<RenderText>(document(), String(&m_operator, 1)); else text = createRenderer<RenderText>(document(), element().textContent().replace(hyphenMinus, minusSign).impl()); container->addChild(text.leakPtr()); addChild(container.leakPtr()); updateStyle(); setNeedsLayoutAndPrefWidthsRecalc(); }
void RenderMathMLFraction::addChild(RenderObject* child, RenderObject* /* beforeChild */) { if (isEmpty()) { RenderPtr<RenderMathMLBlock> numeratorWrapper = createAnonymousMathMLBlock(); fixChildStyle(numeratorWrapper.get()); RenderMathMLBlock::addChild(numeratorWrapper.leakPtr()); RenderPtr<RenderMathMLBlock> denominatorWrapper = createAnonymousMathMLBlock(); fixChildStyle(denominatorWrapper.get()); RenderMathMLBlock::addChild(denominatorWrapper.leakPtr()); } if (firstChild()->isEmpty()) downcast<RenderElement>(*firstChild()).addChild(child); else downcast<RenderElement>(*lastChild()).addChild(child); updateFromElement(); }
RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(const String& operatorString, MathMLOperatorDictionary::Form form, MathMLOperatorDictionary::Flag flag) { RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX), operatorString, form, flag); newOperator->initializeStyle(); return newOperator; }
RenderPtr<RenderMathMLRow> RenderMathMLRow::createAnonymousWithParentRenderer(RenderMathMLRoot& parent) { RenderPtr<RenderMathMLRow> newMRow = createRenderer<RenderMathMLRow>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX)); newMRow->initializeStyle(); return newMRow; }
RenderPtr<RenderMathMLSquareRoot> RenderMathMLSquareRoot::createAnonymousWithParentRenderer(RenderMathMLMenclose& parent) { RenderPtr<RenderMathMLSquareRoot> squareRoot = createRenderer<RenderMathMLSquareRoot>(parent.document(), RenderStyle::createAnonymousStyleWithDisplay(&parent.style(), FLEX)); squareRoot->initializeStyle(); return squareRoot; }
RenderPtr<RenderMathMLBlock> RenderMathMLBlock::createAnonymousMathMLBlock() { RenderPtr<RenderMathMLBlock> newBlock = createRenderer<RenderMathMLBlock>(document(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX)); newBlock->initializeStyle(); return newBlock; }