Merge tracemonkey to mozilla-central.

This commit is contained in:
Robert Sayre 2010-04-21 08:34:13 -04:00
Родитель d8c102bd25 e306060136
Коммит 6e02b338e5
244 изменённых файлов: 5021 добавлений и 3444 удалений

Просмотреть файл

@ -605,18 +605,6 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
return NS_OK;
}
nsIAccessible *nsAccessible::NextChild(nsCOMPtr<nsIAccessible>& aAccessible)
{
nsCOMPtr<nsIAccessible> nextChild;
if (!aAccessible) {
GetFirstChild(getter_AddRefs(nextChild));
}
else {
aAccessible->GetNextSibling(getter_AddRefs(nextChild));
}
return (aAccessible = nextChild);
}
PRBool
nsAccessible::GetAllowsAnonChildAccessibles()
{
@ -931,8 +919,10 @@ nsAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY, PRBool aDeepestChild,
// where layout won't walk into things for us, such as image map areas and
// sub documents (XXX: subdocuments should be handled by methods of
// nsOuterDocAccessibles).
nsCOMPtr<nsIAccessible> child;
while (NextChild(child)) {
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *child = GetChildAt(childIdx);
PRInt32 childX, childY, childWidth, childHeight;
child->GetBounds(&childX, &childY, &childWidth, &childHeight);
if (aX >= childX && aX < childX + childWidth &&
@ -2994,7 +2984,7 @@ void
nsAccessible::TestChildCache(nsAccessible *aCachedChild)
{
#ifdef DEBUG
PRUint32 childCount = mChildren.Length();
PRInt32 childCount = mChildren.Length();
if (childCount == 0) {
NS_ASSERTION(!mAreChildrenInitialized, "No children but initialized!");
return;

Просмотреть файл

@ -350,10 +350,6 @@ protected:
// helper method to verify frames
static nsresult GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut);
static nsresult GetTranslatedString(const nsAString& aKey, nsAString& aStringOut);
// nsCOMPtr<>& is useful here, because getter_AddRefs() nulls the comptr's value, and NextChild
// depends on the passed-in comptr being null or already set to a child (finding the next sibling).
nsIAccessible *NextChild(nsCOMPtr<nsIAccessible>& aAccessible);
already_AddRefed<nsIAccessible> GetNextWithState(nsIAccessible *aStart, PRUint32 matchState);

Просмотреть файл

@ -322,23 +322,24 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
*aEndAcc = nsnull;
nsIntRect unionRect;
nsCOMPtr<nsIAccessible> accessible, lastAccessible;
nsAccessible *lastAccessible = nsnull;
gfxSkipChars skipChars;
gfxSkipCharsIterator iter;
// Loop through children and collect valid offsets, text and bounds
// depending on what we need for out parameters
while (NextChild(accessible)) {
lastAccessible = accessible;
nsRefPtr<nsAccessNode> accessNode = nsAccUtils::QueryAccessNode(accessible);
// depending on what we need for out parameters.
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
lastAccessible = childAcc;
nsIFrame *frame = accessNode->GetFrame();
nsIFrame *frame = childAcc->GetFrame();
if (!frame) {
continue;
}
nsIFrame *primaryFrame = frame;
if (nsAccUtils::IsText(accessible)) {
if (nsAccUtils::IsText(childAcc)) {
// We only need info up to rendered offset -- that is what we're
// converting to content offset
PRInt32 substringEndOffset = -1;
@ -357,7 +358,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
if (substringEndOffset < 0) {
// XXX for non-textframe text like list bullets,
// should go away after list bullet rewrite
substringEndOffset = nsAccUtils::TextLength(accessible);
substringEndOffset = nsAccUtils::TextLength(childAcc);
}
if (startOffset < substringEndOffset) {
// Our start is within this substring
@ -378,7 +379,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
if (aEndFrame) {
*aEndFrame = frame; // We ended in the current frame
if (aEndAcc)
NS_ADDREF(*aEndAcc = accessible);
NS_ADDREF(*aEndAcc = childAcc);
}
if (substringEndOffset > endOffset) {
// Need to stop before the end of the available text
@ -392,9 +393,8 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
*aText += '*'; // Show *'s only for password text
}
else {
nsRefPtr<nsAccessible> acc(nsAccUtils::QueryAccessible(accessible));
acc->AppendTextTo(*aText, startOffset,
substringEndOffset - startOffset);
childAcc->AppendTextTo(*aText, startOffset,
substringEndOffset - startOffset);
}
}
if (aBoundsRect) { // Caller wants the bounds of the text
@ -406,7 +406,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
startFrame = frame;
aStartOffset = startOffset;
if (aStartAcc)
NS_ADDREF(*aStartAcc = accessible);
NS_ADDREF(*aStartAcc = childAcc);
}
// We already started copying in this accessible's string,
// for the next accessible we'll start at offset 0
@ -448,7 +448,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
startFrame = frame;
aStartOffset = 0;
if (aStartAcc)
NS_ADDREF(*aStartAcc = accessible);
NS_ADDREF(*aStartAcc = childAcc);
}
}
-- endOffset;
@ -483,15 +483,17 @@ NS_IMETHODIMP nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndO
*/
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterCount(PRInt32 *aCharacterCount)
{
NS_ENSURE_ARG_POINTER(aCharacterCount);
*aCharacterCount = 0;
if (!mDOMNode) {
if (IsDefunct())
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIAccessible> accessible;
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
while (NextChild(accessible)) {
PRInt32 textLength = nsAccUtils::TextLength(accessible);
PRInt32 textLength = nsAccUtils::TextLength(childAcc);
NS_ENSURE_TRUE(textLength >= 0, nsnull);
*aCharacterCount += textLength;
}
@ -596,15 +598,19 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
}
descendantAccessible = GetFirstAvailableAccessible(findNode);
}
// From the descendant, go up and get the immediate child of this hypertext
nsCOMPtr<nsIAccessible> childAccessible;
while (descendantAccessible) {
nsCOMPtr<nsIAccessible> parentAccessible;
descendantAccessible->GetParent(getter_AddRefs(parentAccessible));
if (this == parentAccessible) {
childAccessible = descendantAccessible;
nsRefPtr<nsAccessible> childAccAtOffset;
nsRefPtr<nsAccessible> descendantAcc =
nsAccUtils::QueryObject<nsAccessible>(descendantAccessible);
while (descendantAcc) {
nsRefPtr<nsAccessible> parentAcc = descendantAcc->GetParent();
if (parentAcc == this) {
childAccAtOffset = descendantAcc;
break;
}
// This offset no longer applies because the passed-in text object is not a child
// of the hypertext. This happens when there are nested hypertexts, e.g.
// <div>abc<h1>def</h1>ghi</div>
@ -622,29 +628,40 @@ nsresult nsHyperTextAccessible::DOMPointToHypertextOffset(nsIDOMNode* aNode, PRI
// Make sure the offset lands on the embedded object character in order to indicate
// the true inner offset is inside the subtree for that link
addTextOffset =
(nsAccUtils::TextLength(descendantAccessible) == static_cast<PRInt32>(addTextOffset)) ? 1 : 0;
(nsAccUtils::TextLength(descendantAcc) == static_cast<PRInt32>(addTextOffset)) ? 1 : 0;
}
descendantAccessible = parentAccessible;
}
descendantAcc.swap(parentAcc);
}
// Loop through, adding offsets until we reach childAccessible
// If childAccessible is null we will end up adding up the entire length of
// the hypertext, which is good -- it just means our offset node
// came after the last accessible child's node
nsCOMPtr<nsIAccessible> accessible;
while (NextChild(accessible) && accessible != childAccessible) {
PRInt32 textLength = nsAccUtils::TextLength(accessible);
PRInt32 childCount = GetChildCount();
PRInt32 childIdx = 0;
nsAccessible *childAcc = nsnull;
for (; childIdx < childCount; childIdx++) {
childAcc = mChildren[childIdx];
if (childAcc == childAccAtOffset)
break;
PRInt32 textLength = nsAccUtils::TextLength(childAcc);
NS_ENSURE_TRUE(textLength >= 0, nsnull);
*aHyperTextOffset += textLength;
}
if (accessible) {
if (childIdx < childCount) {
*aHyperTextOffset += addTextOffset;
NS_ASSERTION(accessible == childAccessible, "These should be equal whenever we exit loop and accessible != nsnull");
NS_ASSERTION(childAcc == childAccAtOffset,
"These should be equal whenever we exit loop and childAcc != nsnull");
if (aFinalAccessible &&
(NextChild(accessible) ||
static_cast<PRInt32>(addTextOffset) < nsAccUtils::TextLength(childAccessible))) {
(childIdx < childCount - 1 ||
static_cast<PRInt32>(addTextOffset) < nsAccUtils::TextLength(childAccAtOffset))) {
// If not at end of last text node, we will return the accessible we were in
NS_ADDREF(*aFinalAccessible = childAccessible);
NS_ADDREF(*aFinalAccessible = childAccAtOffset);
}
}
@ -1277,13 +1294,12 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
// We have an point in an accessible child of this, now we need to add up the
// offsets before it to what we already have
nsCOMPtr<nsIAccessible> accessible;
PRInt32 offset = 0;
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
while (NextChild(accessible)) {
nsRefPtr<nsAccessNode> accessNode = nsAccUtils::QueryAccessNode(accessible);
nsIFrame *primaryFrame = accessNode->GetFrame();
nsIFrame *primaryFrame = childAcc->GetFrame();
NS_ENSURE_TRUE(primaryFrame, NS_ERROR_FAILURE);
nsIFrame *frame = primaryFrame;
@ -1311,7 +1327,7 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
}
frame = frame->GetNextContinuation();
}
PRInt32 textLength = nsAccUtils::TextLength(accessible);
PRInt32 textLength = nsAccUtils::TextLength(childAcc);
NS_ENSURE_TRUE(textLength >= 0, NS_ERROR_FAILURE);
offset += textLength;
}
@ -1325,14 +1341,13 @@ nsHyperTextAccessible::GetLinkCount(PRInt32 *aLinkCount)
{
NS_ENSURE_ARG_POINTER(aLinkCount);
*aLinkCount = 0;
if (!mDOMNode) {
if (IsDefunct())
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIAccessible> accessible;
while (NextChild(accessible)) {
if (nsAccUtils::IsEmbeddedObject(accessible))
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
if (nsAccUtils::IsEmbeddedObject(childAcc))
++*aLinkCount;
}
return NS_OK;
@ -1349,10 +1364,12 @@ nsHyperTextAccessible::GetLink(PRInt32 aLinkIndex, nsIAccessibleHyperLink **aLin
return NS_ERROR_FAILURE;
PRInt32 linkIndex = aLinkIndex;
nsCOMPtr<nsIAccessible> accessible;
while (NextChild(accessible)) {
if (nsAccUtils::IsEmbeddedObject(accessible) && linkIndex-- == 0)
return CallQueryInterface(accessible, aLink);
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
if (nsAccUtils::IsEmbeddedObject(childAcc) && linkIndex-- == 0)
return CallQueryInterface(childAcc, aLink);
}
return NS_ERROR_INVALID_ARG;
@ -1364,19 +1381,21 @@ nsHyperTextAccessible::GetLinkIndex(PRInt32 aCharIndex, PRInt32 *aLinkIndex)
NS_ENSURE_ARG_POINTER(aLinkIndex);
*aLinkIndex = -1; // API says this magic value means 'not found'
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 characterCount = 0;
PRInt32 linkIndex = 0;
if (!mDOMNode) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIAccessible> accessible;
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0;
childIdx < childCount && characterCount <= aCharIndex; childIdx++) {
nsAccessible *childAcc = mChildren[childIdx];
while (NextChild(accessible) && characterCount <= aCharIndex) {
PRUint32 role = nsAccUtils::Role(accessible);
PRUint32 role = nsAccUtils::Role(childAcc);
if (role == nsIAccessibleRole::ROLE_TEXT_LEAF ||
role == nsIAccessibleRole::ROLE_STATICTEXT) {
PRInt32 textLength = nsAccUtils::TextLength(accessible);
PRInt32 textLength = nsAccUtils::TextLength(childAcc);
NS_ENSURE_TRUE(textLength >= 0, NS_ERROR_FAILURE);
characterCount += textLength;
}

Просмотреть файл

@ -185,7 +185,7 @@ nsAccessibleWrap::FirePlatformEvent(nsAccEvent *aEvent)
return NS_OK;
nsCOMPtr<nsIAccessible> accessible;
nsresult rv = aEvent->GetAccessible(getter_AddRefs(accessible));
aEvent->GetAccessible(getter_AddRefs(accessible));
NS_ENSURE_STATE(accessible);
mozAccessible *nativeAcc = nil;
@ -227,35 +227,34 @@ nsAccessibleWrap::GetUnignoredChildCount(PRBool aDeepCount)
// if we're flat, we have no children.
if (nsAccUtils::MustPrune(this))
return 0;
PRInt32 childCount = 0;
GetChildCount(&childCount);
nsCOMPtr<nsIAccessible> curAcc;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>(curAcc.get());
PRInt32 resultChildCount = 0;
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessibleWrap *childAcc =
static_cast<nsAccessibleWrap*>(GetChildAt(childIdx));
// if the current child is not ignored, count it.
if (!childWrap->IsIgnored())
++childCount;
if (!childAcc->IsIgnored())
++resultChildCount;
// if it's flat, we don't care to inspect its children.
if (nsAccUtils::MustPrune(childWrap))
if (nsAccUtils::MustPrune(childAcc))
continue;
if (aDeepCount) {
// recursively count the unignored children of our children since it's a deep count.
childCount += childWrap->GetUnignoredChildCount(PR_TRUE);
resultChildCount += childAcc->GetUnignoredChildCount(PR_TRUE);
} else {
// no deep counting, but if the child is ignored, we want to substitute it for its
// children.
if (childWrap->IsIgnored())
childCount += childWrap->GetUnignoredChildCount(PR_FALSE);
if (childAcc->IsIgnored())
resultChildCount += childAcc->GetUnignoredChildCount(PR_FALSE);
}
}
return childCount;
return resultChildCount;
}
// if we for some reason have no native accessible, we should be skipped over (and traversed)
@ -269,19 +268,20 @@ nsAccessibleWrap::IsIgnored()
void
nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aChildrenArray)
{
nsCOMPtr<nsIAccessible> curAcc;
// we're flat; there are no children.
if (nsAccUtils::MustPrune(this))
return;
while (NextChild(curAcc)) {
nsAccessibleWrap *childWrap = static_cast<nsAccessibleWrap*>(curAcc.get());
if (childWrap->IsIgnored()) {
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessibleWrap *childAcc =
static_cast<nsAccessibleWrap*>(GetChildAt(childIdx));
if (childAcc->IsIgnored()) {
// element is ignored, so try adding its children as substitutes, if it has any.
if (!nsAccUtils::MustPrune(childWrap)) {
if (!nsAccUtils::MustPrune(childAcc)) {
nsTArray<nsRefPtr<nsAccessibleWrap> > children;
childWrap->GetUnignoredChildren(children);
childAcc->GetUnignoredChildren(children);
if (!children.IsEmpty()) {
// add the found unignored descendants to the array.
aChildrenArray.AppendElements(children);
@ -289,7 +289,7 @@ nsAccessibleWrap::GetUnignoredChildren(nsTArray<nsRefPtr<nsAccessibleWrap> > &aC
}
} else
// simply add the element, since it's not ignored.
aChildrenArray.AppendElement(childWrap);
aChildrenArray.AppendElement(childAcc);
}
}

Просмотреть файл

@ -492,20 +492,21 @@ nsXULGroupboxAccessible::GetRelationByType(PRUint32 aRelationType,
// The label for xul:groupbox is generated from xul:label that is
// inside the anonymous content of the xul:caption.
// The xul:label has an accessible object but the xul:caption does not
nsCOMPtr<nsIAccessible> testLabelAccessible;
while (NextChild(testLabelAccessible)) {
if (nsAccUtils::Role(testLabelAccessible) == nsIAccessibleRole::ROLE_LABEL) {
PRInt32 childCount = GetChildCount();
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
nsAccessible *childAcc = GetChildAt(childIdx);
if (nsAccUtils::Role(childAcc) == nsIAccessibleRole::ROLE_LABEL) {
// Ensure that it's our label
// XXX: we'll fail if group accessible expose more than one relation
// targets.
nsCOMPtr<nsIAccessible> testGroupboxAccessible =
nsRelUtils::GetRelatedAccessible(testLabelAccessible,
nsRelUtils::GetRelatedAccessible(childAcc,
nsIAccessibleRelation::RELATION_LABEL_FOR);
if (testGroupboxAccessible == this) {
// The <label> points back to this groupbox
return nsRelUtils::
AddTarget(aRelationType, aRelation, testLabelAccessible);
AddTarget(aRelationType, aRelation, childAcc);
}
}
}

Просмотреть файл

@ -113,31 +113,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=429659
testThis("nonLinkedImage", null, "moz.png", 89, 38);
// Test linked image
testThis("linkedImage", null, "moz.png", 93, 42);
testThis("linkedImage", null, "moz.png", 89, 38);
// Test non-linked image with alt attribute
testThis("nonLinkedImageWithAlt", "MoFo", "moz.png", 89, 38);
// Test linked image with alt attribute
testThis("linkedImageWithAlt", "MoFo link", "moz.png", 93, 42);
testThis("linkedImageWithAlt", "MoFo link", "moz.png", 89, 38);
// Test non-linked image with title attribute
testThis("nonLinkedImageWithTitle", "MoFo logo", "moz.png", 89, 38);
// Test linked image with title attribute
testThis("linkedImageWithTitle", "Link to MoFo", "moz.png", 93, 42);
testThis("linkedImageWithTitle", "Link to MoFo", "moz.png", 89, 38);
// Test simple image with empty alt attribute
testThis("nonLinkedImageEmptyAlt", "", "moz.png", 89, 38);
// Test linked image with empty alt attribute
testThis("linkedImageEmptyAlt", "", "moz.png", 93, 42);
testThis("linkedImageEmptyAlt", "", "moz.png", 89, 38);
// Test simple image with empty alt attribute and title
testThis("nonLinkedImageEmptyAltAndTitle", "MozillaFoundation", "moz.png", 89, 38);
// Test linked image with empty alt attribute and title
testThis("linkedImageEmptyAltAndTitle", "Link to Mozilla Foundation", "moz.png", 93, 42);
testThis("linkedImageEmptyAltAndTitle", "Link to Mozilla Foundation", "moz.png", 89, 38);
// Image with long desc
var actionNamesArray = new Array("showlongdesc");

Просмотреть файл

@ -1097,16 +1097,14 @@ function HandleAppCommandEvent(evt) {
function prepareForStartup() {
gBrowser.addEventListener("DOMUpdatePageReport", gPopupBlockerObserver.onUpdatePageReport, false);
// Note: we need to listen to untrusted events, because the pluginfinder XBL
// binding can't fire trusted ones (runs with page privileges).
gBrowser.addEventListener("PluginNotFound", gMissingPluginInstaller.newMissingPlugin, true, true);
gBrowser.addEventListener("PluginCrashed", gMissingPluginInstaller.pluginInstanceCrashed, true, true);
gBrowser.addEventListener("PluginBlocklisted", gMissingPluginInstaller.newMissingPlugin, true, true);
gBrowser.addEventListener("PluginOutdated", gMissingPluginInstaller.newMissingPlugin, true, true);
gBrowser.addEventListener("PluginDisabled", gMissingPluginInstaller.newDisabledPlugin, true, true);
gBrowser.addEventListener("NewPluginInstalled", gMissingPluginInstaller.refreshBrowser, false);
gBrowser.addEventListener("PluginNotFound", gPluginHandler, true);
gBrowser.addEventListener("PluginCrashed", gPluginHandler, true);
gBrowser.addEventListener("PluginBlocklisted", gPluginHandler, true);
gBrowser.addEventListener("PluginOutdated", gPluginHandler, true);
gBrowser.addEventListener("PluginDisabled", gPluginHandler, true);
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);
Services.obs.addObserver(gMissingPluginInstaller.pluginCrashed, "plugin-crashed", false);
Services.obs.addObserver(gPluginHandler.pluginCrashed, "plugin-crashed", false);
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
@ -1400,7 +1398,7 @@ function BrowserShutdown()
Services.obs.removeObserver(gSessionHistoryObserver, "browser:purge-session-history");
Services.obs.removeObserver(gXPInstallObserver, "xpinstall-install-blocked");
Services.obs.removeObserver(gMissingPluginInstaller.pluginCrashed, "plugin-crashed");
Services.obs.removeObserver(gPluginHandler.pluginCrashed, "plugin-crashed");
try {
gBrowser.removeProgressListener(window.XULBrowserWindow);
@ -5849,7 +5847,7 @@ function getPluginInfo(pluginElement)
return {mimetype: tagMimetype, pluginsPage: pluginsPage};
}
var gMissingPluginInstaller = {
var gPluginHandler = {
get CrashSubmit() {
delete this.CrashSubmit;
@ -5876,6 +5874,16 @@ var gMissingPluginInstaller = {
return newName;
},
isTooSmall : function (plugin, overlay) {
// Is the <object>'s size too small to hold what we want to show?
let pluginRect = plugin.getBoundingClientRect();
// XXX bug 446693. The text-shadow on the submitted-report text at
// the bottom causes scrollHeight to be larger than it should be.
let overflows = (overlay.scrollWidth > pluginRect.width) ||
(overlay.scrollHeight - 5 > pluginRect.height);
return overflows;
},
addLinkClickCallback: function (linkNode, callbackName /*callbackArgs...*/) {
// XXX just doing (callback)(arg) was giving a same-origin error. bug?
let self = this;
@ -5906,6 +5914,58 @@ var gMissingPluginInstaller = {
true);
},
handleEvent : function(event) {
let self = gPluginHandler;
let plugin = event.target;
// We're expecting the target to be a plugin.
if (!(plugin instanceof Ci.nsIObjectLoadingContent))
return;
switch (event.type) {
case "PluginCrashed":
self.pluginInstanceCrashed(plugin, event);
break;
case "PluginNotFound":
// For non-object plugin tags, register a click handler to install the
// plugin. Object tags can, and often do, deal with that themselves,
// so don't stomp on the page developers toes.
if (!(plugin instanceof HTMLObjectElement))
self.addLinkClickCallback(plugin, "installSinglePlugin");
/* FALLTHRU */
case "PluginBlocklisted":
case "PluginOutdated":
let hideBarPrefName = event.type == "PluginOutdated" ?
"plugins.hide_infobar_for_outdated_plugin" :
"plugins.hide_infobar_for_missing_plugin";
if (gPrefService.getBoolPref(hideBarPrefName))
return;
self.pluginUnavailable(plugin, event.type);
break;
case "PluginDisabled":
self.addLinkClickCallback(plugin, "managePlugins");
break;
}
},
newPluginInstalled : function(event) {
// browser elements are anonymous so we can't just use target.
var browser = event.originalTarget;
// clear the plugin list, now that at least one plugin has been installed
browser.missingPlugins = null;
var notificationBox = gBrowser.getNotificationBox(browser);
var notification = notificationBox.getNotificationWithValue("missing-plugins");
if (notification)
notificationBox.removeNotification(notification);
// reload the browser to make the new plugin show.
browser.reload();
},
// Callback for user clicking on a missing (unsupported) plugin.
installSinglePlugin: function (aEvent) {
var missingPluginsArray = {};
@ -5943,51 +6003,27 @@ var gMissingPluginInstaller = {
},
// event listener for missing/blocklisted/outdated plugins.
newMissingPlugin: function (aEvent) {
// Since we are expecting also untrusted events, make sure
// that the target is a plugin
if (!(aEvent.target instanceof Ci.nsIObjectLoadingContent))
return;
// For broken non-object plugin tags, register a click handler so
// that the user can click the plugin replacement to get the new
// plugin. Object tags can, and often do, deal with that themselves,
// so don't stomp on the page developers toes.
if (aEvent.type != "PluginBlocklisted" &&
aEvent.type != "PluginOutdated" &&
!(aEvent.target instanceof HTMLObjectElement)) {
gMissingPluginInstaller.addLinkClickCallback(aEvent.target, "installSinglePlugin");
}
let hideBarPrefName = aEvent.type == "PluginOutdated" ?
"plugins.hide_infobar_for_outdated_plugin" :
"plugins.hide_infobar_for_missing_plugin";
if (gPrefService.getBoolPref(hideBarPrefName))
return;
var browser = gBrowser.getBrowserForDocument(aEvent.target.ownerDocument
pluginUnavailable: function (plugin, eventType) {
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument
.defaultView.top.document);
if (!browser.missingPlugins)
browser.missingPlugins = {};
var pluginInfo = getPluginInfo(aEvent.target);
var pluginInfo = getPluginInfo(plugin);
browser.missingPlugins[pluginInfo.mimetype] = pluginInfo;
var notificationBox = gBrowser.getNotificationBox(browser);
// Should only display one of these warnings per page.
// In order of priority, they are: outdated > missing > blocklisted
let outdatedNotification = notificationBox.getNotificationWithValue("outdated-plugins");
let blockedNotification = notificationBox.getNotificationWithValue("blocked-plugins");
let missingNotification = notificationBox.getNotificationWithValue("missing-plugins");
// If there is already an outdated plugin notification then do nothing
if (notificationBox.getNotificationWithValue("outdated-plugins"))
if (outdatedNotification)
return;
var blockedNotification = notificationBox.getNotificationWithValue("blocked-plugins");
var missingNotification = notificationBox.getNotificationWithValue("missing-plugins");
var priority = notificationBox.PRIORITY_WARNING_MEDIUM;
function showBlocklistInfo() {
var url = formatURL("extensions.blocklist.detailsURL", true);
@ -6012,75 +6048,72 @@ var gMissingPluginInstaller = {
}
}
if (aEvent.type == "PluginBlocklisted") {
let notifications = {
PluginBlocklisted : {
barID : "blocked-plugins",
iconURL : "chrome://mozapps/skin/plugins/pluginBlocked-16.png",
message : gNavigatorBundle.getString("blockedpluginsMessage.title"),
buttons : [{
label : gNavigatorBundle.getString("blockedpluginsMessage.infoButton.label"),
accessKey : gNavigatorBundle.getString("blockedpluginsMessage.infoButton.accesskey"),
popup : null,
callback : showBlocklistInfo
},
{
label : gNavigatorBundle.getString("blockedpluginsMessage.searchButton.label"),
accessKey : gNavigatorBundle.getString("blockedpluginsMessage.searchButton.accesskey"),
popup : null,
callback : showOutdatedPluginsInfo
}],
},
PluginOutdated : {
barID : "outdated-plugins",
iconURL : "chrome://mozapps/skin/plugins/pluginOutdated-16.png",
message : gNavigatorBundle.getString("outdatedpluginsMessage.title"),
buttons : [{
label : gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.label"),
accessKey : gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.accesskey"),
popup : null,
callback : showOutdatedPluginsInfo
}],
},
PluginNotFound : {
barID : "missing-plugins",
iconURL : "chrome://mozapps/skin/plugins/pluginGeneric-16.png",
message : gNavigatorBundle.getString("missingpluginsMessage.title"),
buttons : [{
label : gNavigatorBundle.getString("missingpluginsMessage.button.label"),
accessKey : gNavigatorBundle.getString("missingpluginsMessage.button.accesskey"),
popup : null,
callback : showPluginsMissing
}],
}
};
if (eventType == "PluginBlocklisted") {
if (blockedNotification || missingNotification)
return;
let iconURL = "chrome://mozapps/skin/plugins/pluginBlocked-16.png";
let messageString = gNavigatorBundle.getString("blockedpluginsMessage.title");
let buttons = [{
label: gNavigatorBundle.getString("blockedpluginsMessage.infoButton.label"),
accessKey: gNavigatorBundle.getString("blockedpluginsMessage.infoButton.accesskey"),
popup: null,
callback: showBlocklistInfo
}, {
label: gNavigatorBundle.getString("blockedpluginsMessage.searchButton.label"),
accessKey: gNavigatorBundle.getString("blockedpluginsMessage.searchButton.accesskey"),
popup: null,
callback: showOutdatedPluginsInfo
}];
notificationBox.appendNotification(messageString, "blocked-plugins",
iconURL, priority, buttons);
}
else if (aEvent.type == "PluginOutdated") {
else if (eventType == "PluginOutdated") {
// Cancel any notification about blocklisting/missing plugins
if (blockedNotification)
blockedNotification.close();
if (missingNotification)
missingNotification.close();
let iconURL = "chrome://mozapps/skin/plugins/pluginOutdated-16.png";
let messageString = gNavigatorBundle.getString("outdatedpluginsMessage.title");
let buttons = [{
label: gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.label"),
accessKey: gNavigatorBundle.getString("outdatedpluginsMessage.updateButton.accesskey"),
popup: null,
callback: showOutdatedPluginsInfo
}];
notificationBox.appendNotification(messageString, "outdated-plugins",
iconURL, priority, buttons);
}
else if (aEvent.type == "PluginNotFound") {
else if (eventType == "PluginNotFound") {
if (missingNotification)
return;
// Cancel any notification about blocklisting plugins
if (blockedNotification)
blockedNotification.close();
let iconURL = "chrome://mozapps/skin/plugins/pluginGeneric-16.png";
let messageString = gNavigatorBundle.getString("missingpluginsMessage.title");
let buttons = [{
label: gNavigatorBundle.getString("missingpluginsMessage.button.label"),
accessKey: gNavigatorBundle.getString("missingpluginsMessage.button.accesskey"),
popup: null,
callback: showPluginsMissing
}];
notificationBox.appendNotification(messageString, "missing-plugins",
iconURL, priority, buttons);
}
},
newDisabledPlugin: function (aEvent) {
// Since we are expecting also untrusted events, make sure
// that the target is a plugin
if (!(aEvent.target instanceof Ci.nsIObjectLoadingContent))
return;
gMissingPluginInstaller.addLinkClickCallback(aEvent.target, "managePlugins");
let notify = notifications[eventType];
notificationBox.appendNotification(notify.message, notify.barID, notify.iconURL,
notificationBox.PRIORITY_WARNING_MEDIUM,
notify.buttons);
},
// Crashed-plugin observer. Notified once per plugin crash, before events
@ -6108,17 +6141,9 @@ var gMissingPluginInstaller = {
// Crashed-plugin event listener. Called for every instance of a
// plugin in content.
pluginInstanceCrashed: function (aEvent) {
let self = gMissingPluginInstaller;
// Evil content could fire a fake event at us, ignore them.
if (!aEvent.isTrusted)
return;
pluginInstanceCrashed: function (plugin, aEvent) {
// Ensure the plugin and event are of the right type.
let plugin = aEvent.target;
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent) ||
!(plugin instanceof Ci.nsIObjectLoadingContent))
if (!(aEvent instanceof Ci.nsIDOMDataContainerEvent))
return;
let submittedReport = aEvent.getData("submittedCrashReport");
@ -6130,7 +6155,7 @@ var gMissingPluginInstaller = {
let browserDumpID = aEvent.getData("browserDumpID");
// Remap the plugin name to a more user-presentable form.
pluginName = self.makeNicePluginName(pluginName, pluginFilename);
pluginName = this.makeNicePluginName(pluginName, pluginFilename);
// Force a style flush, so that we ensure our binding is attached.
plugin.clientTop;
@ -6164,7 +6189,7 @@ var gMissingPluginInstaller = {
// XXX can we make the link target actually be blank?
let pleaseLink = doc.getAnonymousElementByAttribute(
plugin, "class", "pleaseSubmitLink");
self.addLinkClickCallback(pleaseLink, "submitReport",
this.addLinkClickCallback(pleaseLink, "submitReport",
pluginDumpID, browserDumpID);
}
@ -6179,7 +6204,7 @@ var gMissingPluginInstaller = {
let bottomLinks = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgBottomLinks");
bottomLinks.style.display = "block";
let helpIcon = doc.getAnonymousElementByAttribute(plugin, "class", "helpIcon");
self.addLinkClickCallback(helpIcon, "openHelpPage");
this.addLinkClickCallback(helpIcon, "openHelpPage");
// If we're showing the link to manually trigger report submission, we'll
// want to be able to update all the instances of the UI for this crash to
@ -6220,17 +6245,12 @@ var gMissingPluginInstaller = {
let browser = gBrowser.getBrowserForDocument(doc.defaultView.top.document);
let link = doc.getAnonymousElementByAttribute(plugin, "class", "reloadLink");
self.addLinkClickCallback(link, "reloadPage", browser);
this.addLinkClickCallback(link, "reloadPage", browser);
let notificationBox = gBrowser.getNotificationBox(browser);
// Is the <object>'s size too small to hold what we want to show?
let pluginRect = plugin.getBoundingClientRect();
// XXX bug 446693. The text-shadow on the submitted-report text at
// the bottom causes scrollHeight to be larger than it should be.
let isObjectTooSmall = (overlay.scrollWidth > pluginRect.width) ||
(overlay.scrollHeight - 5 > pluginRect.height);
if (isObjectTooSmall) {
if (this.isTooSmall(plugin, overlay)) {
// Hide the overlay's contents. Use visibility style, so that it
// doesn't collapse down to 0x0.
overlay.style.visibility = "hidden";
@ -6277,7 +6297,7 @@ var gMissingPluginInstaller = {
label: submitLabel,
accessKey: submitKey,
popup: null,
callback: function() { gMissingPluginInstaller.submitReport(pluginDumpID, browserDumpID); },
callback: function() { gPluginHandler.submitReport(pluginDumpID, browserDumpID); },
};
if (pluginDumpID)
buttons.push(submitButton);
@ -6291,27 +6311,11 @@ var gMissingPluginInstaller = {
let link = notification.ownerDocument.createElementNS(XULNS, "label");
link.className = "text-link";
link.setAttribute("value", gNavigatorBundle.getString("crashedpluginsMessage.learnMore"));
link.href = gMissingPluginInstaller.crashReportHelpURL;
link.href = gPluginHandler.crashReportHelpURL;
let description = notification.ownerDocument.getAnonymousElementByAttribute(notification, "anonid", "messageText");
description.appendChild(link);
}
},
refreshBrowser: function (aEvent) {
// browser elements are anonymous so we can't just use target.
var browser = aEvent.originalTarget;
var notificationBox = gBrowser.getNotificationBox(browser);
var notification = notificationBox.getNotificationWithValue("missing-plugins");
// clear the plugin list, now that at least one plugin has been installed
browser.missingPlugins = null;
if (notification) {
// reset UI
notificationBox.removeNotification(notification);
}
// reload the browser to make the new plugin show.
browser.reload();
}
};

Просмотреть файл

@ -242,24 +242,31 @@ function test() {
// Clear Today
Sanitizer.prefs.setIntPref("timeSpan", 4);
s.sanitize();
ok(!bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should now be deleted");
// Be careful. If we add our objectss just before midnight, and sanitize
// runs immediately after, they won't be expired. This is expected, but
// we should not test in that case. We cannot just test for opposite
// condition because we could cross midnight just one moment after we
// cache our time, then we would have an even worse random failure.
var today = isToday(new Date(now_uSec/1000));
if (today) {
ok(!bhist.isVisited(makeURI("http://today.com")), "Pretend visit to today.com should now be deleted");
ok(!formhist.nameExists("today"), "today form entry should be deleted");
ok(!downloadExists(5555554), "'Today' download should now be deleted");
}
ok(bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should still exist");
ok(!formhist.nameExists("today"), "today form entry should be deleted");
ok(formhist.nameExists("b4today"), "b4today form entry should still exist");
ok(!downloadExists(5555554), "'Today' download should now be deleted");
ok(downloadExists(5555550), "Year old download should still be present");
// Choose everything
Sanitizer.prefs.setIntPref("timeSpan", 0);
s.sanitize();
ok(!bhist.isVisited(makeURI("http://before-today.com")), "Pretend visit to before-today.com should now be deleted");
ok(!formhist.nameExists("b4today"), "b4today form entry should be deleted");
ok(!downloadExists(5555550), "Year old download should now be deleted");
}
@ -595,3 +602,7 @@ function downloadExists(aID)
stmt.finalize();
return rows;
}
function isToday(aDate) {
return aDate.getDate() == new Date().getDate();
}

Просмотреть файл

@ -604,7 +604,8 @@
<parameter name="aParentPopup"/>
<parameter name="aBefore"/>
<body><![CDATA[
let element = PlacesUIUtils.createMenuItemForNode(aChild);
let element = PlacesUIUtils.createMenuItemForNode(aChild,
aParentPopup.ownerDocument);
if (aBefore)
aParentPopup.insertBefore(element, aBefore);
else {

Просмотреть файл

@ -809,7 +809,8 @@
<parameter name="aParentPopup"/>
<parameter name="aBefore"/>
<body><![CDATA[
var element = PlacesUIUtils.createMenuItemForNode(aChild);
var element = PlacesUIUtils.createMenuItemForNode(aChild,
aParentPopup.ownerDocument);
if (aBefore)
aParentPopup.insertBefore(element, aBefore);

Просмотреть файл

@ -950,12 +950,20 @@ var PlacesUIUtils = {
},
/**
* Helper for the toolbar and menu views
* Creates a menu item ready to be added to a popup.
* Helper for the toolbar and menu views.
* @param aNode
* Places node used as source for DOM node.
* @param aDocument
* The node will be created in this document.
* @return a DOM menuitem node.
*/
createMenuItemForNode:
function PUU_createMenuItemForNode(aNode) {
function PUU_createMenuItemForNode(aNode, aDocument) {
var element;
var document = this._getCurrentActiveWin().document;
// For add-ons backwards compatibility, if the caller does not provide
// a document, we guess one.
var document = aDocument || this._getTopBrowserWin().document;
var type = aNode.type;
if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
element = document.createElement("menuseparator");
@ -1384,7 +1392,7 @@ var PlacesUIUtils = {
if (lmStatus && !aPopup._lmStatusMenuItem) {
// Create the status menuitem and cache it in the popup object.
let document = this._getCurrentActiveWin().document;
let document = aPopup.ownerDocument;
aPopup._lmStatusMenuItem = document.createElement("menuitem");
aPopup._lmStatusMenuItem.setAttribute("lmStatus", lmStatus);
aPopup._lmStatusMenuItem.setAttribute("label", this.getString(lmStatus));

Просмотреть файл

@ -326,6 +326,7 @@
@BINPATH@/components/nsBadCertHandler.js
@BINPATH@/components/nsFormAutoComplete.js
@BINPATH@/components/contentSecurityPolicy.js
@BINPATH@/components/contentAreaDropListener.js
#ifdef XP_MACOSX
@BINPATH@/components/libalerts_s.dylib
#endif

Просмотреть файл

@ -49,23 +49,22 @@
background-color: white;
}
#TabsToolbar:not(:-moz-lwtheme) {
margin-bottom: 0;
-moz-box-shadow: ThreeDDarkShadow 0 -1px inset;
}
.tabbrowser-tab:not(:-moz-lwtheme),
.tabbrowser-arrowscrollbox > .scrollbutton-up:not(:-moz-lwtheme),
.tabbrowser-arrowscrollbox > .scrollbutton-down:not(:-moz-lwtheme),
.tabs-newtab-button:not(:-moz-lwtheme),
.tabs-alltabs-button:not(:-moz-lwtheme) {
background-color: rgba(255,255,255,.5);
.tabbrowser-arrowscrollbox > .tabs-newtab-button:not(:-moz-lwtheme) {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.4) 1px, rgba(255,255,255,.4));
text-shadow: 0 1px 0 rgba(255,255,255,.4);
}
.tabbrowser-tab:not(:-moz-lwtheme):not([selected="true"]):hover,
.tabbrowser-arrowscrollbox > .tabs-newtab-button:not(:-moz-lwtheme):hover {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.6) 1px, rgba(255,255,255,.6));
}
.tabbrowser-tab[selected="true"]:not(:-moz-lwtheme) {
background-color: white;
text-shadow: none;
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
white 1px, white);
}
#allTabs-panel,

Просмотреть файл

@ -941,8 +941,8 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
min-height: 0;
padding: 0;
border-style: none;
margin-bottom: 2px;
-moz-box-shadow: ThreeDShadow 0 -1px inset, -moz-dialog 0 2px;
background: -moz-linear-gradient(transparent, transparent 10%,
rgba(0,0,0,.03) 50%, rgba(0,0,0,.1) 90%, rgba(0,0,0,.2));
}
.tabbrowser-tabs:-moz-system-metric(touch-enabled) {
@ -955,65 +955,53 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
/* Tabs */
.tabbrowser-tab,
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.tabs-newtab-button,
.tabs-alltabs-button {
.tabbrowser-arrowscrollbox > .tabs-newtab-button {
-moz-appearance: none;
background: url("chrome://browser/skin/tabbrowser/tab-bkgnd.png") repeat-x;
margin: 3px 0 1px;
border: 2px solid;
border-right-width: 1px;
border-bottom: none;
-moz-border-top-colors: ThreeDShadow rgba(255,255,255,.3);
-moz-border-left-colors: ThreeDShadow rgba(255,255,255,.3);
}
.tabbrowser-tab:-moz-lwtheme-brighttext,
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-brighttext,
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-brighttext,
.tabs-newtab-button:-moz-lwtheme-brighttext,
.tabs-alltabs-button:-moz-lwtheme-brighttext {
background-color: rgba(0,0,0,.5);
}
.tabbrowser-tab:-moz-lwtheme-darktext,
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-lwtheme-darktext,
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-lwtheme-darktext,
.tabs-newtab-button:-moz-lwtheme-darktext,
.tabs-alltabs-button:-moz-lwtheme-darktext {
background-color: rgba(255,255,255,.5);
}
.tabbrowser-tab {
padding: 0 1px 1px 0;
-moz-border-radius-topleft: 2px;
-moz-border-radius-topright: 2px;
-moz-border-right-colors: rgba(0,0,0,.1);
background: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.15) 1px, rgba(255,255,255,.15));
background-position: -6px 0;
-moz-background-size: 200%;
margin: 0;
padding: 0;
-moz-border-image: url(tabbrowser/tab.png) 3 5 3 6 / 3px 5px 3px 6px;
-moz-border-radius: 6px 4px 0 0;
}
.tabbrowser-tab:hover,
.tabbrowser-tab[selected="true"] {
border-width: 1px;
-moz-border-radius-topleft: 4px;
-moz-border-radius-topright: 4px;
-moz-border-top-colors: ThreeDShadow;
-moz-border-right-colors: ThreeDShadow;
-moz-border-left-colors: ThreeDShadow;
.tabbrowser-arrowscrollbox > .tabs-newtab-button:hover {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.4) 1px, rgba(255,255,255,.4));
}
.tabbrowser-tab:not([selected="true"]):hover {
margin: 2px 0 1px;
padding: 2px 1px 1px;
background-image: url("chrome://browser/skin/tabbrowser/tab-hover-bkgnd.png");
.tabbrowser-tab:-moz-lwtheme-brighttext,
.tabbrowser-arrowscrollbox > .tabs-newtab-button:-moz-lwtheme-brighttext {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(40%,40%,40%,.6) 1px, rgba(40%,40%,40%,.6));
}
.tabbrowser-tab:-moz-lwtheme-brighttext:not([selected="true"]):hover,
.tabbrowser-arrowscrollbox > .tabs-newtab-button:-moz-lwtheme-brighttext:hover {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(60%,60%,60%,.6) 1px, rgba(60%,60%,60%,.6));
}
.tabbrowser-tab:-moz-lwtheme-darktext,
.tabbrowser-arrowscrollbox > .tabs-newtab-button:-moz-lwtheme-darktext {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.4) 1px, rgba(255,255,255,.4));
}
.tabbrowser-tab:-moz-lwtheme-darktext:not([selected="true"]):hover,
.tabbrowser-arrowscrollbox > .tabs-newtab-button:-moz-lwtheme-darktext:hover {
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.6) 1px, rgba(255,255,255,.6));
}
.tabbrowser-tab[selected="true"] {
margin: 2px 0 0;
padding: 1px;
background-image: url("chrome://browser/skin/tabbrowser/tab-active-bkgnd.png");
background-color: -moz-dialog;
font-weight: bold;
background-image: -moz-linear-gradient(left, transparent, transparent 1px,
rgba(255,255,255,.4) 1px, rgba(255,255,255,.4)),
-moz-linear-gradient(left, transparent, transparent 1px,
-moz-dialog 1px, -moz-dialog);
}
.tabbrowser-tab:-moz-lwtheme[selected="true"] {
@ -1057,8 +1045,6 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
}
.tab-icon-image {
margin-top: 1px;
-moz-margin-start: 7px;
-moz-margin-end: 3px;
width: 16px;
height: 16px;
@ -1081,15 +1067,9 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
}
/* Tab close button */
.tab-close-button > .toolbarbutton-icon {
-moz-margin-end: 0px !important;
margin-top: 1px;
}
.tab-close-button {
-moz-appearance: none;
-moz-image-region: rect(0px, 56px, 14px, 42px);
-moz-margin-end: 6px;
border: none;
padding: 0px;
list-style-image: url("chrome://global/skin/icons/close.png");
@ -1121,16 +1101,6 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
}
/* Tab scrollbox arrow, tabstrip new tab and all-tabs buttons */
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down,
.tabs-newtab-button,
.tabs-alltabs-button {
width: 18px;
padding: 0;
-moz-border-right-colors: ThreeDShadow;
-moz-image-region: rect(0, 11px, 14px, 0);
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-system-metric(touch-enabled),
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-system-metric(touch-enabled),
.tabs-alltabs-button:-moz-system-metric(touch-enabled) {
@ -1141,21 +1111,12 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
min-width: 1cm;
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled="true"]):hover,
.tabbrowser-arrowscrollbox > .scrollbutton-down:not([disabled="true"]):hover,
.tabs-newtab-button:hover,
.tabs-alltabs-button:hover {
border-top-width: 1px;
padding-top: 1px;
-moz-border-top-colors: ThreeDShadow;
-moz-border-right-colors: ThreeDShadow;
-moz-border-left-colors: ThreeDShadow transparent;
background-image: url("chrome://browser/skin/tabbrowser/tab-hover-bkgnd.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-up,
.tabbrowser-arrowscrollbox > .scrollbutton-down {
-moz-image-region: rect(0, 15px, 17px, 0);
margin: 0;
padding-top: 0;
padding-bottom: 0;
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:not([disabled="true"]):hover,
@ -1174,24 +1135,13 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(ltr) {
border-left-style: none;
-moz-border-radius-topright: 2px;
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-up:-moz-locale-dir(rtl) {
border-right-style: none;
-moz-border-radius-topleft: 2px;
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-right.png");
}
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-locale-dir(ltr),
.tabbrowser-tabs > .tabs-newtab-button:-moz-locale-dir(ltr),
.tabs-alltabs-button:-moz-locale-dir(ltr) {
border-right-style: none;
-moz-border-radius-topleft: 2px;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-right.png");
-moz-transition: 1s background-color ease-out;
@ -1202,30 +1152,21 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
-moz-transition: none;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-locale-dir(rtl),
.tabbrowser-tabs > .tabs-newtab-button:-moz-locale-dir(rtl),
.tabs-alltabs-button:-moz-locale-dir(rtl) {
border-left-style: none;
-moz-border-radius-topright: 2px;
}
.tabbrowser-arrowscrollbox > .scrollbutton-down:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/tabbrowser/tab-arrow-left.png");
}
.tabs-newtab-button {
list-style-image: url(chrome://browser/skin/tabbrowser/newtab.png);
-moz-image-region: rect(0, 18px, 18px, 0);
-moz-image-region: rect(0, 16px, 18px, 0);
}
.tabs-newtab-button:hover:active {
-moz-image-region: rect(0, 36px, 18px, 18px);
-moz-image-region: rect(0, 32px, 18px, 16px);
}
.tabbrowser-arrowscrollbox > .tabs-newtab-button {
width: 31px;
-moz-border-radius-topright: 2px;
-moz-border-radius-topleft: 2px;
}
.tabs-alltabs-button > .toolbarbutton-text {
@ -1234,16 +1175,16 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
.tabs-alltabs-button > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/tabbrowser/alltabs.png");
-moz-image-region: rect(0, 14px, 20px, 0);
-moz-image-region: rect(0, 14px, 17px, 0);
}
.tabs-alltabs-button:hover:active > .toolbarbutton-icon {
-moz-image-region: rect(0, 28px, 20px, 14px);
-moz-image-region: rect(0, 28px, 17px, 14px);
}
.tabs-alltabs-button[type="menu"] > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/mainwindow-dropdown-arrow.png");
margin: 5px 0 4px;
margin: 3px 0;
-moz-image-region: rect(0, 13px, 11px, 0);
}
@ -1295,25 +1236,12 @@ richlistitem[type="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-i
}
.tabbrowser-tabs > .tabs-closebutton {
margin: 3px 0px 3px;
margin: 0;
padding: 4px 2px 2px;
background: -moz-dialog url("chrome://browser/skin/tabbrowser/tab-active-bkgnd.png") repeat-x;
border-left: 1px solid threedshadow;
border-top: 1px solid threedshadow;
-moz-border-radius-topleft: 2px;
}
.tabbrowser-tabs > .tabs-closebutton:-moz-locale-dir(rtl) {
border-left: none;
border-right: 1px solid threedshadow;
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 2px;
}
#sidebar-box .tabs-closebutton {
#sidebar-header > .tabs-closebutton {
list-style-image: url("chrome://global/skin/icons/closeSidebar.png");
margin-bottom: 0px !important;
padding: 0px 2px 0px 2px !important;
}
toolbarbutton.chevron {

Просмотреть файл

@ -79,12 +79,10 @@ browser.jar:
skin/classic/browser/tabbrowser/newtab.png (tabbrowser/newtab.png)
skin/classic/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/browser/tabbrowser/tab.png (tabbrowser/tab.png)
skin/classic/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left.png)
skin/classic/browser/tabbrowser/tab-arrow-right.png (tabbrowser/tab-arrow-right.png)
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png)
skin/classic/browser/tabbrowser/tab-bkgnd.png (tabbrowser/tab-bkgnd.png)
skin/classic/browser/tabbrowser/tab-active-bkgnd.png (tabbrowser/tab-active-bkgnd.png)
skin/classic/browser/tabbrowser/tab-hover-bkgnd.png (tabbrowser/tab-hover-bkgnd.png)
#ifdef XP_WIN
browser.jar:
@ -167,10 +165,8 @@ browser.jar:
skin/classic/aero/browser/tabbrowser/newtab.png (tabbrowser/newtab-aero.png)
skin/classic/aero/browser/tabbrowser/progress.png (tabbrowser/progress.png)
skin/classic/aero/browser/tabbrowser/progress-pulsing.png (tabbrowser/progress-pulsing.png)
skin/classic/aero/browser/tabbrowser/tab.png (tabbrowser/tab.png)
skin/classic/aero/browser/tabbrowser/tab-arrow-left.png (tabbrowser/tab-arrow-left-aero.png)
skin/classic/aero/browser/tabbrowser/tab-arrow-right.png (tabbrowser/tab-arrow-right-aero.png)
skin/classic/aero/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator-aero.png)
skin/classic/aero/browser/tabbrowser/tab-bkgnd.png (tabbrowser/tab-bkgnd.png)
skin/classic/aero/browser/tabbrowser/tab-active-bkgnd.png (tabbrowser/tab-active-bkgnd.png)
skin/classic/aero/browser/tabbrowser/tab-hover-bkgnd.png (tabbrowser/tab-hover-bkgnd.png)
#endif

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 731 B

После

Ширина:  |  Высота:  |  Размер: 726 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 719 B

После

Ширина:  |  Высота:  |  Размер: 715 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 687 B

После

Ширина:  |  Высота:  |  Размер: 692 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 687 B

После

Ширина:  |  Высота:  |  Размер: 700 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 188 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 189 B

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 892 B

Двоичные данные
browser/themes/winstripe/browser/tabbrowser/tab.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 681 B

Просмотреть файл

@ -198,4 +198,6 @@ ifeq ($(OS_ARCH),Linux)
libs:: $(topsrcdir)/tools/rb/fix-linux-stack.pl
$(INSTALL) $< $(DIST)/bin
endif
GARBAGE += automationutils.pyc
endif # ENABLE_TESTS

Просмотреть файл

@ -78,4 +78,4 @@ automation.py: $(MOZILLA_DIR)/build/automation.py.in $(MOZILLA_DIR)/build/automa
$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py \
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
GARBAGE += automation.py
GARBAGE += automation.py automation.pyc

Просмотреть файл

@ -131,6 +131,7 @@ export::
-DMOZ_NATIVE_ZLIB=$(MOZ_NATIVE_ZLIB) \
-DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \
-DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \
-DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \
$(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers
$(INSTALL) system_wrappers $(DIST)

Просмотреть файл

@ -210,7 +210,6 @@ MOZ_RDF = @MOZ_RDF@
NECKO_PROTOCOLS = @NECKO_PROTOCOLS@
NECKO_DISK_CACHE = @NECKO_DISK_CACHE@
NECKO_SMALL_BUFFERS = @NECKO_SMALL_BUFFERS@
NECKO_COOKIES = @NECKO_COOKIES@
NECKO_WIFI = @NECKO_WIFI@
MOZ_AUTH_EXTENSION = @MOZ_AUTH_EXTENSION@
@ -219,6 +218,10 @@ MOZ_NATIVE_HUNSPELL = @SYSTEM_HUNSPELL@
MOZ_HUNSPELL_LIBS = @MOZ_HUNSPELL_LIBS@
MOZ_HUNSPELL_CFLAGS = @MOZ_HUNSPELL_CFLAGS@
MOZ_NATIVE_LIBEVENT = @MOZ_NATIVE_LIBEVENT@
MOZ_LIBEVENT_LIBS = @MOZ_LIBEVENT_LIBS@
MOZ_LIBEVENT_INCLUDES = @MOZ_LIBEVENT_INCLUDES@
MOZ_NATIVE_ZLIB = @SYSTEM_ZLIB@
MOZ_NATIVE_BZ2 = @SYSTEM_BZ2@
MOZ_NATIVE_JPEG = @SYSTEM_JPEG@

Просмотреть файл

@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CXXFLAGS = $(STL_FLAGS) $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)

Просмотреть файл

@ -45,13 +45,23 @@
# error "STL code can only be used with -fno-exceptions"
#endif
// Silence "warning: #include_next is a GCC extension"
#pragma GCC system_header
// mozalloc.h wants <new>; break the cycle by always explicitly
// including <new> here. NB: this is a tad sneaky. Sez the gcc docs:
//
// `#include_next' does not distinguish between <file> and "file"
// inclusion, nor does it check that the file you specify has the
// same name as the current file. It simply looks for the file
// named, starting with the directory in the search path after the
// one where the current file was found.
#include_next <new>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include <new> // to give mozalloc std::bad_alloc
# include <stdlib.h> // to give mozalloc malloc/free decls
# include <string.h>
# include "mozilla/mozalloc.h"
#else
# error "STL code can only be used with infallible ::operator new()"
@ -78,8 +88,8 @@
// these __throw_*() functions will always throw exceptions (shades of
// -fshort-wchar). We don't want that and so define our own inlined
// __throw_*().
#ifndef mozilla_functexcept_h
# include "mozilla/functexcept.h"
#ifndef mozilla_throw_gcc_h
# include "mozilla/throw_gcc.h"
#endif
#endif // if mozilla_${HEADER}_h

Просмотреть файл

@ -62,7 +62,8 @@ def main(outdir, compiler, template_file, header_list_file):
os.mkdir(outdir)
template = open(template_file, 'r').read()
path_to_new = header_path('new', compiler)
for header in open(header_list_file, 'r'):
header = header.rstrip()
if 0 == len(header) or is_comment(header):
@ -72,7 +73,8 @@ def main(outdir, compiler, template_file, header_list_file):
try:
f = open(os.path.join(outdir, header), 'w')
f.write(string.Template(template).substitute(HEADER=header,
HEADER_PATH=path))
HEADER_PATH=path,
NEW_HEADER_PATH=path_to_new))
finally:
f.close()

Просмотреть файл

@ -45,13 +45,22 @@
# error "STL code can only be used with -fno-exceptions"
#endif
// Code built with !_HAS_EXCEPTIONS calls std::_Throw(), but the win2k
// CRT doesn't export std::_Throw(). So we define it.
#ifndef mozilla_Throw_h
# include "mozilla/throw_msvc.h"
#endif
// Code might include <new> before other wrapped headers, but <new>
// includes <exception> and so we want to wrap it. But mozalloc.h
// wants <new> also, so we break the cycle by always explicitly
// including <new> here.
#include <${NEW_HEADER_PATH}>
// See if we're in code that can use mozalloc. NB: this duplicates
// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
// can't build with that being included before base/basictypes.h.
#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
# include <new> // to give mozalloc std::bad_alloc
# include <stdlib.h> // to give mozalloc malloc/free decls
# include <string.h>
# include "mozilla/mozalloc.h"
#else
# error "STL code can only be used with infallible ::operator new()"

Просмотреть файл

@ -606,15 +606,6 @@ endif
endif
endif
ifeq ($(OS_ARCH),Linux)
ifneq (,$(filter mips mipsel,$(OS_TEST)))
ifeq ($(MODULE),layout)
OS_CFLAGS += -Wa,-xgot
OS_CXXFLAGS += -Wa,-xgot
endif
endif
endif
#
# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
# which uses internal symbols first
@ -664,6 +655,14 @@ EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
endif
endif
#
# GNU doesn't have path length limitation
#
ifeq ($(OS_ARCH),GNU)
OS_CPPFLAGS += -DPATH_MAX=1024 -DMAXPATHLEN=1024
endif
#
# MINGW32
#

Просмотреть файл

@ -12,8 +12,17 @@
# safety of <foo> for gcc and MSVC".
#
new
# FIXME: these headers haven't been reviewed yet, but we use them
# unsafely in modules/libpr0n, so we might as well prevent it from
# unsafely in Gecko, so we might as well prevent them from
# throwing exceptions
algorithm
deque
iostream
list
map
memory
stack
string
vector

Просмотреть файл

@ -1024,3 +1024,6 @@ conic/conicconnection.h
conic/conicconnectionevent.h
conic/conicstatisticsevent.h
#endif
#if MOZ_NATIVE_LIBEVENT==1
event.h
#endif

Просмотреть файл

@ -760,8 +760,43 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
WRAP_STL_INCLUDES=1
AC_CACHE_CHECK(for std::_Throw, ac_cv_have_std__Throw,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
AC_TRY_COMPILE([#include <exception>],
[std::_Throw(std::exception()); return 0;],
ac_cv_have_std__Throw="yes",
ac_cv_have_std__Throw="no")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_have_std__Throw" = "no"; then
AC_MSG_ERROR([Your MSVC/SDK doesn't export std::_Throw. This breaks assumptions in Gecko. Please file a bug describing this error along with your build configuration.])
fi
AC_CACHE_CHECK(for |class __declspec(dllimport) exception| bug,
ac_cv_have_dllimport_exception_bug,
[
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
_SAVE_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="${CXXFLAGS} -D_HAS_EXCEPTIONS=0"
AC_TRY_LINK([#include <vector>],
[std::vector<int> v; return v.at(1);],
ac_cv_have_dllimport_exception_bug="no",
ac_cv_have_dllimport_exception_bug="yes")
CXXFLAGS="$_SAVE_CXXFLAGS"
AC_LANG_RESTORE
])
if test "$ac_cv_have_dllimport_exception_bug" = "no"; then
STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
WRAP_STL_INCLUDES=1
fi
;;
esac
@ -1094,6 +1129,7 @@ if test -n "$CROSS_COMPILE"; then
case "${target_os}" in
linux*) OS_ARCH=Linux OS_TARGET=Linux ;;
kfreebsd*-gnu) OS_ARCH=GNU_kFreeBSD OS_TARGET=GNU_kFreeBSD ;;
gnu*) OS_ARCH=GNU ;;
solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;;
mingw*) OS_ARCH=WINNT ;;
wince*) OS_ARCH=WINCE ;;
@ -1390,9 +1426,7 @@ x86_64 | ia64)
;;
arm)
if test "$OS_TARGET" = "WINCE"; then
CPU_ARCH="$OS_TEST"
fi
CPU_ARCH=arm
;;
esac
@ -1434,8 +1468,8 @@ if test "$GNU_CC"; then
if test -z "$INTEL_CC"; then
# Don't use -Wcast-align with ICC
case "$CPU_ARCH" in
# And don't use it on hppa, ia64, sparc, since it's noisy there
hppa | ia64 | sparc)
# And don't use it on hppa, ia64, sparc, arm, since it's noisy there
hppa | ia64 | sparc | arm)
;;
*)
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
@ -1497,8 +1531,8 @@ if test "$GNU_CXX"; then
if test -z "$INTEL_CC"; then
# Don't use -Wcast-align with ICC
case "$CPU_ARCH" in
# And don't use it on hppa, ia64, sparc, since it's noisy there
hppa | ia64 | sparc)
# And don't use it on hppa, ia64, sparc, arm, since it's noisy there
hppa | ia64 | sparc | arm)
;;
*)
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
@ -1738,7 +1772,7 @@ case "$host" in
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
;;
*-linux*|*-kfreebsd*-gnu)
*-linux*|*-kfreebsd*-gnu|*-gnu*)
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
HOST_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
@ -2767,7 +2801,7 @@ dnl ========================================================
dnl = Flags to strip unused symbols from .so components
dnl ========================================================
case "$target" in
*-linux*|*-kfreebsd*-gnu)
*-linux*|*-kfreebsd*-gnu|*-gnu*)
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS='-Wl,--version-script -Wl,$(BUILD_TOOLS)/gnu-ld-scripts/components-version-script'
;;
*-solaris*)
@ -3550,7 +3584,7 @@ then
fi
;;
*-*-linux*|*-*-kfreebsd*-gnu)
*-*-linux*|*-*-kfreebsd*-gnu|*-*-gnu*)
AC_DEFINE(_REENTRANT)
;;
@ -3947,8 +3981,30 @@ dnl Put your C++ language/feature checks below
dnl ========================================================
AC_LANG_CPLUSPLUS
ARM_ABI_PREFIX=
HAVE_GCC3_ABI=
if test "$GNU_CC"; then
if test "$CPU_ARCH" = "arm" ; then
AC_CACHE_CHECK(for ARM EABI,
ac_cv_gcc_arm_eabi,
[AC_TRY_COMPILE([],
[
#if defined(__ARM_EABI__)
return 0;
#else
#error Not ARM EABI.
#endif
],
ac_cv_gcc_arm_eabi="yes",
ac_cv_gcc_arm_eabi="no")])
if test "$ac_cv_gcc_arm_eabi" = "yes"; then
HAVE_ARM_EABI=1
ARM_ABI_PREFIX=eabi-
else
ARM_ABI_PREFIX=oabi-
fi
fi
AC_CACHE_CHECK(for gcc 3.0 ABI,
ac_cv_gcc_three_abi,
[AC_TRY_COMPILE([],
@ -3962,10 +4018,10 @@ if test "$GNU_CC"; then
ac_cv_gcc_three_abi="yes",
ac_cv_gcc_three_abi="no")])
if test "$ac_cv_gcc_three_abi" = "yes"; then
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
HAVE_GCC3_ABI=1
else
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
fi
fi
AC_SUBST(HAVE_GCC3_ABI)
@ -4268,7 +4324,16 @@ AC_CACHE_CHECK(for __thread keyword for TLS variables,
ac_cv_thread_keyword=no)])
LDFLAGS=$_SAVE_LDFLAGS
if test "$ac_cv_thread_keyword" = yes; then
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
# mips builds fail with TLS variables because of a binutils bug.
# See bug 528687
case "${target_cpu}" in
mips*)
:
;;
*)
AC_DEFINE(HAVE_THREAD_TLS_KEYWORD)
;;
esac
fi
dnl Check for the existence of various allocation headers/functions
@ -4469,6 +4534,43 @@ else
fi
fi
dnl system libevent Support
dnl ========================================================
MOZ_ARG_WITH_STRING(system-libevent,
[ --with-system-libevent=[PFX]
Use system libevent [installed at prefix PFX]],
LIBEVENT_DIR=$withval)
_SAVE_CFLAGS=$CFLAGS
_SAVE_LDFLAGS=$LDFLAGS
_SAVE_LIBS=$LIBS
if test -z "$LIBEVENT_DIR" -o "$LIBEVENT_DIR" = no; then
MOZ_NATIVE_LIBEVENT=
else
if test "${LIBEVENT_DIR}" = "yes"; then
LIBEVENT_DIR=/usr
fi
CFLAGS="-I${LIBEVENT_DIR}/include $CFLAGS"
LDFLAGS="-L${LIBEVENT_DIR}/lib $LDFLAGS"
AC_CHECK_HEADER(event.h,
[if test ! -f "${LIBEVENT_DIR}/include/event.h"; then
AC_MSG_ERROR([event.h found, but is not in ${LIBEVENT_DIR}/include])
fi],
AC_MSG_ERROR([--with-system-libevent requested but event.h not found]))
AC_CHECK_LIB(event, event_init,
[MOZ_NATIVE_LIBEVENT=1
MOZ_LIBEVENT_INCLUDES="${LIBEVENT_DIR}/include"
MOZ_LIBEVENT_LIBS="-L${LIBEVENT_DIR}/lib -levent"],
[MOZ_NATIVE_LIBEVENT= MOZ_LIBEVENT_INCLUDES= MOZ_LIBEVENT_LIBS=])
fi
CFLAGS=$_SAVE_CFLAGS
LDFLAGS=$_SAVE_LDFLAGS
LIBS=$_SAVE_LIBS
AC_SUBST(MOZ_NATIVE_LIBEVENT)
AC_SUBST(MOZ_LIBEVENT_INCLUDES)
AC_SUBST(MOZ_LIBEVENT_LIBS)
dnl ========================================================
dnl = If NSS was not detected in the system,
dnl = use the one in the source tree (mozilla/security/nss)
@ -4769,7 +4871,6 @@ NECKO_WIFI=1
NECKO_COOKIES=1
NECKO_DISK_CACHE=1
NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
NECKO_SMALL_BUFFERS=
BUILD_CTYPES=1
XPC_IDISPATCH_SUPPORT=
@ -7135,6 +7236,19 @@ if test -n "$MOZ_TIMELINE"; then
AC_DEFINE(MOZ_TIMELINE)
fi
dnl ========================================================
dnl = Enable NS_FUNCTION_TIMER, which provides Function
dnl = timing for identifying code bottlenecks
dnl = NS_FUNCTION_TIMER is off by default.
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(functiontimer,
[ --enable-functiontimer Enable NS_FUNCTION_TIMER ],
NS_FUNCTION_TIMER=1,
NS_FUNCTION_TIMER= )
if test -n "$NS_FUNCTION_TIMER"; then
AC_DEFINE(NS_FUNCTION_TIMER)
fi
dnl ========================================================
dnl Turn on reflow counting
dnl ========================================================
@ -8099,19 +8213,6 @@ if test "$NECKO_WIFI"; then
fi
AC_SUBST(NECKO_WIFI)
dnl
dnl option to minimize size of necko's i/o buffers
dnl
MOZ_ARG_ENABLE_BOOL(necko-small-buffers,
[ --enable-necko-small-buffers
Minimize size of necko's i/o buffers],
NECKO_SMALL_BUFFERS=1,
NECKO_SMALL_BUFFERS=)
AC_SUBST(NECKO_SMALL_BUFFERS)
if test "$NECKO_SMALL_BUFFERS"; then
AC_DEFINE(NECKO_SMALL_BUFFERS)
fi
dnl
dnl option to disable cookies
dnl

Просмотреть файл

@ -120,7 +120,8 @@ static inline bool
DoubleIsFinite(double d)
{
#ifdef WIN32
return _finite(d);
// NOTE: '!!' casts an int to bool without spamming MSVC warning C4800.
return !!_finite(d);
#else
return finite(d);
#endif
@ -712,8 +713,8 @@ nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
sNumLivingContexts--;
if (!sNumLivingContexts) {
delete sUnpremultiplyTable;
delete sPremultiplyTable;
delete[] sUnpremultiplyTable;
delete[] sPremultiplyTable;
sUnpremultiplyTable = nsnull;
sPremultiplyTable = nsnull;
}
@ -2064,7 +2065,7 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
gfxFontStyle style(fontStyle->mFont.style,
fontStyle->mFont.weight,
fontStyle->mFont.stretch,
NSAppUnitsToFloatPixels(fontSize, aupcp),
NSAppUnitsToFloatPixels(fontSize, float(aupcp)),
language,
fontStyle->mFont.sizeAdjust,
fontStyle->mFont.systemFont,
@ -3327,7 +3328,8 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
// protect against too-large surfaces that will cause allocation
// or overflow issues
if (!gfxASurface::CheckSurfaceSize(gfxIntSize(aW, aH), 0xffff))
if (!gfxASurface::CheckSurfaceSize(gfxIntSize(PRInt32(aW), PRInt32(aH)),
0xffff))
return NS_ERROR_FAILURE;
// We can't allow web apps to call this until we fix at least the

Просмотреть файл

@ -54,9 +54,6 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
// DOM event.
if (aEvent) {
NS_ASSERTION(static_cast<nsMouseEvent*>(mEvent)->reason
!= nsMouseEvent::eSynthesized,
"Don't dispatch DOM events from synthesized mouse events");
mEventIsInternal = PR_FALSE;
}
else {
@ -69,6 +66,9 @@ nsDOMMouseEvent::nsDOMMouseEvent(nsPresContext* aPresContext,
switch (mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
NS_ASSERTION(static_cast<nsMouseEvent*>(mEvent)->reason
!= nsMouseEvent::eSynthesized,
"Don't dispatch DOM events from synthesized mouse events");
mDetail = static_cast<nsMouseEvent*>(mEvent)->clickCount;
break;
default:

Просмотреть файл

@ -72,9 +72,7 @@ CPPSRCS = \
nsHTMLFrameElement.cpp \
nsHTMLFrameSetElement.cpp \
nsHTMLHRElement.cpp \
nsHTMLHeadElement.cpp \
nsHTMLHeadingElement.cpp \
nsHTMLHtmlElement.cpp \
nsHTMLIFrameElement.cpp \
nsHTMLImageElement.cpp \
nsHTMLInputElement.cpp \

Просмотреть файл

@ -1204,6 +1204,14 @@ nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
PRBool aFromParser = PR_FALSE);
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
inline nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
PRBool aFromParser = PR_FALSE) \
{ \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \
}
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)
@ -1225,9 +1233,9 @@ NS_DECLARE_NS_NEW_HTML_ELEMENT(Form)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Frame)
NS_DECLARE_NS_NEW_HTML_ELEMENT(FrameSet)
NS_DECLARE_NS_NEW_HTML_ELEMENT(HR)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Head)
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Head)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Heading)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Html)
NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(Html)
NS_DECLARE_NS_NEW_HTML_ELEMENT(IFrame)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Image)
NS_DECLARE_NS_NEW_HTML_ELEMENT(Input)

Просмотреть файл

@ -200,7 +200,7 @@ MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
if (unit == nsAttrValue::eInteger || unit == nsAttrValue::eEnum) {
PRInt32 size;
if (unit == nsAttrValue::eEnum) // int (+/-)
size = value->GetEnumValue() + 3; // XXX should be BASEFONT, not three see bug 3875
size = value->GetEnumValue() + 3;
else
size = value->GetIntegerValue();

Просмотреть файл

@ -1,100 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHeadElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
class nsHTMLHeadElement : public nsGenericHTMLElement,
public nsIDOMHTMLHeadElement
{
public:
nsHTMLHeadElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLHeadElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLHeadElement
NS_DECL_NSIDOMHTMLHEADELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Head)
nsHTMLHeadElement::nsHTMLHeadElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
nsHTMLHeadElement::~nsHTMLHeadElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadElement, nsGenericElement)
DOMCI_DATA(HTMLHeadElement, nsHTMLHeadElement)
// QueryInterface implementation for nsHTMLHeadElement
NS_INTERFACE_TABLE_HEAD(nsHTMLHeadElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLHeadElement, nsIDOMHTMLHeadElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLHeadElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLHeadElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHeadElement)
NS_IMPL_URI_ATTR(nsHTMLHeadElement, Profile, profile)

Просмотреть файл

@ -1,102 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLHtmlElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsIDocument.h"
class nsHTMLHtmlElement : public nsGenericHTMLElement,
public nsIDOMHTMLHtmlElement
{
public:
nsHTMLHtmlElement(nsINodeInfo *aNodeInfo);
virtual ~nsHTMLHtmlElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLHtmlElement
NS_DECL_NSIDOMHTMLHTMLELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
};
NS_IMPL_NS_NEW_HTML_ELEMENT(Html)
nsHTMLHtmlElement::nsHTMLHtmlElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
nsHTMLHtmlElement::~nsHTMLHtmlElement()
{
}
NS_IMPL_ADDREF_INHERITED(nsHTMLHtmlElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLHtmlElement, nsGenericElement)
DOMCI_DATA(HTMLHtmlElement, nsHTMLHtmlElement)
// QueryInterface implementation for nsHTMLHtmlElement
NS_INTERFACE_TABLE_HEAD(nsHTMLHtmlElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLHtmlElement, nsIDOMHTMLHtmlElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLHtmlElement,
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLHtmlElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLHtmlElement)
NS_IMPL_STRING_ATTR(nsHTMLHtmlElement, Version, version)

Просмотреть файл

@ -40,7 +40,8 @@
#include "nsIDOMHTMLDirectoryElement.h"
#include "nsIDOMHTMLMenuElement.h"
#include "nsIDOMHTMLQuoteElement.h"
#include "nsIDOMHTMLBaseFontElement.h"
#include "nsIDOMHTMLHeadElement.h"
#include "nsIDOMHTMLHtmlElement.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
@ -59,7 +60,8 @@ class nsHTMLSharedElement : public nsGenericHTMLElement,
public nsIDOMHTMLDirectoryElement,
public nsIDOMHTMLMenuElement,
public nsIDOMHTMLQuoteElement,
public nsIDOMHTMLBaseFontElement
public nsIDOMHTMLHeadElement,
public nsIDOMHTMLHtmlElement
{
public:
nsHTMLSharedElement(nsINodeInfo *aNodeInfo);
@ -95,8 +97,11 @@ public:
// nsIDOMHTMLQuoteElement
NS_DECL_NSIDOMHTMLQUOTEELEMENT
// nsIDOMHTMLBaseFontElement
NS_DECL_NSIDOMHTMLBASEFONTELEMENT
// nsIDOMHTMLHeadElement
NS_DECL_NSIDOMHTMLHEADELEMENT
// nsIDOMHTMLHtmlElement
NS_DECL_NSIDOMHTMLHTMLELEMENT
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
@ -153,7 +158,8 @@ DOMCI_DATA(HTMLSpacerElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLDirectoryElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLMenuElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLQuoteElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLBaseFontElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLHeadElement, nsHTMLSharedElement)
DOMCI_DATA(HTMLHtmlElement, nsHTMLSharedElement)
// QueryInterface implementation for nsHTMLSharedElement
NS_INTERFACE_TABLE_HEAD(nsHTMLSharedElement)
@ -170,7 +176,8 @@ NS_INTERFACE_TABLE_HEAD(nsHTMLSharedElement)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLMenuElement, menu)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, q)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLQuoteElement, blockquote)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLBaseFontElement, basefont)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLHeadElement, head)
NS_INTERFACE_MAP_ENTRY_IF_TAG(nsIDOMHTMLHtmlElement, html)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLParamElement, param)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLWBRElement, wbr)
@ -181,7 +188,8 @@ NS_INTERFACE_TABLE_HEAD(nsHTMLSharedElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLMenuElement, menu)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLQuoteElement, q)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLQuoteElement, blockquote)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLBaseFontElement, basefont)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLHeadElement, head)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_IF_TAG(HTMLHtmlElement, html)
NS_HTML_CONTENT_INTERFACE_MAP_END
@ -195,6 +203,13 @@ NS_IMPL_STRING_ATTR(nsHTMLSharedElement, ValueType, valuetype)
// nsIDOMHTMLIsIndexElement
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Prompt, prompt)
NS_IMETHODIMP
nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm)
{
NS_IF_ADDREF(*aForm = FindForm());
return NS_OK;
}
// nsIDOMHTMLDirectoryElement
NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact)
@ -205,18 +220,22 @@ NS_IMPL_BOOL_ATTR(nsHTMLSharedElement, Compact, compact)
// nsIDOMHTMLQuoteElement
NS_IMPL_URI_ATTR(nsHTMLSharedElement, Cite, cite)
// nsIDOMHTMLBaseFontElement
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Color, color)
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Face, face)
NS_IMPL_INT_ATTR(nsHTMLSharedElement, Size, size)
// nsIDOMHTMLHeadElement
// Deprecated and not exposed to script, but has to be implemented in order to
// not break binary compat.
NS_IMETHODIMP
nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm)
nsHTMLSharedElement::GetProfile(nsAString& aValue)
{
NS_IF_ADDREF(*aForm = FindForm());
return NS_OK;
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsHTMLSharedElement::SetProfile(const nsAString& aValue)
{
return NS_ERROR_FAILURE;
}
// nsIDOMHTMLHtmlElement
NS_IMPL_STRING_ATTR(nsHTMLSharedElement, Version, version)
// nsIDOMHTMLBaseElement
NS_IMPL_URI_ATTR(nsHTMLSharedElement, Href, href)
@ -250,11 +269,6 @@ nsHTMLSharedElement::ParseAttribute(PRInt32 aNamespaceID,
return aResult.ParseIntWithBounds(aValue, 1);
}
}
else if (mNodeInfo->Equals(nsGkAtoms::basefont)) {
if (aAttribute == nsGkAtoms::size) {
return aResult.ParseIntValue(aValue);
}
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,

Просмотреть файл

@ -94,7 +94,6 @@ objectIfaces2.push("nsIImageLoadingContent");
applet
base
basefont
blockquote
del
dir
@ -109,6 +108,8 @@ objectIfaces2.push("nsIImageLoadingContent");
spacer
ul
wbr
head
html
*/
HTML_TAG("a", "Anchor", [ "nsIDOMNSHTMLAnchorElement2" ]);
HTML_TAG("abbr", "Span");
@ -118,7 +119,6 @@ HTML_TAG("applet", "Applet", [], objectIfaces);
HTML_TAG("area", "Area", [ "nsIDOMNSHTMLAreaElement2" ]);
HTML_TAG("b", "Span");
HTML_TAG("base", "Base");
HTML_TAG("basefont", "BaseFont");
HTML_TAG("bdo", "Span");
HTML_TAG("bgsound", "Span");
HTML_TAG("big", "Span");

Просмотреть файл

@ -107,7 +107,7 @@ is(document.all.length, expectedLength, "grew correctly");
// Check which elements the 'name' attribute works on
var elementNames =
['applet','abbr','acronym','address','area','a','b','base','basefont',
['applet','abbr','acronym','address','area','a','b','base',
'bgsound','big','blink','blockquote','br','canvas','center','cite','code',
'col','colgroup','dd','del','dfn','dir','div','dir','dl','dt','em','embed',
'fieldset','font','form','frame','frameset','head','i','iframe','img',

Просмотреть файл

@ -252,7 +252,6 @@
#include "nsIDOMNSHTMLAreaElement2.h"
#include "nsIDOMHTMLBRElement.h"
#include "nsIDOMHTMLBaseElement.h"
#include "nsIDOMHTMLBaseFontElement.h"
#include "nsIDOMHTMLBodyElement.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMNSHTMLButtonElement.h"
@ -549,6 +548,7 @@ DOMCI_DATA(DOMPrototype, void)
DOMCI_DATA(DOMConstructor, void)
DOMCI_DATA(Worker, void)
DOMCI_DATA(ChromeWorker, void)
DOMCI_DATA(Notation, void)
@ -563,12 +563,31 @@ DOMCI_DATA(Notation, void)
_flags, \
PR_TRUE, \
0, \
PR_FALSE, \
NS_DEFINE_CLASSINFO_DATA_DEBUG(_class) \
},
#define NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA_WITH_NAME(_class, _name, \
_helper, _flags) \
{ #_name, \
nsnull, \
{ _helper::doCreate }, \
nsnull, \
nsnull, \
nsnull, \
_flags, \
PR_TRUE, \
0, \
PR_TRUE, \
NS_DEFINE_CLASSINFO_DATA_DEBUG(_class) \
},
#define NS_DEFINE_CLASSINFO_DATA(_class, _helper, _flags) \
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(_class, _class, _helper, _flags)
#define NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(_class, _helper, _flags) \
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA_WITH_NAME(_class, _class, _helper, \
_flags)
// This list of NS_DEFINE_CLASSINFO_DATA macros is what gives the DOM
// classes their correct behavior when used through XPConnect. The
@ -699,8 +718,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLBaseElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLBaseFontElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLBodyElement, nsHTMLBodyElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLButtonElement, nsElementSH,
@ -1320,6 +1337,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(Worker, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeWorker, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContextWebGL, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -1388,6 +1407,7 @@ struct nsConstructorFuncMapData
static const nsConstructorFuncMapData kConstructorFuncMap[] =
{
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(Worker, nsDOMWorker::NewWorker)
NS_DEFINE_CONSTRUCTOR_FUNC_DATA(ChromeWorker, nsDOMWorker::NewChromeWorker)
};
nsIXPConnect *nsDOMClassInfo::sXPConnect = nsnull;
@ -1803,6 +1823,7 @@ nsDOMClassInfo::RegisterClassName(PRInt32 aClassInfoID)
nameSpaceManager->RegisterClassName(sClassInfoData[aClassInfoID].mName,
aClassInfoID,
sClassInfoData[aClassInfoID].mChromeOnly,
&sClassInfoData[aClassInfoID].mNameUTF16);
return NS_OK;
@ -2310,11 +2331,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLBaseFontElement, nsIDOMHTMLBaseFontElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBaseFontElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLBodyElement, nsIDOMHTMLBodyElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBodyElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
@ -3722,6 +3738,14 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(ChromeWorker, nsIChromeWorker)
DOM_CLASSINFO_MAP_ENTRY(nsIChromeWorker)
DOM_CLASSINFO_MAP_ENTRY(nsIWorker)
DOM_CLASSINFO_MAP_ENTRY(nsIAbstractWorker)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(CanvasRenderingContextWebGL, nsICanvasRenderingContextWebGL)
DOM_CLASSINFO_MAP_ENTRY(nsICanvasRenderingContextWebGL)
DOM_CLASSINFO_MAP_END
@ -6022,6 +6046,12 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor ||
name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
// Don't expose chrome only constructors to content windows.
if (name_struct->mChromeOnly && aWin->IsChromeWindow()) {
NS_ASSERTION(nsContentUtils::IsCallerChrome(), "Uh, bad?!");
return NS_OK;
}
// Create the XPConnect prototype for our classinfo, PostCreateProto will
// set up the prototype chain.
nsCOMPtr<nsIXPConnectJSObjectHolder> proto_holder;
@ -6115,7 +6145,7 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
}
if (name_struct->mType == nsGlobalNameStruct::eTypeProperty) {
if (name_struct->mPrivilegedOnly && !nsContentUtils::IsCallerChrome())
if (name_struct->mChromeOnly && !nsContentUtils::IsCallerChrome())
return NS_OK;
nsCOMPtr<nsISupports> native(do_CreateInstance(name_struct->mCID, &rv));

Просмотреть файл

@ -81,6 +81,7 @@ struct nsDOMClassInfoData
PRUint32 mScriptableFlags : 31; // flags must not use more than 31 bits!
PRUint32 mHasClassInterface : 1;
PRUint32 mInterfacesBitmap;
PRBool mChromeOnly;
#ifdef NS_DEBUG
PRUint32 mDebugID;
#endif

Просмотреть файл

@ -88,7 +88,6 @@ DOMCI_CLASS(HTMLAppletElement)
DOMCI_CLASS(HTMLAreaElement)
DOMCI_CLASS(HTMLBRElement)
DOMCI_CLASS(HTMLBaseElement)
DOMCI_CLASS(HTMLBaseFontElement)
DOMCI_CLASS(HTMLBodyElement)
DOMCI_CLASS(HTMLButtonElement)
DOMCI_CLASS(HTMLDListElement)
@ -386,11 +385,6 @@ DOMCI_CLASS(XMLHttpRequest)
DOMCI_CLASS(ClientRect)
DOMCI_CLASS(ClientRectList)
// We are now trying to preserve binary compat in classinfo. No more
// putting things in those categories up there. New entries are to be
// added here, which is the end of the things that are currently on by
// default.
#ifdef MOZ_SVG
DOMCI_CLASS(SVGForeignObjectElement)
#endif
@ -449,6 +443,7 @@ DOMCI_CLASS(MathMLElement)
#endif
DOMCI_CLASS(Worker)
DOMCI_CLASS(ChromeWorker)
// WebGL
DOMCI_CLASS(CanvasRenderingContextWebGL)

Просмотреть файл

@ -190,7 +190,7 @@ nsresult
nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
const char *aCategory,
nsGlobalNameStruct::nametype aType,
PRBool aPrivilegedOnly)
PRBool aChromeOnly)
{
nsCOMPtr<nsIComponentRegistrar> registrar;
nsresult rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
@ -254,7 +254,7 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
return NS_ERROR_OUT_OF_MEMORY;
}
s->mType = nsGlobalNameStruct::eTypeExternalConstructorAlias;
s->mPrivilegedOnly = PR_FALSE;
s->mChromeOnly = PR_FALSE;
s->mAlias->mCID = cid;
AppendASCIItoUTF16(constructorProto, s->mAlias->mProtoName);
s->mAlias->mProto = nsnull;
@ -272,7 +272,7 @@ nsScriptNameSpaceManager::FillHash(nsICategoryManager *aCategoryManager,
if (s->mType == nsGlobalNameStruct::eTypeNotInitialized) {
s->mType = aType;
s->mCID = cid;
s->mPrivilegedOnly = aPrivilegedOnly;
s->mChromeOnly = aChromeOnly;
} else {
NS_WARNING("Global script name not overwritten!");
}
@ -577,6 +577,7 @@ nsScriptNameSpaceManager::LookupName(const nsAString& aName,
nsresult
nsScriptNameSpaceManager::RegisterClassName(const char *aClassName,
PRInt32 aDOMClassInfoID,
PRBool aPrivileged,
const PRUnichar **aResult)
{
if (!nsCRT::IsAscii(aClassName)) {
@ -603,6 +604,7 @@ nsScriptNameSpaceManager::RegisterClassName(const char *aClassName,
s->mType = nsGlobalNameStruct::eTypeClassConstructor;
s->mDOMClassInfoID = aDOMClassInfoID;
s->mChromeOnly = aPrivileged;
return NS_OK;
}

Просмотреть файл

@ -83,7 +83,7 @@ struct nsGlobalNameStruct
eTypeExternalConstructorAlias
} mType;
PRBool mPrivilegedOnly;
PRBool mChromeOnly;
union {
PRInt32 mDOMClassInfoID; // eTypeClassConstructor
@ -124,6 +124,7 @@ public:
nsresult RegisterClassName(const char *aClassName,
PRInt32 aDOMClassInfoID,
PRBool aPrivileged,
const PRUnichar **aResult);
nsresult RegisterClassProto(const char *aClassName,

Просмотреть файл

@ -52,7 +52,6 @@ SDK_XPIDLSRCS = \
nsIDOMHTMLAreaElement.idl \
nsIDOMHTMLBRElement.idl \
nsIDOMHTMLBaseElement.idl \
nsIDOMHTMLBaseFontElement.idl \
nsIDOMHTMLBodyElement.idl \
nsIDOMHTMLButtonElement.idl \
nsIDOMHTMLCollection.idl \

Просмотреть файл

@ -52,5 +52,5 @@
[scriptable, uuid(a6cf9087-15b3-11d2-932e-00805f8add32)]
interface nsIDOMHTMLHeadElement : nsIDOMHTMLElement
{
attribute DOMString profile;
[noscript] attribute DOMString profile;
};

Просмотреть файл

@ -143,3 +143,8 @@ interface nsIWorker : nsIAbstractWorker
void terminate();
};
[scriptable, uuid(c40dfe2c-c9d4-4c48-8e5d-adc99f207dd2)]
interface nsIChromeWorker : nsIWorker
{
};

Просмотреть файл

@ -38,7 +38,11 @@ Reset=Reset
Submit=Submit Query
Browse=Browse…
FileUpload=File Upload
IsIndexPrompt=This is a searchable index. Enter search keywords:\u0020
# LOCALIZATION NOTE (IsIndexPromptWithSpace): The last character of the string
# should be a space (U+0020) in most locales. The prompt is followed by an
# input field. The space needs be escaped in the property file to avoid
# trimming.
IsIndexPromptWithSpace=This is a searchable index. Enter search keywords:\u0020
ForgotPostWarning=Form contains enctype=%S, but does not contain method=post. Submitting normally with method=GET and no enctype instead.
ForgotFileEnctypeWarning=Form contains a file input, but is missing method=POST and enctype=multipart/form-data on the form. The file will not be sent.
# LOCALIZATION NOTE (DefaultFormSubject): %S will be replaced with brandShortName

Просмотреть файл

@ -83,6 +83,9 @@ child:
// special cases where we need to a shared memory buffer
rpc NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
returns (int16_t handled, Shmem rtnbuffer);
// special cases where we need an iosurface
rpc NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
returns (int16_t handled);
// special cases of HandleEvent to make mediating races simpler
rpc Paint(NPRemoteEvent event)
returns (int16_t handled);

Просмотреть файл

@ -80,7 +80,6 @@ using mozilla::gfx::SharedDIB;
#define NS_OOPP_DOUBLEPASS_MSGID TEXT("MozDoublePassMsg")
#elif defined(XP_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
#include "nsPluginUtilsOSX.h"
#endif // defined(XP_MACOSX)
PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
@ -101,8 +100,9 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
#endif // OS_WIN
, mAsyncCallMutex("PluginInstanceChild::mAsyncCallMutex")
#if defined(OS_MACOSX)
, mShColorSpace(NULL)
, mShContext(NULL)
, mShColorSpace(nsnull)
, mShContext(nsnull)
, mDrawingModel(NPDrawingModelCoreGraphics)
#endif
{
memset(&mWindow, 0, sizeof(mWindow));
@ -344,7 +344,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
}
case NPNVsupportsCoreAnimationBool: {
*((NPBool*)aValue) = false;
*((NPBool*)aValue) = true;
return NPERR_NO_ERROR;
}
@ -407,6 +407,7 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
if (!CallNPN_SetValue_NPPVpluginDrawingModel(drawingModel, &rv))
return NPERR_GENERIC_ERROR;
mDrawingModel = drawingModel;
return rv;
}
@ -589,6 +590,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
}
#ifdef XP_MACOSX
bool
PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
Shmem& mem,
@ -658,6 +660,65 @@ PluginInstanceChild::AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event,
}
#endif
#ifdef XP_MACOSX
bool
PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
const uint32_t &surfaceid,
int16_t* handled)
{
PLUGIN_LOG_DEBUG_FUNCTION;
AssertPluginThread();
NPCocoaEvent evcopy = event.event;
nsIOSurface* surf = nsIOSurface::LookupSurface(surfaceid);
if (!surf) {
NS_ERROR("Invalid IOSurface.\n");
*handled = false;
return false;
}
if (evcopy.type == NPCocoaEventDrawRect) {
mCARenderer.AttachIOSurface(surf);
if (!mCARenderer.isInit()) {
void *caLayer = nsnull;
NPError result = mPluginIface->getvalue(GetNPP(),
NPPVpluginCoreAnimationLayer,
&caLayer);
if (result != NPERR_NO_ERROR || !caLayer) {
PLUGIN_LOG_DEBUG(("Plugin requested CoreAnimation but did not "
"provide CALayer."));
*handled = false;
return false;
}
mCARenderer.SetupRenderer(caLayer, mWindow.width, mWindow.height);
// Flash needs to have the window set again after this step
if (mPluginIface->setwindow)
(void) mPluginIface->setwindow(&mData, &mWindow);
}
} else {
PLUGIN_LOG_DEBUG(("Invalid event type for "
"AnswerNNP_HandleEvent_IOSurface."));
*handled = false;
return false;
}
mCARenderer.Render(mWindow.width, mWindow.height, nsnull);
return true;
}
#else
bool
PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
const uint32_t &surfaceid,
int16_t* handled)
{
NS_RUNTIMEABORT("NPP_HandleEvent_IOSurface is a OSX-only message");
return false;
}
#endif
bool
PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
{
@ -799,7 +860,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
// Release the shared context so that it is reallocated
// with the new size.
::CGContextRelease(mShContext);
mShContext = NULL;
mShContext = nsnull;
}
if (mPluginIface->setwindow)

