void SVGAnimatedTypeAnimator::calculateFromAndByValues(RefPtrWillBeMember<SVGPropertyBase>& from, RefPtrWillBeMember<SVGPropertyBase>& to, const String& fromString, const String& byString) { from = constructFromString(fromString); to = constructFromString(byString); // FIXME(oilpan): Below .get() should be removed after transition types are gone. to->add(from.get(), m_contextElement); }
void SetMediaKeysHandler::clearExistingMediaKeys() { WTF_LOG(Media, "SetMediaKeysHandler::clearExistingMediaKeys"); HTMLMediaElementEncryptedMedia& thisElement = HTMLMediaElementEncryptedMedia::from(*m_element); // 3.1 If mediaKeys is not null, it is already in use by another media // element, and the user agent is unable to use it with this element, // reject promise with a new DOMException whose name is // "QuotaExceededError". if (m_newMediaKeys) { if (!m_newMediaKeys->reserveForMediaElement(m_element.get())) { fail(QuotaExceededError, "The MediaKeys object is already in use by another media element."); return; } // Note that |m_newMediaKeys| is now considered reserved for // |m_element|, so it needs to be accepted or cancelled. m_madeReservation = true; } // 3.2 If the mediaKeys attribute is not null, run the following steps: if (thisElement.m_mediaKeys) { WebMediaPlayer* mediaPlayer = m_element->webMediaPlayer(); if (mediaPlayer) { // 3.2.1 If the user agent or CDM do not support removing the // association, return a promise rejected with a new // DOMException whose name is "NotSupportedError". // 3.2.2 If the association cannot currently be removed (i.e. // during playback), return a promise rejected with a new // DOMException whose name is "InvalidStateError". // 3.2.3 Stop using the CDM instance represented by the mediaKeys // attribute to decrypt media data and remove the association // with the media element. // (All 3 steps handled as needed in Chromium.) OwnPtr<SuccessCallback> successCallback = bind(&SetMediaKeysHandler::setNewMediaKeys, this); OwnPtr<FailureCallback> failureCallback = bind<ExceptionCode, const String&>(&SetMediaKeysHandler::clearFailed, this); ContentDecryptionModuleResult* result = new SetContentDecryptionModuleResult(successCallback.release(), failureCallback.release()); mediaPlayer->setContentDecryptionModule(nullptr, result->result()); // Don't do anything more until |result| is resolved (or rejected). return; } } // MediaKeys not currently set or no player connected, so continue on. setNewMediaKeys(); }
void PluginDocumentParser::createDocumentStructure() { // FIXME: Assert we have a loader to figure out why the original null checks // and assert were added for the security bug in http://trac.webkit.org/changeset/87566 ASSERT(document()); RELEASE_ASSERT(document()->loader()); LocalFrame* frame = document()->frame(); if (!frame) return; // FIXME: Why does this check settings? if (!frame->settings() || !frame->loader().allowPlugins(NotAboutToInstantiatePlugin)) return; RefPtrWillBeRawPtr<HTMLHtmlElement> rootElement = HTMLHtmlElement::create(*document()); rootElement->insertedByParser(); document()->appendChild(rootElement); frame->loader().dispatchDocumentElementAvailable(); RefPtrWillBeRawPtr<HTMLBodyElement> body = HTMLBodyElement::create(*document()); body->setAttribute(styleAttr, "background-color: rgb(38,38,38); height: 100%; width: 100%; overflow: hidden; margin: 0"); rootElement->appendChild(body); m_embedElement = HTMLEmbedElement::create(*document()); m_embedElement->setAttribute(widthAttr, "100%"); m_embedElement->setAttribute(heightAttr, "100%"); m_embedElement->setAttribute(nameAttr, "plugin"); m_embedElement->setAttribute(idAttr, "plugin"); m_embedElement->setAttribute(srcAttr, AtomicString(document()->url().string())); m_embedElement->setAttribute(typeAttr, document()->loader()->mimeType()); body->appendChild(m_embedElement); toPluginDocument(document())->setPluginNode(m_embedElement.get()); m_embedElement->focus(); document()->updateLayout(); // We need the plugin to load synchronously so we can get the PluginView // below so flush the layout tasks now instead of waiting on the timer. frame->view()->flushAnyPendingPostLayoutTasks(); if (PluginView* view = pluginView()) view->didReceiveResponse(document()->loader()->response()); }
void VTTTreeBuilder::constructTreeFromToken(Document& document) { // http://dev.w3.org/html5/webvtt/#webvtt-cue-text-dom-construction-rules switch (m_token.type()) { case VTTTokenTypes::Character: { m_currentNode->parserAppendChild(Text::create(document, m_token.characters())); break; } case VTTTokenTypes::StartTag: { VTTNodeType nodeType = tokenToNodeType(m_token); if (nodeType == VTTNodeTypeNone) break; VTTNodeType currentType = m_currentNode->isVTTElement() ? toVTTElement(m_currentNode.get())->webVTTNodeType() : VTTNodeTypeNone; // <rt> is only allowed if the current node is <ruby>. if (nodeType == VTTNodeTypeRubyText && currentType != VTTNodeTypeRuby) break; RefPtrWillBeRawPtr<VTTElement> child = VTTElement::create(nodeType, &document); if (!m_token.classes().isEmpty()) child->setAttribute(classAttr, m_token.classes()); if (nodeType == VTTNodeTypeVoice) { child->setAttribute(VTTElement::voiceAttributeName(), m_token.annotation()); } else if (nodeType == VTTNodeTypeLanguage) { m_languageStack.append(m_token.annotation()); child->setAttribute(VTTElement::langAttributeName(), m_languageStack.last()); } if (!m_languageStack.isEmpty()) child->setLanguage(m_languageStack.last()); m_currentNode->parserAppendChild(child); m_currentNode = child; break; } case VTTTokenTypes::EndTag: { VTTNodeType nodeType = tokenToNodeType(m_token); if (nodeType == VTTNodeTypeNone) break; // The only non-VTTElement would be the DocumentFragment root. (Text // nodes and PIs will never appear as m_currentNode.) if (!m_currentNode->isVTTElement()) break; VTTNodeType currentType = toVTTElement(m_currentNode.get())->webVTTNodeType(); bool matchesCurrent = nodeType == currentType; if (!matchesCurrent) { // </ruby> auto-closes <rt>. if (currentType == VTTNodeTypeRubyText && nodeType == VTTNodeTypeRuby) { if (m_currentNode->parentNode()) m_currentNode = m_currentNode->parentNode(); } else { break; } } if (nodeType == VTTNodeTypeLanguage) m_languageStack.removeLast(); if (m_currentNode->parentNode()) m_currentNode = m_currentNode->parentNode(); break; } case VTTTokenTypes::TimestampTag: { String charactersString = m_token.characters(); double parsedTimeStamp; if (VTTParser::collectTimeStamp(charactersString, parsedTimeStamp)) m_currentNode->parserAppendChild(ProcessingInstruction::create(document, "timestamp", charactersString)); break; } default: break; } }