BindingURI* BindingURI::copy() { BindingURI* newBinding = new BindingURI(m_uri); if (next()) { BindingURI* nextCopy = next()->copy(); newBinding->setNext(nextCopy); } return newBinding; }
void RenderStyle::addBindingURI(StringImpl* uri) { BindingURI* binding = new BindingURI(uri); if (!bindingURIs()) SET_VAR(rareNonInheritedData, bindingURI, binding) else for (BindingURI* b = bindingURIs(); b; b = b->next()) { if (!b->next()) b->setNext(binding); } }
bool XBLBindingManager::loadBindings(NodeImpl* node, BindingURI* bindingURIs, bool isStyleBinding, bool* resolveStyle) { if (resolveStyle) *resolveStyle = false; if (!node->isElementNode()) return true; bool dirty = false; XBLBindingChain* bindingChain = getBindingChain(node); if (bindingChain && isStyleBinding) { // Check to see if the binding is already installed. If so, then we don't need // to do anything. XBLBindingChain* styleBindingChain = bindingChain->firstStyleBindingChain(); if (styleBindingChain) { if (styleBindingChain->markedForDeath()) return false; // The old bindings haven't destroyed themselves/fired their destructors yet. // See if the URIs match. BindingURI* currURI = bindingURIs; XBLBindingChain* currBindingChain = styleBindingChain; for ( ; currURI && currBindingChain; currURI = currURI->next(), currBindingChain = currBindingChain->nextChain()) { if (currBindingChain->uri() != currURI->uri()) { styleBindingChain->markForDeath(); return false; } } if ((currURI && !currBindingChain) || (currBindingChain && !currURI)) { styleBindingChain->markForDeath(); return false; } return bindingChain->loaded(); } } bindingChain = getBindingChain(node); ElementImpl* elt = static_cast<ElementImpl*>(node); for (BindingURI* currURI = bindingURIs; currURI; currURI = currURI->next()) { XBLBindingChain* newBindingChain = new XBLBindingChain(elt, currURI->uri(), isStyleBinding); if (newBindingChain) { if (bindingChain && isStyleBinding) // Style bindings go on the end. Regular bindings go on the front. bindingChain->lastBindingChain()->insertBindingChain(newBindingChain); else { // Place on the front. newBindingChain->insertBindingChain(bindingChain); setBindingChain(node, newBindingChain); } dirty = true; } bindingChain = newBindingChain; } if (!bindingChain) return true; // We did nothing. // If the binding is completely loaded, then return true. Otherwise return false. bindingChain = getBindingChain(node); bool loaded = bindingChain->loaded(); if (loaded && resolveStyle) *resolveStyle = bindingChain->hasStylesheets(); return loaded; }