Просмотреть файл

@ -44,6 +44,9 @@
#include "mozilla/plugins/StreamNotifyChild.h"
#if defined(OS_WIN)
#include "mozilla/gfx/SharedDIBWin.h"
#elif defined(OS_MACOSX)
#include "nsCoreAnimationSupport.h"
#include "base/timer.h"
#endif
#include "npfunctions.h"
@ -90,6 +93,8 @@ protected:
AnswerNPP_HandleEvent(const NPRemoteEvent& event, int16_t* handled);
virtual bool
AnswerNPP_HandleEvent_Shmem(const NPRemoteEvent& event, Shmem& mem, int16_t* handled, Shmem* rtnmem);
virtual bool
AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, const uint32_t& surface, int16_t* handled);
NS_OVERRIDE
virtual bool
@ -323,7 +328,9 @@ private:
#if defined(OS_MACOSX)
private:
CGColorSpaceRef mShColorSpace;
CGContextRef mShContext;
CGContextRef mShContext;
int16_t mDrawingModel;
nsCARenderer mCARenderer;
#endif
};

Просмотреть файл

@ -61,13 +61,13 @@ UINT gOOPPStopNativeLoopEvent =
#include <gdk/gdk.h>
#elif defined(XP_MACOSX)
#include <ApplicationServices/ApplicationServices.h>
#include "nsPluginUtilsOSX.h"
#endif // defined(XP_MACOSX)
using namespace mozilla::plugins;
PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
NPP npp,
const nsCString& aMimeType,
const NPNetscapeFuncs* npniface)
: mParent(parent)
, mNPP(npp)
@ -78,12 +78,29 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mPluginWndProc(NULL)
, mNestedEventState(false)
#endif // defined(XP_WIN)
, mQuirks(0)
#if defined(XP_MACOSX)
, mShWidth(0)
, mShHeight(0)
, mShColorSpace(NULL)
, mShColorSpace(nsnull)
, mDrawingModel(NPDrawingModelCoreGraphics)
, mIOSurface(nsnull)
#endif
{
InitQuirksModes(aMimeType);
}
void
PluginInstanceParent::InitQuirksModes(const nsCString& aMimeType)
{
#ifdef OS_MACOSX
NS_NAMED_LITERAL_CSTRING(flash, "application/x-shockwave-flash");
// Flash sends us Invalidate events so we will use those
// instead of the refresh timer.
if (!FindInReadable(flash, aMimeType)) {
mQuirks |= COREANIMATION_REFRESH_TIMER;
}
#endif
}
PluginInstanceParent::~PluginInstanceParent()
@ -96,7 +113,13 @@ PluginInstanceParent::~PluginInstanceParent()
"Subclass was not reset correctly before the dtor was reached!");
#endif
#if defined(OS_MACOSX)
::CGColorSpaceRelease(mShColorSpace);
if (mShColorSpace)
::CGColorSpaceRelease(mShColorSpace);
if (mIOSurface)
delete mIOSurface;
if (mDrawingModel == NPDrawingModelCoreAnimation) {
mParent->RemoveFromRefreshTimer(this);
}
#endif
}
@ -329,8 +352,22 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
const int& drawingModel, NPError* result)
{
#ifdef XP_MACOSX
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
if (drawingModel == NPDrawingModelCoreAnimation) {
// We need to request CoreGraphics otherwise
// the nsObjectFrame will try to draw a CALayer
// that can not be shared across process.
mDrawingModel = NPDrawingModelCoreAnimation;
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
(void*)NPDrawingModelCoreGraphics);
if (mQuirks & COREANIMATION_REFRESH_TIMER) {
abort();
mParent->AddToRefreshTimer(this);
}
} else {
mDrawingModel = drawingModel;
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
(void*)drawingModel);
}
return true;
#else
*result = NPERR_GENERIC_ERROR;
@ -476,14 +513,24 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
#endif
#if defined(XP_MACOSX)
if (mShWidth * mShHeight != window.width * window.height) {
// XXX: benwa: OMG MEMORY LEAK!
// There is currently no way dealloc the shmem
// so for now we will leak the memory and will fix this ASAP!
if (!AllocShmem(window.width * window.height * 4, SharedMemory::TYPE_BASIC,
&mShSurface)) {
PLUGIN_LOG_DEBUG(("Shared memory could not be allocated."));
return NPERR_GENERIC_ERROR;
if (mShWidth != window.width || mShHeight != window.height) {
if (mDrawingModel == NPDrawingModelCoreAnimation) {
if (mIOSurface) {
delete mIOSurface;
}
mIOSurface = nsIOSurface::CreateIOSurface(window.width, window.height);
} else if (mShWidth * mShHeight != window.width * window.height) {
// Uncomment me when DeallocShmem lands.
//if (mShWidth != 0 && mShHeight != 0) {
// DeallocShmem(&mShSurface);
//}
if (window.width != 0 && window.height != 0) {
if (!AllocShmem(window.width * window.height*4,
SharedMemory::TYPE_BASIC, &mShSurface)) {
PLUGIN_LOG_DEBUG(("Shared memory could not be allocated."));
return NPERR_GENERIC_ERROR;
}
}
}
mShWidth = window.width;
mShHeight = window.height;
@ -658,7 +705,9 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
// to wait. A possibly-slightly-better alternative would be to send
// an X event to the child that the child would wait for.
XSync(GetXDisplay(), False);
break;
return CallPaint(npremoteevent, &handled) ? handled : 0;
case ButtonPress:
// Release any active pointer grab so that the plugin X client can
// grab the pointer if it wishes.
@ -673,55 +722,90 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
// Wait for the ungrab to complete.
XSync(dpy, False);
break;
return CallPaint(npremoteevent, &handled) ? handled : 0;
}
#endif
#ifdef XP_MACOSX
if (npevent->type == NPCocoaEventDrawRect) {
if (mShWidth == 0 && mShHeight == 0) {
PLUGIN_LOG_DEBUG(("NPCocoaEventDrawRect on window of size 0."));
return false;
}
if (!mShSurface.IsReadable()) {
PLUGIN_LOG_DEBUG(("Shmem is not readable."));
return false;
}
if (mDrawingModel == NPDrawingModelCoreAnimation) {
if (!mIOSurface) {
NS_ERROR("No IOSurface allocated.");
return false;
}
if (!CallNPP_HandleEvent_IOSurface(npremoteevent,
mIOSurface->GetIOSurfaceID(),
&handled))
return false; // no good way to handle errors here...
if (!CallNPP_HandleEvent_Shmem(npremoteevent, mShSurface, &handled, &mShSurface))
return false; // no good way to handle errors here...
if (!mShSurface.IsReadable()) {
PLUGIN_LOG_DEBUG(("Shmem not returned. Either the plugin crashed or we have a bug."));
return false;
}
char* shContextByte = mShSurface.get<char>();
if (!mShColorSpace) {
mShColorSpace = CreateSystemColorSpace();
}
if (!mShColorSpace) {
PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
return true;
}
CGContextRef shContext = ::CGBitmapContextCreate(shContextByte,
mShWidth, mShHeight, 8, mShWidth*4, mShColorSpace,
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host);
if (!shContext) {
PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext."));
return true;
}
CGImageRef shImage = ::CGBitmapContextCreateImage(shContext);
if (shImage) {
CGContextRef cgContext = npevent->data.draw.context;
::CGContextDrawImage(cgContext, CGRectMake(0,0,mShWidth,mShHeight), shImage);
::CGImageRelease(shImage);
if (!mShColorSpace) {
mShColorSpace = CreateSystemColorSpace();
}
if (!mShColorSpace) {
PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
return false;
}
nsCARenderer::DrawSurfaceToCGContext(cgContext, mIOSurface,
mShColorSpace,
npevent->data.draw.x,
npevent->data.draw.y,
npevent->data.draw.width,
npevent->data.draw.height);
return false;
} else {
if (mShWidth == 0 && mShHeight == 0) {
PLUGIN_LOG_DEBUG(("NPCocoaEventDrawRect on window of size 0."));
return false;
}
if (!mShSurface.IsReadable()) {
PLUGIN_LOG_DEBUG(("Shmem is not readable."));
return false;
}
if (!CallNPP_HandleEvent_Shmem(npremoteevent, mShSurface,
&handled, &mShSurface))
return false; // no good way to handle errors here...
if (!mShSurface.IsReadable()) {
PLUGIN_LOG_DEBUG(("Shmem not returned. Either the plugin crashed "
"or we have a bug."));
return false;
}
char* shContextByte = mShSurface.get<char>();
if (!mShColorSpace) {
mShColorSpace = CreateSystemColorSpace();
}
if (!mShColorSpace) {
PLUGIN_LOG_DEBUG(("Could not allocate ColorSpace."));
return false;
}
CGContextRef shContext = ::CGBitmapContextCreate(shContextByte,
mShWidth, mShHeight, 8,
mShWidth*4, mShColorSpace,
kCGImageAlphaPremultipliedFirst |
kCGBitmapByteOrder32Host);
if (!shContext) {
PLUGIN_LOG_DEBUG(("Could not allocate CGBitmapContext."));
return false;
}
CGImageRef shImage = ::CGBitmapContextCreateImage(shContext);
if (shImage) {
CGContextRef cgContext = npevent->data.draw.context;
::CGContextDrawImage(cgContext,
CGRectMake(0,0,mShWidth,mShHeight),
shImage);
::CGImageRelease(shImage);
} else {
::CGContextRelease(shContext);
return false;
}
::CGContextRelease(shContext);
return true;
}
::CGContextRelease(shContext);
return handled;
}
#endif
@ -1257,3 +1341,12 @@ PluginInstanceParent::RecvSetNestedEventState(const bool& aState)
return false;
#endif
}
#ifdef OS_MACOSX
void
PluginInstanceParent::Invalidate()
{
NPRect windowRect = {0, 0, mShWidth, mShHeight};
RecvNPN_InvalidateRect(windowRect);
}
#endif

Просмотреть файл

@ -43,6 +43,8 @@
#include "mozilla/plugins/PluginScriptableObjectParent.h"
#if defined(OS_WIN)
#include "mozilla/gfx/SharedDIBWin.h"
#elif defined(OS_MACOSX)
#include "nsCoreAnimationSupport.h"
#endif
#include "npfunctions.h"
@ -66,6 +68,7 @@ class PluginInstanceParent : public PPluginInstanceParent
public:
PluginInstanceParent(PluginModuleParent* parent,
NPP npp,
const nsCString& mimeType,
const NPNetscapeFuncs* npniface);
virtual ~PluginInstanceParent();
@ -246,7 +249,21 @@ public:
virtual bool
RecvSetNestedEventState(const bool& aState);
#if defined(OS_MACOSX)
void Invalidate();
#endif // definied(OS_MACOSX)
private:
// Quirks mode support for various plugin mime types
enum PluginQuirks {
// OSX: Don't use the refresh timer for plug-ins
// using this quirk. These plug-in most have another
// way to refresh the window.
COREANIMATION_REFRESH_TIMER = 1,
};
void InitQuirksModes(const nsCString& aMimeType);
bool InternalGetValueForNPObject(NPNVariable aVariable,
PPluginScriptableObjectParent** aValue,
NPError* aResult);
@ -256,6 +273,7 @@ private:
NPP mNPP;
const NPNetscapeFuncs* mNPNIface;
NPWindowType mWindowType;
int mQuirks;
nsDataHashtable<nsVoidPtrHashKey, PluginScriptableObjectParent*> mScriptableObjects;
@ -282,10 +300,12 @@ private:
#endif // defined(XP_WIN)
#if defined(OS_MACOSX)
private:
Shmem mShSurface;
size_t mShWidth;
size_t mShHeight;
CGColorSpaceRef mShColorSpace;
Shmem mShSurface;
size_t mShWidth;
size_t mShHeight;
CGColorSpaceRef mShColorSpace;
int16_t mDrawingModel;
nsIOSurface *mIOSurface;
#endif // definied(OS_MACOSX)
};

Просмотреть файл

@ -87,6 +87,8 @@ MediateRace(const RPCChannel::Message& parent,
switch (parent.type()) {
case PPluginInstance::Msg_Paint__ID:
case PPluginInstance::Msg_NPP_SetWindow__ID:
case PPluginInstance::Msg_NPP_HandleEvent_Shmem__ID:
case PPluginInstance::Msg_NPP_HandleEvent_IOSurface__ID:
// our code relies on the frame list not changing during paints and
// reflows
return RPCChannel::RRPParentWins;

Просмотреть файл

@ -547,10 +547,9 @@ PluginModuleParent::GetIdentifierForNPIdentifier(NPIdentifier aIdentifier)
string.SetIsVoid(PR_TRUE);
}
ident = new PluginIdentifierParent(aIdentifier);
if (!SendPPluginIdentifierConstructor(ident, string, intval)) {
delete ident;
if (!SendPPluginIdentifierConstructor(ident, string, intval))
return nsnull;
}
mIdentifiers.Put(aIdentifier, ident);
}
return ident;
@ -715,7 +714,8 @@ PluginModuleParent::NPP_New(NPMIMEType pluginType, NPP instance,
}
PluginInstanceParent* parentInstance =
new PluginInstanceParent(this, instance, mNPNIface);
new PluginInstanceParent(this, instance,
nsDependentCString(pluginType), mNPNIface);
if (!parentInstance->Init()) {
delete parentInstance;
@ -782,3 +782,35 @@ PluginModuleParent::AnswerProcessSomeEvents()
return true;
}
#endif
#ifdef OS_MACOSX
#define DEFAULT_REFRESH_MS 20 // CoreAnimation: 50 FPS
void
PluginModuleParent::AddToRefreshTimer(PluginInstanceParent *aInstance) {
if (mCATimerTargets.Contains(aInstance)) {
return;
}
mCATimerTargets.AppendElement(aInstance);
if (mCATimerTargets.Length() == 1) {
mCATimer.Start(base::TimeDelta::FromMilliseconds(DEFAULT_REFRESH_MS),
this, &PluginModuleParent::CAUpdate);
}
}
void
PluginModuleParent::RemoveFromRefreshTimer(PluginInstanceParent *aInstance) {
PRBool visibleRemoved = mCATimerTargets.RemoveElement(aInstance);
if (visibleRemoved && mCATimerTargets.IsEmpty()) {
mCATimer.Stop();
}
}
void
PluginModuleParent::CAUpdate() {
nsTObserverArray<PluginInstanceParent*>::ForwardIterator iter(mCATimerTargets);
while (iter.HasMore()) {
iter.GetNext()->Invalidate();
}
}
#endif

Просмотреть файл

@ -60,6 +60,7 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsIFileStreams.h"
#include "nsTObserverArray.h"
namespace mozilla {
namespace plugins {
@ -134,6 +135,11 @@ public:
PPluginIdentifierParent*
GetIdentifierForNPIdentifier(NPIdentifier aIdentifier);
#ifdef OS_MACOSX
void AddToRefreshTimer(PluginInstanceParent *aInstance);
void RemoveFromRefreshTimer(PluginInstanceParent *aInstance);
#endif
protected:
NS_OVERRIDE
virtual mozilla::ipc::RPCChannel::RacyRPCPolicy
@ -240,6 +246,12 @@ private:
nsString mPluginDumpID;
nsString mBrowserDumpID;
nsString mHangID;
#ifdef OS_MACOSX
void CAUpdate();
base::RepeatingTimer<PluginModuleParent> mCATimer;
nsTObserverArray<PluginInstanceParent*> mCATimerTargets;
#endif
};
} // namespace plugins

Просмотреть файл

@ -79,8 +79,7 @@ void
PluginProcessParent::Delete()
{
MessageLoop* currentLoop = MessageLoop::current();
MessageLoop* ioLoop =
BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
if (currentLoop == ioLoop) {
delete this;

Просмотреть файл

@ -48,7 +48,6 @@ LIBRARY_NAME = domthreads_s
LIBXUL_LIBRARY = 1
FORCE_STATIC_LIB = 1
CPPSRCS = \
nsDOMThreadService.cpp \
nsDOMWorker.cpp \

Просмотреть файл

@ -381,6 +381,13 @@ public:
NS_ASSERTION(!JS_GetGlobalObject(cx), "Shouldn't have a global!");
if (mWorker->IsPrivileged()) {
JS_SetVersion(cx, JSVERSION_LATEST);
}
else {
JS_SetVersion(cx, JSVERSION_DEFAULT);
}
JS_SetContextPrivate(cx, mWorker);
// Go ahead and trigger the operation callback for this context before we

Просмотреть файл

@ -36,6 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "jscntxt.h"
#include "nsDOMWorker.h"
#include "nsIDOMEvent.h"
@ -68,39 +70,64 @@
class nsDOMWorkerFunctions
{
public:
typedef nsDOMWorker::WorkerPrivilegeModel WorkerPrivilegeModel;
// Same as window.dump().
static JSBool Dump(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval);
static JSBool
Dump(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv, jsval* aRval);
// Same as window.setTimeout().
static JSBool SetTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval) {
static JSBool
SetTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval) {
return MakeTimeout(aCx, aObj, aArgc, aArgv, aRval, PR_FALSE);
}
// Same as window.setInterval().
static JSBool SetInterval(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval) {
static JSBool
SetInterval(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval) {
return MakeTimeout(aCx, aObj, aArgc, aArgv, aRval, PR_TRUE);
}
// Used for both clearTimeout() and clearInterval().
static JSBool KillTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval);
static JSBool
KillTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval);
static JSBool LoadScripts(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval);
static JSBool
LoadScripts(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval);
static JSBool NewXMLHttpRequest(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval);
static JSBool
NewXMLHttpRequest(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval);
static JSBool NewWorker(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval);
static JSBool
NewWorker(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval) {
return MakeNewWorker(aCx, aObj, aArgc, aArgv, aRval, nsDOMWorker::CONTENT);
}
// Chrome-only functions
static JSBool
NewChromeWorker(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval);
#ifdef BUILD_CTYPES
static JSBool
CTypesLazyGetter(JSContext* aCx, JSObject* aObj, jsval aId, jsval* aVp);
#endif
private:
// Internal helper for SetTimeout and SetInterval.
static JSBool MakeTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc,
jsval* aArgv, jsval* aRval, PRBool aIsInterval);
static JSBool
MakeTimeout(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval, PRBool aIsInterval);
static JSBool
MakeNewWorker(JSContext* aCx, JSObject* aObj, uintN aArgc, jsval* aArgv,
jsval* aRval, WorkerPrivilegeModel aPrivilegeModel);
};
JSBool
@ -325,11 +352,30 @@ nsDOMWorkerFunctions::NewXMLHttpRequest(JSContext* aCx,
}
JSBool
nsDOMWorkerFunctions::NewWorker(JSContext* aCx,
JSObject* aObj,
uintN aArgc,
jsval* aArgv,
jsval* aRval)
nsDOMWorkerFunctions::NewChromeWorker(JSContext* aCx,
JSObject* aObj,
uintN aArgc,
jsval* aArgv,
jsval* aRval)
{
nsDOMWorker* worker = static_cast<nsDOMWorker*>(JS_GetContextPrivate(aCx));
NS_ASSERTION(worker, "This should be set by the DOM thread service!");
if (!worker->IsPrivileged()) {
JS_ReportError(aCx, "Cannot create a priviliged worker!");
return JS_FALSE;
}
return MakeNewWorker(aCx, aObj, aArgc, aArgv, aRval, nsDOMWorker::CHROME);
}
JSBool
nsDOMWorkerFunctions::MakeNewWorker(JSContext* aCx,
JSObject* aObj,
uintN aArgc,
jsval* aArgv,
jsval* aRval,
WorkerPrivilegeModel aPrivilegeModel)
{
nsDOMWorker* worker = static_cast<nsDOMWorker*>(JS_GetContextPrivate(aCx));
NS_ASSERTION(worker, "This should be set by the DOM thread service!");
@ -358,7 +404,8 @@ nsDOMWorkerFunctions::NewWorker(JSContext* aCx,
return JS_FALSE;
}
nsRefPtr<nsDOMWorker> newWorker = new nsDOMWorker(worker, wrappedWorker);
nsRefPtr<nsDOMWorker> newWorker =
new nsDOMWorker(worker, wrappedWorker, aPrivilegeModel);
if (!newWorker) {
JS_ReportOutOfMemory(aCx);
return JS_FALSE;
@ -383,22 +430,58 @@ nsDOMWorkerFunctions::NewWorker(JSContext* aCx,
return JS_TRUE;
}
JSFunctionSpec gDOMWorkerFunctions[] = {
{ "dump", nsDOMWorkerFunctions::Dump, 1, 0, 0 },
{ "setTimeout", nsDOMWorkerFunctions::SetTimeout, 1, 0, 0 },
{ "clearTimeout", nsDOMWorkerFunctions::KillTimeout, 1, 0, 0 },
{ "setInterval", nsDOMWorkerFunctions::SetInterval, 1, 0, 0 },
{ "clearInterval", nsDOMWorkerFunctions::KillTimeout, 1, 0, 0 },
{ "importScripts", nsDOMWorkerFunctions::LoadScripts, 1, 0, 0 },
{ "XMLHttpRequest", nsDOMWorkerFunctions::NewXMLHttpRequest, 0, 0, 0 },
{ "Worker", nsDOMWorkerFunctions::NewWorker, 1, 0, 0 },
#ifdef MOZ_SHARK
{ "startShark", js_StartShark, 0, 0, 0 },
{ "stopShark", js_StopShark, 0, 0, 0 },
{ "connectShark", js_ConnectShark, 0, 0, 0 },
{ "disconnectShark", js_DisconnectShark, 0, 0, 0 },
#ifdef BUILD_CTYPES
JSBool
nsDOMWorkerFunctions::CTypesLazyGetter(JSContext* aCx,
JSObject* aObj,
jsval aId,
jsval* aVp)
{
#ifdef DEBUG
{
NS_ASSERTION(JS_GetGlobalForObject(aCx, aObj) == aObj, "Bad object!");
NS_ASSERTION(JSVAL_IS_STRING(aId), "Not a string!");
JSString* str = JSVAL_TO_STRING(aId);
NS_ASSERTION(nsDependentJSString(str).EqualsLiteral("ctypes"), "Bad id!");
}
#endif
{ nsnull, nsnull, 0, 0, 0 }
nsDOMWorker* worker = static_cast<nsDOMWorker*>(JS_GetContextPrivate(aCx));
NS_ASSERTION(worker, "This should be set by the DOM thread service!");
NS_ASSERTION(worker->IsPrivileged(), "This shouldn't be possible!");
if (worker->IsCanceled()) {
return JS_FALSE;
}
js::AutoIdRooter rooter(aCx);
return JS_ValueToId(aCx, aId, rooter.addr()) &&
JS_DeletePropertyById(aCx, aObj, rooter.id()) &&
JS_InitCTypesClass(aCx, aObj) &&
JS_GetPropertyById(aCx, aObj, rooter.id(), aVp);
}
#endif
JSFunctionSpec gDOMWorkerFunctions[] = {
{ "dump", nsDOMWorkerFunctions::Dump, 1, 0, 0 },
{ "setTimeout", nsDOMWorkerFunctions::SetTimeout, 1, 0, 0 },
{ "clearTimeout", nsDOMWorkerFunctions::KillTimeout, 1, 0, 0 },
{ "setInterval", nsDOMWorkerFunctions::SetInterval, 1, 0, 0 },
{ "clearInterval", nsDOMWorkerFunctions::KillTimeout, 1, 0, 0 },
{ "importScripts", nsDOMWorkerFunctions::LoadScripts, 1, 0, 0 },
{ "XMLHttpRequest", nsDOMWorkerFunctions::NewXMLHttpRequest, 0, 0, 0 },
{ "Worker", nsDOMWorkerFunctions::NewWorker, 1, 0, 0 },
#ifdef MOZ_SHARK
{ "startShark", js_StartShark, 0, 0, 0 },
{ "stopShark", js_StopShark, 0, 0, 0 },
{ "connectShark", js_ConnectShark, 0, 0, 0 },
{ "disconnectShark", js_DisconnectShark, 0, 0, 0 },
#endif
{ nsnull, nsnull, 0, 0, 0 }
};
JSFunctionSpec gDOMWorkerChromeFunctions[] = {
{ "ChromeWorker", nsDOMWorkerFunctions::NewChromeWorker, 1, 0, 0 },
{ nsnull, nsnull, 0, 0, 0 }
};
nsDOMWorkerScope::nsDOMWorkerScope(nsDOMWorker* aWorker)
@ -895,38 +978,12 @@ nsDOMWorkerFeature::Release()
NS_IMPL_QUERY_INTERFACE0(nsDOMWorkerFeature)
class nsDOMWorkerClassInfo : public nsIClassInfo
{
public:
NS_DECL_NSICLASSINFO
NS_IMETHOD_(nsrefcnt) AddRef() {
return 2;
}
NS_IMETHOD_(nsrefcnt) Release() {
return 1;
}
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
};
NS_IMPL_QUERY_INTERFACE1(nsDOMWorkerClassInfo, nsIClassInfo)
// Keep this list in sync with the list in nsDOMClassInfo.cpp!
NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorkerClassInfo, nsIWorker,
nsIAbstractWorker,
nsIDOMNSEventTarget,
nsIDOMEventTarget)
NS_IMPL_THREADSAFE_DOM_CI(nsDOMWorkerClassInfo)
static nsDOMWorkerClassInfo sDOMWorkerClassInfo;
nsDOMWorker::nsDOMWorker(nsDOMWorker* aParent,
nsIXPConnectWrappedNative* aParentWN)
nsIXPConnectWrappedNative* aParentWN,
WorkerPrivilegeModel aPrivilegeModel)
: mParent(aParent),
mParentWN(aParentWN),
mPrivilegeModel(aPrivilegeModel),
mLock(nsnull),
mInnerScope(nsnull),
mGlobal(NULL),
@ -974,13 +1031,40 @@ nsDOMWorker::~nsDOMWorker()
}
}
/* static */ nsresult
// static
nsresult
nsDOMWorker::NewWorker(nsISupports** aNewObject)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
nsCOMPtr<nsISupports> newWorker =
NS_ISUPPORTS_CAST(nsIWorker*, new nsDOMWorker(nsnull, nsnull));
NS_ISUPPORTS_CAST(nsIWorker*, new nsDOMWorker(nsnull, nsnull, CONTENT));
NS_ENSURE_TRUE(newWorker, NS_ERROR_OUT_OF_MEMORY);
newWorker.forget(aNewObject);
return NS_OK;
}
// static
nsresult
nsDOMWorker::NewChromeWorker(nsISupports** aNewObject)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
// Subsumes nsContentUtils::IsCallerChrome
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
NS_ASSERTION(ssm, "Should never be null!");
PRBool enabled;
nsresult rv = ssm->IsCapabilityEnabled("UniversalXPConnect", &enabled);
NS_ENSURE_SUCCESS(rv, rv);
if(!enabled) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsISupports> newWorker =
NS_ISUPPORTS_CAST(nsIWorker*, new nsDOMWorker(nsnull, nsnull, CHROME));
NS_ENSURE_TRUE(newWorker, NS_ERROR_OUT_OF_MEMORY);
newWorker.forget(aNewObject);
@ -992,17 +1076,16 @@ NS_IMPL_RELEASE_INHERITED(nsDOMWorker, nsDOMWorkerMessageHandler)
NS_INTERFACE_MAP_BEGIN(nsDOMWorker)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWorker)
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
NS_INTERFACE_MAP_ENTRY(nsIWorker)
NS_INTERFACE_MAP_ENTRY(nsIAbstractWorker)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMNSEventTarget,
nsDOMWorkerMessageHandler)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventTarget, nsDOMWorkerMessageHandler)
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
NS_INTERFACE_MAP_ENTRY(nsITimerCallback)
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {
foundInterface = static_cast<nsIClassInfo*>(&sDOMWorkerClassInfo);
} else
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIChromeWorker, IsPrivileged())
NS_INTERFACE_MAP_END
// Use the xpc_map_end.h macros to generate the nsIXPCScriptable methods we want
@ -1010,6 +1093,7 @@ NS_INTERFACE_MAP_END
#define XPC_MAP_CLASSNAME nsDOMWorker
#define XPC_MAP_QUOTED_CLASSNAME "Worker"
#define XPC_MAP_WANT_PRECREATE
#define XPC_MAP_WANT_POSTCREATE
#define XPC_MAP_WANT_TRACE
#define XPC_MAP_WANT_FINALIZE
@ -1024,6 +1108,16 @@ NS_INTERFACE_MAP_END
#include "xpc_map_end.h"
NS_IMETHODIMP
nsDOMWorker::PreCreate(nsISupports* aObject,
JSContext* /* aCx */,
JSObject* /* aPlannedParent */,
JSObject** /* aParent */)
{
nsCOMPtr<nsIChromeWorker> privilegedWorker(do_QueryInterface(aObject));
return privilegedWorker ? NS_SUCCESS_CHROME_ACCESS_ONLY : NS_OK;
}
NS_IMETHODIMP
nsDOMWorker::PostCreate(nsIXPConnectWrappedNative* aWrapper,
JSContext* /* aCx */,
@ -1080,6 +1174,27 @@ nsDOMWorker::Finalize(nsIXPConnectWrappedNative* /* aWrapper */,
return NS_OK;
}
// Keep this list in sync with the list in nsDOMClassInfo.cpp!
NS_IMPL_CI_INTERFACE_GETTER4(nsDOMWorker, nsIWorker,
nsIAbstractWorker,
nsIDOMNSEventTarget,
nsIDOMEventTarget)
NS_IMPL_THREADSAFE_DOM_CI_GETINTERFACES(nsDOMWorker)
NS_IMPL_THREADSAFE_DOM_CI_ALL_THE_REST(nsDOMWorker)
NS_IMETHODIMP
nsDOMWorker::GetHelperForLanguage(PRUint32 aLanguage,
nsISupports** _retval)
{
if (aLanguage == nsIProgrammingLanguage::JAVASCRIPT) {
NS_ADDREF(*_retval = NS_ISUPPORTS_CAST(nsIWorker*, this));
}
else {
*_retval = nsnull;
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWorker::Initialize(nsISupports* aOwner,
JSContext* aCx,
@ -1521,10 +1636,24 @@ nsDOMWorker::CompileGlobalObject(JSContext* aCx)
}
#endif
// Set up worker thread functions
// Set up worker thread functions.
PRBool success = JS_DefineFunctions(aCx, global, gDOMWorkerFunctions);
NS_ENSURE_TRUE(success, PR_FALSE);
if (mPrivilegeModel == CHROME) {
// Add chrome functions.
success = JS_DefineFunctions(aCx, global, gDOMWorkerChromeFunctions);
NS_ENSURE_TRUE(success, PR_FALSE);
#ifdef BUILD_CTYPES
// Add the lazy getter for ctypes.
success = JS_DefineProperty(aCx, global, "ctypes", JSVAL_VOID,
nsDOMWorkerFunctions::CTypesLazyGetter, nsnull,
0);
NS_ENSURE_TRUE(success, PR_FALSE);
}
#endif
// From here on out we have to remember to null mGlobal, mInnerScope, and
// mScopeWN if something fails! We really don't need to hang on to mGlobal
// as long as we have mScopeWN, but it saves us a virtual call every time the

Просмотреть файл

@ -106,7 +106,7 @@ private:
};
class nsDOMWorker : public nsDOMWorkerMessageHandler,
public nsIWorker,
public nsIChromeWorker,
public nsITimerCallback,
public nsIJSNativeInitializer,
public nsIXPCScriptable
@ -137,13 +137,19 @@ public:
PRUint8 optional_argc);
NS_DECL_NSIABSTRACTWORKER
NS_DECL_NSIWORKER
NS_DECL_NSICHROMEWORKER
NS_DECL_NSITIMERCALLBACK
NS_DECL_NSICLASSINFO
NS_DECL_NSIXPCSCRIPTABLE
static nsresult NewWorker(nsISupports** aNewObject);
static nsresult NewChromeWorker(nsISupports** aNewObject);
enum WorkerPrivilegeModel { CONTENT, CHROME };
nsDOMWorker(nsDOMWorker* aParent,
nsIXPConnectWrappedNative* aParentWN);
nsIXPConnectWrappedNative* aParentWN,
WorkerPrivilegeModel aModel);
NS_IMETHOD Initialize(nsISupports* aOwner,
JSContext* aCx,
@ -192,6 +198,10 @@ public:
PRIntervalTime GetExpirationTime();
#endif
PRBool IsPrivileged() {
return mPrivilegeModel == CHROME;
}
/**
* Use this chart to help figure out behavior during each of the closing
* statuses. Details below.
@ -300,6 +310,10 @@ private:
nsDOMWorker* mParent;
nsCOMPtr<nsIXPConnectWrappedNative> mParentWN;
// Whether or not this worker has chrome privileges. Never changed after the
// worker is created.
WorkerPrivilegeModel mPrivilegeModel;
PRLock* mLock;
nsRefPtr<nsDOMWorkerPool> mPool;

Просмотреть файл

@ -107,6 +107,7 @@ _TEST_FILES = \
fibonacci_worker.js \
test_newError.html \
newError_worker.js \
test_chromeWorker.html \
$(NULL)
_SUBDIR_TEST_FILES = \
@ -115,8 +116,17 @@ _SUBDIR_TEST_FILES = \
relativeLoad_sub_import.js \
$(NULL)
_CHROME_TEST_FILES = \
test_chromeWorker.xul \
chromeWorker_worker.js \
chromeWorker_subworker.js \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_SUBDIR_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/subdir
libs:: $(_CHROME_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)

Просмотреть файл

@ -0,0 +1,40 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DOM Worker Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
onmessage = function(event) {
postMessage("Done!");
};

Просмотреть файл

@ -0,0 +1,42 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is DOM Worker Tests.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ben Turner <bent.mozilla@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
let worker = new ChromeWorker("chromeWorker_subworker.js");
worker.onmessage = function(event) {
postMessage(event.data);
}
worker.postMessage("Go");

Просмотреть файл

@ -0,0 +1,24 @@
<html>
<head>
<title>Test for DOM Worker Threads</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
try {
var worker = new ChromeWorker("simpleThread_worker.js");
ok(false, "ChromeWorker constructor should be blocked!");
}
catch (e) {
ok(true, "ChromeWorker constructor wasn't blocked!");
}
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,78 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
- Version: MPL 1.1/GPL 2.0/LGPL 2.1
-
- The contents of this file are subject to the Mozilla Public License Version
- 1.1 (the "License"); you may not use this file except in compliance with
- the License. You may obtain a copy of the License at
- http://www.mozilla.org/MPL/
-
- Software distributed under the License is distributed on an "AS IS" basis,
- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- for the specific language governing rights and limitations under the
- License.
-
- The Original Code is DOM Worker tests.
-
- The Initial Developer of the Original Code is
- The Mozilla Foundation.
- Portions created by the Initial Developer are Copyright (C) 2010
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Ben Turner <bent.mozilla@gmail.com>
-
- Alternatively, the contents of this file may be used under the terms of
- either the GNU General Public License Version 2 or later (the "GPL"), or
- the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- in which case the provisions of the GPL or the LGPL are applicable instead
- of those above. If you wish to allow use of your version of this file only
- under the terms of either the GPL or the LGPL, and not to allow others to
- use your version of this file under the terms of the MPL, indicate your
- decision by deleting the provisions above and replace them with the notice
- and other provisions required by the LGPL or the GPL. If you do not delete
- the provisions above, a recipient may use your version of this file under
- the terms of any one of the MPL, the GPL or the LGPL.
-
- ***** END LICENSE BLOCK ***** -->
<window title="DOM Worker Threads Test"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="test();">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript">
<![CDATA[
function test()
{
SimpleTest.waitForExplicitFinish();
var worker = new ChromeWorker("chromeWorker_worker.js");
worker.onmessage = function(event) {
is(event.data, "Done!", "Wrong message!");
SimpleTest.finish();
}
worker.onerror = function(event) {
ok(false, "Worker had an error: " + event.message);
worker.terminate();
SimpleTest.finish();
}
}
]]>
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<p id="display"></p>
<div id="content" style="display:none;"></div>
<pre id="test"></pre>
</body>
<label id="test-result"/>
</window>

Просмотреть файл

@ -41,7 +41,7 @@ HTML_TAG("applet", "SharedObject")
HTML_TAG("area", "Area")
HTML_TAG("b", "Span")
HTML_TAG("base", "Shared")
HTML_TAG("basefont", "Shared")
HTML_TAG("basefont", "Span")
HTML_TAG("bdo", "Span")
HTML_TAG("bgsound", "Span")
HTML_TAG("big", "Span")

Просмотреть файл

@ -59,7 +59,6 @@ _TEST_FILES_A = \
test_area02.html \
test_area03.html \
test_area04.html \
test_basefont01.html \
test_body01.html \
test_button01.html \
test_button02.html \
@ -96,9 +95,6 @@ _TEST_FILES_A = \
test_HTMLAreaElement08.html \
test_HTMLBaseElement01.html \
test_HTMLBaseElement02.html \
test_HTMLBaseFontElement01.html \
test_HTMLBaseFontElement02.html \
test_HTMLBaseFontElement03.html \
test_HTMLBodyElement01.html \
test_HTMLBodyElement02.html \
test_HTMLBodyElement03.html \
@ -339,7 +335,6 @@ _TEST_FILES_C = \
test_HTMLFrameElement09.html \
test_HTMLFrameSetElement01.html \
test_HTMLFrameSetElement02.html \
test_HTMLHeadElement01.html \
test_HTMLHeadingElement01.html \
test_HTMLHeadingElement02.html \
test_HTMLHeadingElement03.html \

Просмотреть файл

@ -70,9 +70,6 @@ _TEST_FILES = \
base2.html \
base2.xhtml \
base2.xml \
basefont.html \
basefont.xhtml \
basefont.xml \
body.html \
body.xhtml \
body.xml \
@ -124,9 +121,6 @@ _TEST_FILES = \
frameset.html \
frameset.xhtml \
frameset.xml \
head.html \
head.xhtml \
head.xml \
heading.html \
heading.xhtml \
heading.xml \

Просмотреть файл

@ -1,12 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
<TITLE>NIST DOM HTML Test - BaseFont</TITLE>
</HEAD>
<BODY onload="parent.loadComplete()">
<P>
<BASEFONT COLOR="#000000" FACE="arial,helvitica" SIZE="4">
</P>
</BODY>
</HTML>

Просмотреть файл

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>NIST DOM HTML Test - BaseFont</title>
</head>
<body onload="parent.loadComplete()">
<p>
<basefont color="#000000" face="arial,helvitica" size="4"/>
</p>
</body>
</html>

Просмотреть файл

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"xhtml1-transitional.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>NIST DOM HTML Test - BaseFont</title>
</head>
<body onload="parent.loadComplete()">
<p>
<basefont color="#000000" face="arial,helvitica" size="4"/>
</p>
</body>
</html>

Просмотреть файл

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<HTML>
<HEAD PROFILE="http://xw2k.sdct.itl.nist.gov/brady/dom/files/profile">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8">
<TITLE>NIST DOM HTML Test - HEAD</TITLE>
</HEAD>
<BODY onload="parent.loadComplete()">
<P>Hello, World.</P>
</BODY>
</HTML>

Просмотреть файл

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head profile="http://xw2k.sdct.itl.nist.gov/brady/dom/files/profile">
<title>NIST DOM HTML Test - HEAD</title>
</head>
<body onload="parent.loadComplete()">
<p>Hello, World.</p>
</body>
</html>

Просмотреть файл

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"xhtml1-strict.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head profile="http://xw2k.sdct.itl.nist.gov/brady/dom/files/profile">
<title>NIST DOM HTML Test - HEAD</title>
</head>
<body onload="parent.loadComplete()">
<p>Hello, World.</p>
</body>
</html>

Просмотреть файл

@ -32,9 +32,6 @@
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="base2.html">base2.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">544 </td><td>NIST DOM HTML Test - Base2</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base2.xhtml">base2.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="base2.xml">base2.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">542 </td></tr>
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="basefont.html">basefont.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">321 </td><td>NIST DOM HTML Test - BaseFont</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="basefont.xhtml">basefont.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">362 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="basefont.xml">basefont.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">362 </td></tr>
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="body.html">body.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">379 </td><td>NIST DOM HTML Test - Body</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="body.xhtml">body.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">476 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="body.xml">body.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">476 </td></tr>
@ -86,9 +83,6 @@
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="frameset.html">frameset.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">403 </td><td>NIST DOM HTML Test - FRAMESET</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frameset.xhtml">frameset.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">402 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="frameset.xml">frameset.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">402 </td></tr>
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="head.html">head.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">322 </td><td>NIST DOM HTML Test - HEAD</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="head.xhtml">head.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">363 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="head.xml">head.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">363 </td></tr>
<tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]" width="20" height="22" /></td><td><a href="heading.html">heading.html</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">483 </td><td>NIST DOM HTML Test - HEADING</td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="heading.xhtml">heading.xhtml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">521 </td></tr>
<tr><td valign="top"><img src="/icons/unknown.gif" alt="[ ]" width="20" height="22" /></td><td><a href="heading.xml">heading.xml</a></td><td align="right">05-Apr-2004 14:39 </td><td align="right">521 </td></tr>

Просмотреть файл

@ -1,133 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement01</title>
<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/MochiKit/packed.js" type="text/javascript"></script><script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script><script src="DOMTestCase.js" type="text/javascript"></script><script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['HTMLBaseFontElement01'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "basefont");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
SimpleTest.finish();
}
}
/**
*
The color attribute specifies the base font's color.
Retrieve the color attribute and examine its value.
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302
*/
function HTMLBaseFontElement01() {
var success;
if(checkInitialization(builder, "HTMLBaseFontElement01") != null) return;
var nodeList;
var testNode;
var vcolor;
var doc;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "basefont");
nodeList = doc.getElementsByTagName("basefont");
assertSize("Asize",1,nodeList);
testNode = nodeList.item(0);
vcolor = testNode.color;
assertEquals("colorLink","#000000",vcolor);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement01</h2>
<p>&lt;test name='HTMLBaseFontElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBaseFontElement01&lt;/title&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
The color attribute specifies the base font's color.
Retrieve the color attribute and examine its value.
&lt;/description&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302</a>'/&gt;
<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='basefont' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"basefont"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;color interface='HTMLBaseFontElement' obj='testNode' var='vcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolor' expected='"#000000"' <a id="colorLink">id='colorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
</p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University). All
Rights Reserved. This program is distributed under the W3C's Software
Intellectual Property License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
</p>
<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
for more details.</p>
<iframe name="doc" src="files/basefont.html"></iframe>
<br>
</body>
</html>

