Bug 862117 - Move CSS rule classes relevant to image documents for cursor appearance (zoom in / zoom out) into layout/style/ImageDocument.css. r=roc, r=jaws

This stylesheet applies to all ImageDocuments, including those in frames. In old location for CSS rules, some full themes would not show cursors correctly, nor would ImageDocuments in frames. Image rotation CSS rule classes moved to layout/style/TopLevelImageDocument.css.
This commit is contained in:
Brandon Waterloo 2013-04-21 18:29:14 -04:00
parent 76dc64de91
commit 4ea4704e26
6 changed files with 42 additions and 63 deletions

View File

@ -377,10 +377,12 @@ ImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
target->AddEventListener(NS_LITERAL_STRING("resize"), this, false);
target->AddEventListener(NS_LITERAL_STRING("keypress"), this, false);
if (!nsContentUtils::IsChildOfSameType(this) &&
GetReadyStateEnum() != nsIDocument::READYSTATE_COMPLETE) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/media/TopLevelImageDocument.css"));
if (GetReadyStateEnum() != nsIDocument::READYSTATE_COMPLETE) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/ImageDocument.css"));
if (!nsContentUtils::IsChildOfSameType(this)) {
LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/media/TopLevelImageDocument.css"));
}
}
BecomeInteractive();
}
@ -810,29 +812,6 @@ ImageDocument::CreateSyntheticDocument()
nsresult rv = MediaDocument::CreateSyntheticDocument();
NS_ENSURE_SUCCESS(rv, rv);
// 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.
Element* head = GetHeadElement();
NS_ENSURE_TRUE(head, NS_ERROR_FAILURE);
nsCOMPtr<nsINodeInfo> nodeInfo;
if (nsContentUtils::IsChildOfSameType(this)) {
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::style, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
nsRefPtr<nsGenericHTMLElement> styleContent = NS_NewHTMLStyleElement(nodeInfo.forget());
NS_ENSURE_TRUE(styleContent, NS_ERROR_OUT_OF_MEMORY);
ErrorResult error;
styleContent->SetTextContent(NS_LITERAL_STRING("img { display: block; }"),
error);
head->AppendChildTo(styleContent, false);
}
// Add the image element
Element* body = GetBodyElement();
if (!body) {
@ -840,6 +819,7 @@ ImageDocument::CreateSyntheticDocument()
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::img, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);

View File

@ -0,0 +1,32 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* This CSS stylesheet defines the rules to be applied to any ImageDocuments,
* including those in frames.
*/
@media not print {
.overflowing {
cursor: -moz-zoom-out;
}
.shrinkToFit,
.scaleToDevicePixels {
cursor: -moz-zoom-in;
}
}
@media print {
/* 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

@ -87,6 +87,7 @@ LOCAL_INCLUDES += \
_FILES = \
contenteditable.css \
designmode.css \
ImageDocument.css \
TopLevelImageDocument.css \
TopLevelVideoDocument.css \
$(NULL)

View File

@ -22,16 +22,8 @@
bottom: 0;
left: 0;
}
}
@media print {
/* 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;
.completeRotation {
transition: transform 0.3s ease 0s;
}
}

View File

@ -14,17 +14,4 @@
background: hsl(0,0%,90%) url("chrome://global/skin/media/imagedoc-lightnoise.png");
color: #222;
}
.overflowing {
cursor: -moz-zoom-out;
}
.shrinkToFit,
.scaleToDevicePixels {
cursor: -moz-zoom-in;
}
.completeRotation {
transition: transform 0.3s ease 0s;
}
}

View File

@ -14,17 +14,4 @@
background: hsl(0,0%,90%) url("chrome://global/skin/media/imagedoc-lightnoise.png");
color: #222;
}
.overflowing {
cursor: -moz-zoom-out;
}
.shrinkToFit,
.scaleTodevicePixels {
cursor: -moz-zoom-in;
}
.completeRotation {
transition: transform 0.3s ease 0s;
}
}