void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<RenderStyle> style, RenderArena* arena)
{
    // When adding these elements, create the renderer & style first before adding to the DOM.
    // Otherwise, the render tree will create some anonymous blocks that will mess up our layout.

    // Create the renderer with the specified style
    RenderObject* renderer = createRenderer(arena, style.get());
    if (renderer) {
        setRenderer(renderer);
        renderer->setStyle(style);
    }
    
    // Set these explicitly since this normally happens during an attach()
    setAttached();
    setInDocument();
    
    // For elements without a shadow parent, add the node to the DOM normally.
    if (!m_shadowParent) {
        // FIXME: This code seems very wrong.  Why are we magically adding |this| to the DOM here?
        //        We shouldn't be calling parser API methods outside of the parser!
        parent->deprecatedParserAddChild(this);
    }
 
    // Add the renderer to the render tree
    if (renderer)
        parent->renderer()->addChild(renderer);
}
Esempio n. 2
0
void PlaceholderDocument::createRenderTree()
{
    ASSERT(!attached());

    auto children = elementChildren(*this);
    for (auto child = children.begin(), end = children.end(); child != end; ++child)
        Style::attachRenderTree(*child);

    setAttached(true);
}
Esempio n. 3
0
void SVGShadowTreeRootElement::attachElement(PassRefPtr<RenderStyle> style, RenderArena* arena)
{
    ASSERT(shadowHost());

    // Create the renderer with the specified style
    RenderObject* renderer = createRenderer(arena, style.get());
    if (renderer) {
        setRenderer(renderer);
        renderer->setStyle(style);
    }

    // Set these explicitly since this normally happens during an attach()
    setAttached();

    // Add the renderer to the render tree
    if (renderer)
        shadowHost()->renderer()->addChild(renderer);
}
	Point LightRendererNode::getCalculatedPoint(Camera* cam, Layer* layer) {
		ScreenPoint p;
		if(m_instance != NULL) {
			if(m_layer == NULL) {
				m_layer = m_instance->getLocation().getLayer();
			}
			if(m_location != NULL) {
				p = cam->toScreenCoordinates(m_instance->getLocationRef().getMapCoordinates() + m_location.getMapCoordinates());
			} else {
				p = cam->toScreenCoordinates(m_instance->getLocation().getMapCoordinates());
			}
		} else if(m_location != NULL) {
			if(m_layer == NULL) {
				m_layer = m_location.getLayer();
			}
			p = cam->toScreenCoordinates(m_location.getMapCoordinates());
		} else if(m_layer == NULL) {
			const std::list<Layer*>& layers = cam->getRenderer("LightRenderer")->getActiveLayers();
			std::list<Layer*>::const_reverse_iterator layer_it = layers.rbegin();
			setAttached(*layer_it);
		}
		return Point(m_point.x + p.x, m_point.y + p.y);
	}
void TextControlInnerElement::attachInnerElement(Node* parent, PassRefPtr<RenderStyle> style, RenderArena* arena)
{
    // When adding these elements, create the renderer & style first before adding to the DOM.
    // Otherwise, the render tree will create some anonymous blocks that will mess up our layout.

    // Create the renderer with the specified style
    RenderObject* renderer = createRenderer(arena, style.get());
    if (renderer) {
        setRenderer(renderer);
        renderer->setStyle(style);
    }

    // Set these explicitly since this normally happens during an attach()
    setAttached();
    setInDocument(true);

    // For elements without a shadow parent, add the node to the DOM normally.
    if (!m_shadowParent)
        parent->addChild(this);

    // Add the renderer to the render tree
    if (renderer)
        parent->renderer()->addChild(renderer);
}