Просмотреть файл

@ -1,133 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement02</title>
<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/MochiKit/packed.js" type="text/javascript"></script><script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script><script src="DOMTestCase.js" type="text/javascript"></script><script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['HTMLBaseFontElement02'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "basefont");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
SimpleTest.finish();
}
}
/**
*
The face attribute specifies the base font's face identifier.
Retrieve the face attribute and examine its value.
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88128969
*/
function HTMLBaseFontElement02() {
var success;
if(checkInitialization(builder, "HTMLBaseFontElement02") != null) return;
var nodeList;
var testNode;
var vface;
var doc;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "basefont");
nodeList = doc.getElementsByTagName("basefont");
assertSize("Asize",1,nodeList);
testNode = nodeList.item(0);
vface = testNode.face;
assertEquals("faceLink","arial,helvitica",vface);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement02</h2>
<p>&lt;test name='HTMLBaseFontElement02' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBaseFontElement02&lt;/title&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
The face attribute specifies the base font's face identifier.
Retrieve the face attribute and examine its value.
&lt;/description&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88128969">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-88128969</a>'/&gt;
<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vface' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='basefont' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"basefont"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;face interface='HTMLBaseFontElement' obj='testNode' var='vface'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vface' expected='"arial,helvitica"' <a id="faceLink">id='faceLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
</p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University). All
Rights Reserved. This program is distributed under the W3C's Software
Intellectual Property License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
</p>
<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
for more details.</p>
<iframe name="doc" src="files/basefont.html"></iframe>
<br>
</body>
</html>

