зеркало из https://github.com/mozilla/gecko-dev.git
Bug 472942 - Centering video and applying some basic styling to make viewing videos directly more pretty. r=roc ui-r=shorlander
This commit is contained in:
Родитель
caa0212d06
Коммит
daa998fda1
|
@ -133,6 +133,25 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
|
|||
element->SetAttr(kNameSpaceID_None, nsGkAtoms::style,
|
||||
NS_LITERAL_STRING("position:absolute; top:0; left:0; width:100%; height:100%"),
|
||||
PR_TRUE);
|
||||
} else {
|
||||
Element* head = GetHeadElement();
|
||||
if (!head) {
|
||||
NS_WARNING("no head on video document!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::style, nsnull,
|
||||
kNameSpaceID_XHTML,
|
||||
nsIDOMNode::ELEMENT_NODE);
|
||||
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsRefPtr<nsGenericHTMLElement> styleContent = NS_NewHTMLStyleElement(nodeInfo.forget());
|
||||
NS_ENSURE_TRUE(styleContent, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
styleContent->SetTextContent(
|
||||
NS_LITERAL_STRING("body { background: url(chrome://global/skin/icons/tabprompts-bgtexture.png) #333; height: 100%; width: 100%; margin: 0; padding: 0; } ") +
|
||||
NS_LITERAL_STRING("video { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; box-shadow: 0 0 15px #000; } ") +
|
||||
NS_LITERAL_STRING("video:focus { outline-width: 0; } "));
|
||||
head->AppendChildTo(styleContent, PR_FALSE);
|
||||
}
|
||||
|
||||
return body->AppendChildTo(element, PR_FALSE);
|
||||
|
|
Загрузка…
Ссылка в новой задаче