Bug 700856 - Move styles from {Media,Image,Video}Document to external stylesheets

This commit is contained in:
Jared Wein 2011-11-10 15:02:26 -08:00
parent 85b2808752
commit 5a3da30ed1
3 changed files with 33 additions and 19 deletions

View File

@ -134,23 +134,7 @@ VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
NS_LITERAL_STRING("position:absolute; top:0; left:0; width:100%; height:100%"),
true);
} else {
Element* head = GetHeadElement();
NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
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, false);
}
return body->AppendChildTo(element, false);
@ -174,9 +158,7 @@ nsresult
NS_NewVideoDocument(nsIDocument** aResult)
{
mozilla::dom::VideoDocument* doc = new mozilla::dom::VideoDocument();
if (!doc) {
return NS_ERROR_OUT_OF_MEMORY;
}
NS_ENSURE_TRUE(doc, NS_ERROR_OUT_OF_MEMORY);
NS_ADDREF(doc);
nsresult rv = doc->Init();

View File

@ -36,3 +36,13 @@
This CSS stylesheet defines the rules to be applied to ImageDocuments that
are top level (e.g. not iframes).
*/
/* We must declare the image as a block element. If we stay as
an inline element, our parent LineBox will be inline too and
ignore the available height during reflow.
This is bad during printing, it means tall image frames won't know
the size of the paper and cannot break into continuations along
multiple pages. */
img {
display: block;
}

View File

@ -36,3 +36,25 @@
This CSS stylesheet defines the rules to be applied to VideoDocuments that
are top level (e.g. not iframes).
*/
body {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYBAMAAACDuy0HAAAAG1BMVEX+/v4BAQH///8KCgoDAwN/f3/19fWAgID8/PzhDwT2AAAACXRSTlMFBQUFBQUFBQWHDtP9AAALwklEQVR4Xg3KOWOyWhAA0Bn2ci57eXEvQY1JCZp8sQTjVoJLTAkaE0swbj/7ve4UB37FLW4q86Lwwlh86J/ASAkpWaj+Krbb31HzH0Kjc2tIl7SADaWbpZBPE5dds6jJNyNdjAyKWqdroIixWRQIY6E/kOY7hIciL/ZfrAO3XP/06AuUJ3mSd/z95OB9vIal0DPlaZWHP7RE6DIXjmKqKkuGr+xNZylOnj1GSlUKvnxZDBOIzTfMe0fJgJ7c/GIIOdUuKxYyBFUOzvY6AC5AXx8R+o5O4S0j0wqBND3ErIYm/XHFbQjtH1MXD5dUbp19OFdjkDlys+HSwrBgHRvL9wVN/pi8ViOIwcv/D1GRW6UuDvJLLQA5lCI17iUdsKYpOuYfMATGnpn/Zs3W6gov51G+/Vs9Ay//we5kh8uwvEPum6o5HkDMDb3ZWunwtq+UzENU8NphDdbvNtKM3knx5gi6UMSQl+eGs+27mraDtxeWdH+T62Us/GylEtr7Ct8jlbeXKvAf5onx8D2uVt1J/GblV+XQyKUInOUG44fqjcszK266yHWAAYG9ekhvy4l4Maa44jYVyV2RFEuS54e2HcswtmNdqR/+V4P0O9e4XnpWgxVSQkNXpYMCxJ4Vel0lmi56jnYIIJAQMndF+zTEiyuj92r3ijJT1O0alPQnLWJvJLR7Xx7Xg9fm9QOqFu8o29m3QQqFwZN4bki/RoprNtMKKtEET9iMsJyKpkiguAorn2yzkv0wG3M1EEVDJP5VN7muLjYCglzdGQ7boYGgRmorzhRDq83gglgylC+hBLEy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333;
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
video {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
box-shadow: 0 0 15px #000;
}
video:focus {
outline-width: 0;
}