Просмотреть файл

@ -1,133 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement03</title>
<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/MochiKit/packed.js" type="text/javascript"></script><script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script><script src="DOMTestCase.js" type="text/javascript"></script><script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['HTMLBaseFontElement03'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "basefont");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
SimpleTest.finish();
}
}
/**
*
The size attribute specifies the base font's size.
Retrieve the size attribute and examine it's value.
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38930424
*/
function HTMLBaseFontElement03() {
var success;
if(checkInitialization(builder, "HTMLBaseFontElement03") != null) return;
var nodeList;
var testNode;
var vsize;
var doc;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "basefont");
nodeList = doc.getElementsByTagName("basefont");
assertSize("Asize",1,nodeList);
testNode = nodeList.item(0);
vsize = testNode.size;
assertEquals("sizeLink",4,vsize);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBaseFontElement03</h2>
<p>&lt;test name='HTMLBaseFontElement03' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-2 dom2.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLBaseFontElement03&lt;/title&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
The size attribute specifies the base font's size.
Retrieve the size attribute and examine it's value.
&lt;/description&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2001-12-03&lt;/date&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38930424">http://www.w3.org/TR/DOM-Level-2-HTML/html#ID-38930424</a>'/&gt;
<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vsize' type='int'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='basefont' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"basefont"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size interface='HTMLBaseFontElement' obj='testNode' var='vsize'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vsize' expected='4' <a id="sizeLink">id='sizeLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
</p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University). All
Rights Reserved. This program is distributed under the W3C's Software
Intellectual Property License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
</p>
<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
for more details.</p>
<iframe name="doc" src="files/basefont.html"></iframe>
<br>
</body>
</html>

Просмотреть файл

@ -1,133 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadElement01</title>
<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/MochiKit/packed.js" type="text/javascript"></script><script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script><script src="DOMTestCase.js" type="text/javascript"></script><script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['HTMLHeadElement01'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "head");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
SimpleTest.finish();
}
}
/**
*
The profile attribute specifies a URI designating a metadata profile.
Retrieve the profile attribute and examine its value.
* @author NIST
* @author Mary Brady
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96921909
*/
function HTMLHeadElement01() {
var success;
if(checkInitialization(builder, "HTMLHeadElement01") != null) return;
var nodeList;
var testNode;
var vprofile;
var doc;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "head");
nodeList = doc.getElementsByTagName("head");
assertSize("Asize",1,nodeList);
testNode = nodeList.item(0);
vprofile = testNode.profile;
assertURIEquals("profileLink",null,null,null,"profile",null,null,null,null,vprofile);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLHeadElement01</h2>
<p>&lt;test name='HTMLHeadElement01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;HTMLHeadElement01&lt;/title&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;NIST&lt;/creator&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
The profile attribute specifies a URI designating a metadata profile.
Retrieve the profile attribute and examine its value.
&lt;/description&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Mary Brady&lt;/contributor&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-22&lt;/date&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96921909">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-96921909</a>'/&gt;
<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vprofile' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Document'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='head' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"head"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;profile interface='HTMLHeadElement' obj='testNode' var='vprofile'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertURIEquals actual='vprofile' file='"profile"' <a id="profileLink">id='profileLink'</a>/&gt;<br>&lt;/test&gt;<br>
</p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University). All
Rights Reserved. This program is distributed under the W3C's Software
Intellectual Property License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
</p>
<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
for more details.</p>
<iframe name="doc" src="files/head.html"></iframe>
<br>
</body>
</html>

Просмотреть файл

@ -47,9 +47,6 @@ function suite() {
newsuite.addTestPage("../level2/html/HTMLBRElement01.html");
newsuite.addTestPage("../level2/html/HTMLBaseElement01.html");
newsuite.addTestPage("../level2/html/HTMLBaseElement02.html");
newsuite.addTestPage("../level2/html/HTMLBaseFontElement01.html");
newsuite.addTestPage("../level2/html/HTMLBaseFontElement02.html");
newsuite.addTestPage("../level2/html/HTMLBaseFontElement03.html");
newsuite.addTestPage("../level2/html/HTMLBodyElement01.html");
newsuite.addTestPage("../level2/html/HTMLBodyElement02.html");
newsuite.addTestPage("../level2/html/HTMLBodyElement03.html");
@ -614,7 +611,6 @@ function suite() {
newsuite.addTestPage("../level2/html/area02.html");
newsuite.addTestPage("../level2/html/area03.html");
newsuite.addTestPage("../level2/html/area04.html");
newsuite.addTestPage("../level2/html/basefont01.html");
newsuite.addTestPage("../level2/html/body01.html");
newsuite.addTestPage("../level2/html/button01.html");
newsuite.addTestPage("../level2/html/button02.html");
@ -759,11 +755,6 @@ function suite() {
<option value="basefont01.html">basefont01</option>
<option value="body01.html">body01</option>
@ -994,16 +985,6 @@ function suite() {
<option value="HTMLBaseFontElement01.html">HTMLBaseFontElement01</option>
<option value="HTMLBaseFontElement02.html">HTMLBaseFontElement02</option>
<option value="HTMLBodyElement01.html">HTMLBodyElement01</option>
@ -3836,7 +3817,6 @@ function suite() {
<option value="hasFeature06.html">hasFeature06</option>
<option value="HTMLAppletElement07.html">HTMLAppletElement07</option>
<option value="HTMLAppletElement09.html">HTMLAppletElement09</option>
<option value="HTMLBaseFontElement03.html">HTMLBaseFontElement03</option>
<option value="HTMLBodyElement07.html">HTMLBodyElement07</option>
<option value="HTMLBodyElement08.html">HTMLBodyElement08</option>
<option value="HTMLBodyElement09.html">HTMLBodyElement09</option>

Просмотреть файл

@ -1,129 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>http://www.w3.org/2001/DOM-Test-Suite/level2/html/basefont01</title>
<link type="text/css" rel="stylesheet" href="/tests/SimpleTest/test.css">
<script src="/MochiKit/packed.js" type="text/javascript"></script><script src="/tests/SimpleTest/SimpleTest.js" type="text/javascript"></script><script src="DOMTestCase.js" type="text/javascript"></script><script type="text/javascript">
// expose test function names
function exposeTestFunctionNames()
{
return ['basefont01'];
}
var docsLoaded = -1000000;
var builder = null;
//
// This function is called by the testing framework before
// running the test suite.
//
// If there are no configuration exceptions, asynchronous
// document loading is started. Otherwise, the status
// is set to complete and the exception is immediately
// raised when entering the body of the test.
//
function setUpPage() {
setUpPageStatus = 'running';
try {
//
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
docsLoaded = 0;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
docsLoaded += preload(docRef, "doc", "basefont");
if (docsLoaded == 1) {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
//
// This method is called on the completion of
// each asychronous load started in setUpTests.
//
// When every synchronous loaded document has completed,
// the page status is changed which allows the
// body of the test to be executed.
function loadComplete() {
if (++docsLoaded == 1) {
setUpPageStatus = 'complete';
runJSUnitTests();
SimpleTest.finish();
}
}
/**
*
The value of attribute color of the basefont element is read and checked against the expected value.
* @author Netscape
* @author Sivakiran Tummala
* @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302
*/
function basefont01() {
var success;
if(checkInitialization(builder, "basefont01") != null) return;
var nodeList;
var testNode;
var vcolor;
var doc;
var docRef = null;
if (typeof(this.doc) != 'undefined') {
docRef = this.doc;
}
doc = load(docRef, "doc", "basefont");
nodeList = doc.getElementsByTagName("basefont");
assertSize("Asize",1,nodeList);
testNode = nodeList.item(0);
vcolor = testNode.color;
assertEquals("colorLink","#000000",vcolor);
}
</script>
</head>
<body>
<h2>Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/basefont01</h2>
<p>&lt;test name='basefont01' schemaLocation='http://www.w3.org/2001/DOM-Test-Suite/Level-1 dom1.xsd'&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;title&gt;basefont01&lt;/title&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;creator&gt;Netscape&lt;/creator&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;description&gt;
The value of attribute color of the basefont element is read and checked against the expected value.
&lt;/description&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;contributor&gt;Sivakiran Tummala&lt;/contributor&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;date qualifier='created'&gt;2002-02-08&lt;/date&gt;
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;subject resource='<a href="http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302">http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-html#ID-87502302</a>'/&gt;
<br>&lt;/metadata&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='nodeList' type='NodeList'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='testNode' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='vcolor' type='DOMString'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;var name='doc' type='Node'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;load var='doc' href='basefont' willBeModified='false'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;getElementsByTagName interface='Document' obj='doc' var='nodeList' tagname='"basefont"'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertSize collection='nodeList' size='1' <a id="Asize">id='Asize'</a>/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;item interface='NodeList' obj='nodeList' var='testNode' index='0'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;color interface='HTMLBaseFontElement' obj='testNode' var='vcolor'/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;assertEquals actual='vcolor' expected='"#000000"' <a id="colorLink">id='colorLink'</a> ignoreCase='false'/&gt;<br>&lt;/test&gt;<br>
</p>
<p>
Copyright (c) 2001-2004 World Wide Web Consortium,
(Massachusetts Institute of Technology, Institut National de
Recherche en Informatique et en Automatique, Keio University). All
Rights Reserved. This program is distributed under the W3C's Software
Intellectual Property License. This program is distributed in the
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
</p>
<p>See W3C License <a href="http://www.w3.org/Consortium/Legal/">http://www.w3.org/Consortium/Legal/</a>
for more details.</p>
<iframe name="doc" src="files/basefont.html"></iframe>
<br>
</body>
</html>

Просмотреть файл

@ -76,6 +76,7 @@ include $(topsrcdir)/config/rules.mk
LIBS += $(XPCOM_STANDALONE_GLUE_LDOPTS)
DEFINES += -DXPCOM_GLUE
STL_FLAGS =
CXXFLAGS += $(MOZ_GTK2_CFLAGS)

Просмотреть файл

@ -944,7 +944,7 @@ nsFind::Find(const PRUnichar *aPatText, nsIDOMRange* aSearchRange,
ToLowerCase(patAutoStr);
// Ignore soft hyphens in the pattern
static const char kShy[] = { CH_SHY, 0 };
static const char kShy[] = { char(CH_SHY), 0 };
patAutoStr.StripChars(kShy);
const PRUnichar* patStr = patAutoStr.get();

Просмотреть файл

@ -55,11 +55,20 @@ CPPSRCS = \
gfxBlur.cpp \
$(NULL)
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
CMMSRCS += \
nsCoreAnimationSupport.mm \
$(NULL)
OS_LIBS += -framework OpenGL -framework QuartzCore
endif
EXTRA_DSO_LIBS = gkgfx thebes
EXPORTS += \
gfxThebesUtils.h \
gfxBlur.h \
nsCoreAnimationSupport.h \
$(NULL)
EXTRA_DSO_LDOPTS += \

Просмотреть файл

@ -0,0 +1,113 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// vim:set ts=2 sts=2 sw=2 et cin:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* bgirard <b56girard@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsCoreAnimationSupport_h__
#define nsCoreAnimationSupport_h__
#ifdef XP_MACOSX
#import "ApplicationServices/ApplicationServices.h"
#include "nscore.h"
#include "gfxTypes.h"
// Get the system color space.
CGColorSpaceRef CreateSystemColorSpace();
// Manages a CARenderer
struct _CGLPBufferObject;
struct _CGLContextObject;
class nsIOSurface;
class THEBES_API nsCARenderer {
public:
nsCARenderer() : mCARenderer(nsnull), mPixelBuffer(nsnull), mOpenGLContext(nsnull),
mCGImage(nsnull), mCGData(nsnull), mIOSurface(nsnull), mFBO(nsnull),
mIOTexture(nsnull) {}
~nsCARenderer();
nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight);
nsresult Render(int aWidth, int aHeight, CGImageRef *aOutCAImage);
bool isInit() { return mCARenderer != nsnull; }
/*
* Render the CALayer to an IOSurface. If no IOSurface
* is attached then an internal pixel buffer will be
* used.
*/
void AttachIOSurface(nsIOSurface *aSurface);
static nsresult DrawSurfaceToCGContext(CGContextRef aContext,
nsIOSurface *surf,
CGColorSpaceRef aColorSpace,
int aX, int aY,
int aWidth, int aHeight);
private:
void Destroy();
void *mCARenderer;
_CGLPBufferObject *mPixelBuffer;
_CGLContextObject *mOpenGLContext;
CGImageRef mCGImage;
void *mCGData;
nsIOSurface *mIOSurface;
uint32_t mFBO;
uint32_t mIOTexture;
};
typedef uint32_t IOSurfaceID;
class nsIOSurface {
public:
static nsIOSurface *CreateIOSurface(int aWidth, int aHeight);
static void ReleaseIOSurface(nsIOSurface *aIOSurface);
static nsIOSurface *LookupSurface(IOSurfaceID aSurfaceID);
nsIOSurface(CFTypeRef aIOSurfacePtr) : mIOSurfacePtr(aIOSurfacePtr) {}
~nsIOSurface() { CFRelease(mIOSurfacePtr); }
IOSurfaceID GetIOSurfaceID();
void *GetBaseAddress();
size_t GetWidth();
size_t GetHeight();
size_t GetBytesPerRow();
void Lock();
void Unlock();
private:
friend class nsCARenderer;
CFTypeRef mIOSurfacePtr;
};
#endif // XP_MACOSX
#endif // nsCoreAnimationSupport_h__

Просмотреть файл

@ -0,0 +1,722 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
// vim:set ts=2 sts=2 sw=2 et cin:
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla.org code.
*
* The Initial Developer of the Original Code is
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Benoit Girard <b56girard@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCoreAnimationSupport.h"
#include "nsDebug.h"
#import <QuartzCore/QuartzCore.h>
#include <dlfcn.h>
#define IOSURFACE_FRAMEWORK_PATH \
"/System/Library/Frameworks/IOSurface.framework/IOSurface"
#define OPENGL_FRAMEWORK_PATH \
"/System/Library/Frameworks/OpenGL.framework/OpenGL"
// IOSurface signatures
typedef CFTypeRef IOSurfacePtr;
typedef IOSurfacePtr (*IOSurfaceCreateFunc) (CFDictionaryRef properties);
typedef IOSurfacePtr (*IOSurfaceLookupFunc) (uint32_t io_surface_id);
typedef IOSurfaceID (*IOSurfaceGetIDFunc) (CFTypeRef io_surface);
typedef IOReturn (*IOSurfaceLockFunc) (CFTypeRef io_surface,
uint32_t options,
uint32_t *seed);
typedef IOReturn (*IOSurfaceUnlockFunc) (CFTypeRef io_surface,
uint32_t options,
uint32_t *seed);
typedef void* (*IOSurfaceGetBaseAddressFunc) (CFTypeRef io_surface);
typedef size_t (*IOSurfaceGetWidthFunc) (IOSurfacePtr io_surface);
typedef size_t (*IOSurfaceGetHeightFunc) (IOSurfacePtr io_surface);
typedef size_t (*IOSurfaceGetBytesPerRowFunc) (IOSurfacePtr io_surface);
typedef CGLError (*CGLTexImageIOSurface2DFunc) (CGLContextObj ctxt,
GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
IOSurfacePtr ioSurface, GLuint plane);
#define GET_CONST(const_name) \
((CFStringRef*) dlsym(sIOSurfaceFramework, const_name))
#define GET_IOSYM(dest,sym_name) \
(typeof(dest)) dlsym(sIOSurfaceFramework, sym_name)
#define GET_CGLSYM(dest,sym_name) \
(typeof(dest)) dlsym(sOpenGLFramework, sym_name)
class nsIOSurfaceLib: public nsIOSurface {
public:
static void *sIOSurfaceFramework;
static void *sOpenGLFramework;
static bool isLoaded;
static IOSurfaceCreateFunc sCreate;
static IOSurfaceGetIDFunc sGetID;
static IOSurfaceLookupFunc sLookup;
static IOSurfaceGetBaseAddressFunc sGetBaseAddress;
static IOSurfaceLockFunc sLock;
static IOSurfaceUnlockFunc sUnlock;
static IOSurfaceGetWidthFunc sWidth;
static IOSurfaceGetHeightFunc sHeight;
static IOSurfaceGetBytesPerRowFunc sBytesPerRow;
static CGLTexImageIOSurface2DFunc sTexImage;
static CFStringRef kPropWidth;
static CFStringRef kPropHeight;
static CFStringRef kPropBytesPerElem;
static CFStringRef kPropBytesPerRow;
static CFStringRef kPropIsGlobal;
static bool isInit();
static CFStringRef GetIOConst(const char* symbole);
static IOSurfacePtr IOSurfaceCreate(CFDictionaryRef properties);
static IOSurfacePtr IOSurfaceLookup(IOSurfaceID aIOSurfaceID);
static IOSurfaceID IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr);
static void *IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr);
static size_t IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr);
static size_t IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr);
static size_t IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr);
static IOReturn IOSurfaceLock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed);
static IOReturn IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed);
static CGLError CGLTexImageIOSurface2D(CGLContextObj ctxt,
GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
IOSurfacePtr ioSurface, GLuint plane);
static void LoadLibrary();
static void CloseLibrary();
// Static deconstructor
static class LibraryUnloader {
public:
~LibraryUnloader() {
CloseLibrary();
}
} sLibraryUnloader;
};
nsIOSurfaceLib::LibraryUnloader nsIOSurfaceLib::sLibraryUnloader;
bool nsIOSurfaceLib::isLoaded = false;
void* nsIOSurfaceLib::sIOSurfaceFramework;
void* nsIOSurfaceLib::sOpenGLFramework;
IOSurfaceCreateFunc nsIOSurfaceLib::sCreate;
IOSurfaceGetIDFunc nsIOSurfaceLib::sGetID;
IOSurfaceLookupFunc nsIOSurfaceLib::sLookup;
IOSurfaceGetBaseAddressFunc nsIOSurfaceLib::sGetBaseAddress;
IOSurfaceGetHeightFunc nsIOSurfaceLib::sWidth;
IOSurfaceGetWidthFunc nsIOSurfaceLib::sHeight;
IOSurfaceGetBytesPerRowFunc nsIOSurfaceLib::sBytesPerRow;
IOSurfaceLockFunc nsIOSurfaceLib::sLock;
IOSurfaceUnlockFunc nsIOSurfaceLib::sUnlock;
CGLTexImageIOSurface2DFunc nsIOSurfaceLib::sTexImage;
CFStringRef nsIOSurfaceLib::kPropWidth;
CFStringRef nsIOSurfaceLib::kPropHeight;
CFStringRef nsIOSurfaceLib::kPropBytesPerElem;
CFStringRef nsIOSurfaceLib::kPropBytesPerRow;
CFStringRef nsIOSurfaceLib::kPropIsGlobal;
bool nsIOSurfaceLib::isInit() {
// Guard against trying to reload the library
// if it is not available.
if (!isLoaded)
LoadLibrary();
if (!sIOSurfaceFramework) {
NS_ERROR("nsIOSurfaceLib failed to initialize");
}
return sIOSurfaceFramework;
}
IOSurfacePtr nsIOSurfaceLib::IOSurfaceCreate(CFDictionaryRef properties) {
return sCreate(properties);
}
IOSurfacePtr nsIOSurfaceLib::IOSurfaceLookup(IOSurfaceID aIOSurfaceID) {
return sLookup(aIOSurfaceID);
}
IOSurfaceID nsIOSurfaceLib::IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr) {
return sGetID(aIOSurfacePtr);
}
void* nsIOSurfaceLib::IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr) {
return sGetBaseAddress(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr) {
return sWidth(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr) {
return sHeight(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr) {
return sBytesPerRow(aIOSurfacePtr);
}
IOReturn nsIOSurfaceLib::IOSurfaceLock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed) {
return sLock(aIOSurfacePtr, options, seed);
}
IOReturn nsIOSurfaceLib::IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed) {
return sUnlock(aIOSurfacePtr, options, seed);
}
CGLError nsIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt,
GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
IOSurfacePtr ioSurface, GLuint plane) {
return sTexImage(ctxt, target, internalFormat, width, height,
format, type, ioSurface, plane);
}
CFStringRef nsIOSurfaceLib::GetIOConst(const char* symbole) {
CFStringRef *address = (CFStringRef*)dlsym(sIOSurfaceFramework, symbole);
if (!address)
return nsnull;
return *address;
}
void nsIOSurfaceLib::LoadLibrary() {
if (isLoaded) {
return;
}
isLoaded = true;
sIOSurfaceFramework = dlopen(IOSURFACE_FRAMEWORK_PATH,
RTLD_LAZY | RTLD_LOCAL);
sOpenGLFramework = dlopen(OPENGL_FRAMEWORK_PATH,
RTLD_LAZY | RTLD_LOCAL);
if (!sIOSurfaceFramework) {
return;
}
if (!sOpenGLFramework) {
dlclose(sIOSurfaceFramework);
sIOSurfaceFramework = nsnull;
return;
}
kPropWidth = GetIOConst("kIOSurfaceWidth");
kPropHeight = GetIOConst("kIOSurfaceHeight");
kPropBytesPerElem = GetIOConst("kIOSurfaceBytesPerElement");
kPropBytesPerRow = GetIOConst("kIOSurfaceBytesPerRow");
kPropIsGlobal = GetIOConst("kIOSurfaceIsGlobal");
sCreate = GET_IOSYM(sCreate, "IOSurfaceCreate");
sGetID = GET_IOSYM(sGetID, "IOSurfaceGetID");
sWidth = GET_IOSYM(sWidth, "IOSurfaceGetWidth");
sHeight = GET_IOSYM(sHeight, "IOSurfaceGetHeight");
sBytesPerRow = GET_IOSYM(sBytesPerRow, "IOSurfaceGetBytesPerRow");
sLookup = GET_IOSYM(sLookup, "IOSurfaceLookup");
sLock = GET_IOSYM(sLock, "IOSurfaceLock");
sUnlock = GET_IOSYM(sUnlock, "IOSurfaceUnlock");
sGetBaseAddress = GET_IOSYM(sGetBaseAddress, "IOSurfaceGetBaseAddress");
sTexImage = GET_CGLSYM(sTexImage, "CGLTexImageIOSurface2D");
if (!sCreate || !sGetID || !sLookup || !sTexImage || !sGetBaseAddress ||
!kPropWidth || !kPropHeight || !kPropBytesPerElem || !kPropIsGlobal ||
!sLock || !sUnlock || !sWidth || !sHeight || !kPropBytesPerRow ||
!sBytesPerRow) {
CloseLibrary();
}
}
void nsIOSurfaceLib::CloseLibrary() {
if (sIOSurfaceFramework) {
dlclose(sIOSurfaceFramework);
}
if (sOpenGLFramework) {
dlclose(sOpenGLFramework);
}
sIOSurfaceFramework = nsnull;
sOpenGLFramework = nsnull;
}
nsIOSurface* nsIOSurface::CreateIOSurface(int aWidth, int aHeight) {
if (!nsIOSurfaceLib::isInit())
return nsnull;
CFMutableDictionaryRef props = ::CFDictionaryCreateMutable(
kCFAllocatorDefault, 4,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
if (!props)
return nsnull;
int32_t bytesPerElem = 4;
CFNumberRef cfWidth = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aWidth);
CFNumberRef cfHeight = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aHeight);
CFNumberRef cfBytesPerElem = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &bytesPerElem);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropWidth,
cfWidth);
::CFRelease(cfWidth);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropHeight,
cfHeight);
::CFRelease(cfHeight);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropBytesPerElem,
cfBytesPerElem);
::CFRelease(cfBytesPerElem);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropIsGlobal,
kCFBooleanTrue);
IOSurfacePtr surfaceRef = nsIOSurfaceLib::IOSurfaceCreate(props);
::CFRelease(props);
if (!surfaceRef)
return nsnull;
nsIOSurface* ioSurface = new nsIOSurface(surfaceRef);
if (!ioSurface) {
::CFRelease(surfaceRef);
return nsnull;
}
return ioSurface;
}
nsIOSurface* nsIOSurface::LookupSurface(IOSurfaceID aIOSurfaceID) {
if (!nsIOSurfaceLib::isInit())
return nsnull;
IOSurfacePtr surfaceRef = nsIOSurfaceLib::IOSurfaceLookup(aIOSurfaceID);
if (!surfaceRef)
return nsnull;
// IOSurfaceLookup does not retain the object for us,
// we want IOSurfacePtr to remain for the lifetime of
// nsIOSurface.
CFRetain(surfaceRef);
nsIOSurface* ioSurface = new nsIOSurface(surfaceRef);
if (!ioSurface) {
::CFRelease(ioSurface);
return nsnull;
}
return ioSurface;
}
IOSurfaceID nsIOSurface::GetIOSurfaceID() {
return nsIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr);
}
void* nsIOSurface::GetBaseAddress() {
return nsIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr);
}
size_t nsIOSurface::GetWidth() {
return nsIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr);
}
size_t nsIOSurface::GetHeight() {
return nsIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr);
}
size_t nsIOSurface::GetBytesPerRow() {
return nsIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr);
}
#define READ_ONLY 0x1
void nsIOSurface::Lock() {
nsIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, READ_ONLY, NULL);
}
void nsIOSurface::Unlock() {
nsIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, READ_ONLY, NULL);
}
nsCARenderer::~nsCARenderer() {
Destroy();
}
CGColorSpaceRef CreateSystemColorSpace() {
CMProfileRef system_profile = nsnull;
CGColorSpaceRef cspace = nsnull;
if (::CMGetSystemProfile(&system_profile) == noErr) {
// Create a colorspace with the systems profile
cspace = ::CGColorSpaceCreateWithPlatformColorSpace(system_profile);
::CMCloseProfile(system_profile);
} else {
// Default to generic
cspace = ::CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
}
return cspace;
}
void cgdata_release_callback(void *aCGData, const void *data, size_t size) {
if (aCGData) {
free(aCGData);
}
}
void nsCARenderer::Destroy() {
if (mCARenderer) {
CARenderer* caRenderer = (CARenderer*)mCARenderer;
// Bug 556453:
// Explicitly remove the layer from the renderer
// otherwise it does not always happen right away.
caRenderer.layer = nsnull;
[caRenderer release];
}
if (mPixelBuffer) {
::CGLDestroyPBuffer((CGLPBufferObj)mPixelBuffer);
}
if (mOpenGLContext) {
if (mFBO || mIOTexture) {
// Release these resources with the context that allocated them
CGLContextObj oldContext = ::CGLGetCurrentContext();
::CGLSetCurrentContext(mOpenGLContext);
if (mIOTexture) {
::glDeleteTextures(1, &mIOTexture);
}
if (mFBO) {
::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
::glDeleteFramebuffersEXT(1, &mFBO);
}
if (oldContext)
::CGLSetCurrentContext(oldContext);
}
::CGLDestroyContext((CGLContextObj)mOpenGLContext);
}
if (mCGImage) {
::CGImageRelease(mCGImage);
}
if (mIOSurface) {
delete mIOSurface;
}
// mCGData is deallocated by cgdata_release_callback
mCARenderer = nil;
mPixelBuffer = nsnull;
mOpenGLContext = nsnull;
mCGImage = nsnull;
mIOSurface = nsnull;
mFBO = nsnull;
mIOTexture = nsnull;
}
nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight) {
CALayer* layer = (CALayer*)aCALayer;
CARenderer* caRenderer = nsnull;
CGLPixelFormatAttribute attributes[] = {
kCGLPFANoRecovery,
kCGLPFAAccelerated,
kCGLPFAPBuffer,
kCGLPFADepthSize, (CGLPixelFormatAttribute)24,
(CGLPixelFormatAttribute)0
};
if (!mIOSurface) {
CGLError result = ::CGLCreatePBuffer(aWidth, aHeight,
GL_TEXTURE_2D, GL_RGBA, 0, &mPixelBuffer);
if (result != kCGLNoError) {
Destroy();
return NS_ERROR_FAILURE;
}
}
GLint screen;
CGLPixelFormatObj format;
if (::CGLChoosePixelFormat(attributes, &format, &screen) != kCGLNoError) {
Destroy();
return NS_ERROR_FAILURE;
}
if (::CGLCreateContext(format, nsnull, &mOpenGLContext) != kCGLNoError) {
Destroy();
return NS_ERROR_FAILURE;
}
::CGLDestroyPixelFormat(format);
caRenderer = [[CARenderer rendererWithCGLContext:mOpenGLContext
options:nil] retain];
mCARenderer = caRenderer;
if (caRenderer == nil) {
Destroy();
return NS_ERROR_FAILURE;
}
[layer setBounds:CGRectMake(0, 0, aWidth, aHeight)];
[layer setPosition:CGPointMake(aWidth/2.0, aHeight/2.0)];
caRenderer.layer = layer;
caRenderer.bounds = CGRectMake(0, 0, aWidth, aHeight);
if (aWidth == 0 || aHeight == 0) {
// No need to allocate if size is 0
return NS_OK;
}
// We either target rendering to a CGImage or IOSurface.
if (!mIOSurface) {
mCGData = malloc(aWidth*aHeight*4);
if (!mCGData) {
Destroy();
}
memset(mCGData, 0, aWidth*aHeight*4);
CGDataProviderRef dataProvider = nsnull;
dataProvider = ::CGDataProviderCreateWithData(mCGData,
mCGData, aHeight*aWidth*4,
cgdata_release_callback);
if (!dataProvider) {
cgdata_release_callback(mCGData, mCGData, aHeight*aWidth*4);
Destroy();
return NS_ERROR_FAILURE;
}
CGColorSpaceRef colorSpace = CreateSystemColorSpace();
mCGImage = ::CGImageCreate(aWidth, aHeight, 8, 32, aWidth * 4, colorSpace,
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
dataProvider, NULL, true, kCGRenderingIntentDefault);
::CGDataProviderRelease(dataProvider);
if (colorSpace) {
::CGColorSpaceRelease(colorSpace);
}
if (!mCGImage) {
Destroy();
return NS_ERROR_FAILURE;
}
} else {
CGLContextObj oldContext = ::CGLGetCurrentContext();
::CGLSetCurrentContext(mOpenGLContext);
// Create the IOSurface mapped texture.
::glGenTextures(1, &mIOTexture);
::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture);
::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
nsIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
GL_RGBA, aWidth, aHeight,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
mIOSurface->mIOSurfacePtr, 0);
::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0);
// Create the fbo
::glGenFramebuffersEXT(1, &mFBO);
::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFBO);
::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_RECTANGLE_ARB, mIOTexture, 0);
// Make sure that the Framebuffer configuration is supported on the client machine
GLenum fboStatus;
fboStatus = ::glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
if (fboStatus != GL_FRAMEBUFFER_COMPLETE_EXT) {
NS_ERROR("FBO not supported\n");
if (oldContext)
::CGLSetCurrentContext(oldContext);
Destroy();
return NS_ERROR_FAILURE;
}
if (oldContext)
::CGLSetCurrentContext(oldContext);
}
CGLContextObj oldContext = ::CGLGetCurrentContext();
::CGLSetCurrentContext(mOpenGLContext);
::glViewport(0.0, 0.0, aWidth, aHeight);
::glMatrixMode(GL_PROJECTION);
::glLoadIdentity();
::glOrtho (0.0, aWidth, 0.0, aHeight, -1, 1);
// Render upside down to speed up CGContextDrawImage
::glTranslatef(0.0f, aHeight, 0.0);
::glScalef(1.0, -1.0, 1.0);
GLenum result = ::glGetError();
if (result != GL_NO_ERROR) {
NS_ERROR("Unexpected OpenGL Error\n");
Destroy();
if (oldContext)
::CGLSetCurrentContext(oldContext);
return NS_ERROR_FAILURE;
}
if (oldContext)
::CGLSetCurrentContext(oldContext);
return NS_OK;
}
void nsCARenderer::AttachIOSurface(nsIOSurface *aSurface) {
if (mIOSurface &&
aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) {
delete aSurface;
return;
}
if (mCARenderer) {
// We are attaching a larger IOSurface, we need to
// resize our elements.
Destroy();
}
if (mIOSurface)
delete mIOSurface;
mIOSurface = aSurface;
}
nsresult nsCARenderer::Render(int aWidth, int aHeight,
CGImageRef *aOutCGImage) {
if (aOutCGImage && mIOSurface) {
NS_WARNING("CGImageRef should not be passed if we are "
"drawing to an IOSurface");
} else if (aOutCGImage) {
// We are expected to return a CGImageRef, we will set
// it to NULL in case we fail before the image is ready.
*aOutCGImage = NULL;
}
if (aWidth == 0 || aHeight == 0)
return NS_OK;
if (!mCARenderer) {
return NS_ERROR_FAILURE;
}
CARenderer* caRenderer = (CARenderer*)mCARenderer;
int renderer_width = caRenderer.bounds.size.width;
int renderer_height = caRenderer.bounds.size.height;
if (renderer_width != aWidth || renderer_height != aHeight) {
// XXX: This should be optimized to not rescale the buffer
// if we are resizing down.
CALayer* caLayer = [caRenderer layer];
Destroy();
if (SetupRenderer(caLayer, aWidth, aHeight) != NS_OK) {
return NS_ERROR_FAILURE;
}
caRenderer = (CARenderer*)mCARenderer;
}
CGLContextObj oldContext = ::CGLGetCurrentContext();
::CGLSetCurrentContext(mOpenGLContext);
if (!mIOSurface) {
::CGLSetPBuffer(mOpenGLContext, mPixelBuffer, 0, 0, 0);
}
GLenum result = ::glGetError();
if (result != GL_NO_ERROR) {
NS_ERROR("Unexpected OpenGL Error\n");
Destroy();
if (oldContext)
::CGLSetCurrentContext(oldContext);
return NS_ERROR_FAILURE;
}
::glClearColor(0.0, 0.0, 0.0, 0.0);
::glClear(GL_COLOR_BUFFER_BIT);
double caTime = ::CACurrentMediaTime();
[caRenderer beginFrameAtTime:caTime timeStamp:NULL];
[caRenderer addUpdateRect:CGRectMake(0,0, aWidth, aHeight)];
[caRenderer render];
[caRenderer endFrame];
// Read the data back either to the IOSurface or mCGImage.
if (mIOSurface) {
::glFlush();
} else {
::glPixelStorei(GL_PACK_ALIGNMENT, 4);
::glPixelStorei(GL_PACK_ROW_LENGTH, 0);
::glPixelStorei(GL_PACK_SKIP_ROWS, 0);
::glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
::glReadPixels(0.0f, 0.0f, aWidth, aHeight,
GL_BGRA, GL_UNSIGNED_BYTE,
mCGData);
*aOutCGImage = mCGImage;
}
if (oldContext) {
::CGLSetCurrentContext(oldContext);
}
return NS_OK;
}
nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
nsIOSurface *surf,
CGColorSpaceRef aColorSpace,
int aX, int aY,
int aWidth, int aHeight) {
surf->Lock();
size_t bytesPerRow = surf->GetBytesPerRow();
size_t ioWidth = surf->GetWidth();
size_t ioHeight = surf->GetHeight();
void* ioData = surf->GetBaseAddress();
CGDataProviderRef dataProvider = ::CGDataProviderCreateWithData(ioData,
ioData, ioHeight*(bytesPerRow)*4,
NULL); //No release callback
if (!dataProvider) {
surf->Unlock();
return NS_ERROR_FAILURE;
}
CGImageRef cgImage = ::CGImageCreate(ioWidth, ioHeight, 8, 32, bytesPerRow,
aColorSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
dataProvider, NULL, true, kCGRenderingIntentDefault);
::CGDataProviderRelease(dataProvider);
if (!cgImage) {
surf->Unlock();
return NS_ERROR_FAILURE;
}
CGImageRef subImage = ::CGImageCreateWithImageInRect(cgImage,
::CGRectMake(aX, aY, aWidth, aHeight));
if (!subImage) {
::CGImageRelease(cgImage);
surf->Unlock();
return NS_ERROR_FAILURE;
}
::CGContextTranslateCTM(aContext, 0.0f, float(aHeight));
::CGContextScaleCTM(aContext, 1.0f, -1.0f);
::CGContextTranslateCTM(aContext, aX, -aY);
CGContextDrawImage(aContext, CGRectMake(0, 0, aWidth, aHeight), subImage);
::CGImageRelease(subImage);
::CGImageRelease(cgImage);
surf->Unlock();
return NS_OK;
}

Просмотреть файл

@ -41,12 +41,12 @@
#include "gfxColor.h"
#include "gfxASurface.h"
#include "gfxContext.h"
#include "gfxXlibSurface.h"
class QWidget;
class QRect;
/**
* This class lets us take code that draws into an Qt drawable and lets us
* This class lets us take code that draws into an Xlib surface drawable and lets us
* use it to draw into any Thebes context. The user should subclass this class,
* override NativeDraw, and then call Draw(). The drawing will be subjected
* to all Thebes transformations, clipping etc.
@ -61,7 +61,8 @@ public:
* @param numClipRects the number of rects in the array, or zero if
* no clipping is required
*/
virtual nsresult NativeDraw(QWidget * drawable, short offsetX,
virtual nsresult NativeDraw(gfxXlibSurface *xsurf,
Colormap colormap, short offsetX,
short offsetY, QRect * clipRects, PRUint32 numClipRects) = 0;
enum {

Просмотреть файл

@ -35,102 +35,63 @@
*
* ***** END LICENSE BLOCK ***** */
#include <QWidget>
#include <QX11Info>
#include "gfxQtNativeRenderer.h"
#include "gfxContext.h"
#include "gfxQtPlatform.h"
#include "cairo.h"
typedef struct {
gfxQtNativeRenderer* mRenderer;
nsresult mRV;
} NativeRenderingClosure;
static cairo_bool_t
NativeRendering(void *closure,
QWidget * drawable,
short offset_x, short offset_y,
QRect * rectangles, unsigned int num_rects)
{
NativeRenderingClosure* cl = (NativeRenderingClosure*)closure;
nsresult rv = cl->mRenderer->
NativeDraw(drawable, offset_x, offset_y,
rectangles, num_rects);
cl->mRV = rv;
return NS_SUCCEEDED(rv);
}
#include "gfxXlibSurface.h"
nsresult
gfxQtNativeRenderer::Draw(gfxContext* ctx, int width, int height,
PRUint32 flags, DrawOutput* output)
{
NativeRenderingClosure closure = { this, NS_OK };
Display *dpy = QX11Info().display();
PRBool isOpaque = (flags & DRAW_IS_OPAQUE) ? PR_TRUE : PR_FALSE;
int screen = QX11Info().screen();
int depth = QX11Info().depth();
Visual *visual = static_cast<Visual*>(QX11Info().visual());
Colormap colormap = QX11Info().colormap();
PRBool allocColormap = PR_FALSE;
if (output) {
output->mSurface = NULL;
output->mUniformAlpha = PR_FALSE;
output->mUniformColor = PR_FALSE;
}
if (!isOpaque) {
depth = 32;
XVisualInfo vinfo;
int foundVisual = XMatchVisualInfo(dpy, screen,
depth, TrueColor,
&vinfo);
if (!foundVisual)
return NS_ERROR_FAILURE;
#if 0 // FIXME
cairo_gdk_drawing_result_t result;
// Make sure result.surface is null to start with; we rely on it
// being non-null meaning that a surface actually got allocated.
result.surface = NULL;
int cairoFlags = 0;
if (flags & DRAW_SUPPORTS_OFFSET) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_OFFSET;
}
if (flags & DRAW_SUPPORTS_CLIP_RECT) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_CLIP_RECT;
}
if (flags & DRAW_SUPPORTS_CLIP_LIST) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_CLIP_LIST;
}
if (flags & DRAW_SUPPORTS_ALTERNATE_SCREEN) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_ALTERNATE_SCREEN;
}
if (flags & DRAW_SUPPORTS_NONDEFAULT_VISUAL) {
cairoFlags |= CAIRO_GDK_DRAWING_SUPPORTS_NONDEFAULT_VISUAL;
}
cairo_draw_with_gdk(ctx->GetCairo(),
gfxPlatformGtk::GetPlatform()->GetGdkDrawable(ctx->OriginalSurface()),
NativeRendering,
&closure, width, height,
(flags & DRAW_IS_OPAQUE) ? CAIRO_GDK_DRAWING_OPAQUE : CAIRO_GDK_DRAWING_TRANSPARENT,
(cairo_gdk_drawing_support_t)cairoFlags,
output ? &result : NULL);
if (NS_FAILED(closure.mRV)) {
if (result.surface) {
NS_ASSERTION(output, "How did that happen?");
cairo_surface_destroy (result.surface);
if (visual != vinfo.visual) {
allocColormap = PR_TRUE;
visual = vinfo.visual;
colormap = XCreateColormap(dpy,
RootWindow(dpy, screen),
visual, AllocNone);
}
return closure.mRV;
}
if (output) {
if (result.surface) {
output->mSurface = gfxASurface::Wrap(result.surface);
if (!output->mSurface) {
cairo_surface_destroy (result.surface);
return NS_ERROR_OUT_OF_MEMORY;
}
}
nsRefPtr<gfxXlibSurface> xsurf =
new gfxXlibSurface(dpy, visual,
gfxIntSize(width, height),
depth);
output->mUniformAlpha = result.uniform_alpha;
output->mUniformColor = result.uniform_color;
output->mColor = gfxRGBA(result.r, result.g, result.b, result.alpha);
if (!isOpaque) {
nsRefPtr<gfxContext> tempCtx = new gfxContext(xsurf);
tempCtx->SetOperator(gfxContext::OPERATOR_CLEAR);
tempCtx->Paint();
}
#endif
return NS_OK;
nsresult rv = NativeDraw(xsurf.get(), colormap, 0, 0, NULL, 0);
if (!allocColormap)
XFreeColormap(dpy, colormap);
if (NS_FAILED(rv))
return rv;
ctx->SetSource(xsurf);
ctx->Paint();
return rv;
}

Просмотреть файл

@ -51,9 +51,15 @@ EXPORT_LIBRARY = 1
ENABLE_CXX_EXCEPTIONS = 1
ACDEFINES =
ifndef MOZ_NATIVE_LIBEVENT # {
vpath %.c \
$(srcdir)/src/third_party/libevent \
$(NULL)
else # } else {
# message_pump_libevent.cc includes third_party/libevent/event.h,
# which we put in $(DIST), see export rule below
LOCAL_INCLUDES += -I$(DIST)
endif # }
vpath %.cc \
$(srcdir)/src/base \
@ -272,6 +278,8 @@ endif # } OS_LINUX
# libevent
ifndef MOZ_NATIVE_LIBEVENT # {
ifdef OS_POSIX # {
LOCAL_INCLUDES += -I$(srcdir)/src/third_party/libevent
@ -308,4 +316,12 @@ endif # }
endif # }
endif # }
include $(topsrcdir)/config/rules.mk
ifdef MOZ_NATIVE_LIBEVENT # {
export::
mkdir -p $(DIST)/third_party/libevent
echo "#include <event.h>" > $(DIST)/third_party/libevent/event.h
endif # }

Просмотреть файл

@ -120,7 +120,10 @@ bool ChildProcessHost::Send(IPC::Message* msg) {
void ChildProcessHost::Notify(NotificationType type) {
#ifdef CHROMIUM_MOZILLA_BUILD
ChromeThread::GetMessageLoop(ChromeThread::IO)->PostTask(
MessageLoop* loop = ChromeThread::GetMessageLoop(ChromeThread::IO);
if (!loop)
loop = MessageLoop::current();
loop->PostTask(
#else
resource_dispatcher_host_->ui_loop()->PostTask(
#endif

Просмотреть файл

@ -120,8 +120,7 @@ AsyncChannel::Open(Transport* aTransport, MessageLoop* aIOLoop)
if(!aIOLoop) {
// parent
needOpen = false;
aIOLoop = BrowserProcessSubThread
::GetMessageLoop(BrowserProcessSubThread::IO);
aIOLoop = XRE_GetIOMessageLoop();
// FIXME assuming that the parent waits for the OnConnected event.
// FIXME see GeckoChildProcessHost.cpp. bad assumption!
mChannelState = ChannelConnected;

Просмотреть файл

@ -78,8 +78,7 @@ GeckoChildProcessHost::GeckoChildProcessHost(GeckoProcessType aProcessType,
{
MOZ_COUNT_CTOR(GeckoChildProcessHost);
MessageLoop* ioLoop =
BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
ioLoop->PostTask(FROM_HERE,
NewRunnableMethod(this,
&GeckoChildProcessHost::InitializeChannel));
@ -103,8 +102,7 @@ GeckoChildProcessHost::~GeckoChildProcessHost()
bool
GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
{
MessageLoop* ioLoop =
BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
NS_ASSERTION(MessageLoop::current() != ioLoop, "sync launch from the IO thread NYI");
ioLoop->PostTask(FROM_HERE,
@ -125,8 +123,7 @@ GeckoChildProcessHost::SyncLaunch(std::vector<std::string> aExtraOpts)
bool
GeckoChildProcessHost::AsyncLaunch(std::vector<std::string> aExtraOpts)
{
MessageLoop* ioLoop =
BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO);
MessageLoop* ioLoop = XRE_GetIOMessageLoop();
ioLoop->PostTask(FROM_HERE,
NewRunnableMethod(this,
&GeckoChildProcessHost::PerformAsyncLaunch,

Просмотреть файл

@ -65,6 +65,7 @@ MozillaChildThread::Init()
// Silverlight depends on the host calling CoInitialize.
::CoInitialize(NULL);
#endif
// Add notification service here once bug 560630 is fixed
// Certain plugins, such as flash, steal the unhandled exception filter
// thus we never get crash reports when they fault. This call fixes it.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше