Merging cedar with mozilla-central.

This commit is contained in:
Mounir Lamouri 2011-05-27 09:57:51 +02:00
Родитель d5b5b1022e 82bae5057c
Коммит 5dbe0fcb94
369 изменённых файлов: 22589 добавлений и 36150 удалений

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

@ -64,3 +64,5 @@ a71bd564ebf5bf4f93d13e84114f759c263130b0 MOBILE_MERGE_DONE_20110406
a95d426422816513477e5863add1b00ac7041dcb AURORA_BASE_20110412
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R14
9eae975b3d6fb7748fe5a3c0113d449b1c7cc0b2 AURORA_BASE_20110524
138f593553b66c9f815e8f57870c19d6347f7702 UPDATE_PACKAGING_R14
462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R14

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

@ -141,7 +141,7 @@ nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions)
{
NS_ENSURE_ARG_POINTER(aNumActions);
*aNumActions = mActionAcc ? 1 : 0;
*aNumActions = (mIsOnclick || mIsLink) ? 1 : 0;
return NS_OK;
}
@ -228,7 +228,6 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent,
mIsOnclick = PR_FALSE;
if (nsCoreUtils::HasClickListener(mContent)) {
mActionAcc = this;
mIsOnclick = PR_TRUE;
return;
}

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

@ -607,6 +607,12 @@ nsDocAccessible::Init()
if (!mNotificationController)
return PR_FALSE;
// Mark the document accessible as loaded if its DOM document was loaded at
// this point (this can happen because a11y is started late or DOM document
// having no container was loaded.
if (mDocument->GetReadyStateEnum() == nsIDocument::READYSTATE_COMPLETE)
mIsLoaded = PR_TRUE;
AddEventListeners();
return PR_TRUE;
}

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

@ -95,11 +95,9 @@ _TEST_FILES =\
test_descr.html \
test_elm_landmarks.html \
test_elm_listbox.xul \
$(warning test_elm_media.html temporarily disabled) \
test_elm_nsApplicationAcc.html \
test_elm_plugin.html \
test_keys.html \
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
test_nsIAccessible_selects.html \
test_nsIAccessibleDocument.html \
test_nsIAccessibleImage.html \

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

@ -52,6 +52,7 @@ _TEST_FILES =\
test_general.xul \
test_inputs.html \
test_link.html \
test_media.html \
test_tree.xul \
test_treegrid.xul \
$(NULL)

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

@ -36,9 +36,19 @@
ID: "li_clickable3",
actionName: "click",
events: CLICK_EVENTS
},
{
ID: "onclick_img",
actionName: "click",
events: CLICK_EVENTS
}
];
testActions(actionsArray);
getAccessible("onclick_img").takeFocus();
is(getAccessible("link1").numActions, 1, "links should have one action");
is(getAccessible("link2").numActions, 1, "link with onclick handler should have 1 action");
}
SimpleTest.waitForExplicitFinish();
@ -58,6 +68,11 @@
title="Expose click action if mouseup and mousedown are registered">
Mozilla Bug 423409
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=659620"
title="hang when trying to edit a page on wikimo with NVDA running">
Mozilla Bug 659620
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
@ -68,5 +83,11 @@
<li id="li_clickable2" onmousedown="">Clickable list item</li>
<li id="li_clickable3" onmouseup="">Clickable list item</li>
</ul>
<!-- linkable accessibles -->
<img id="onclick_img" onclick="" src="../moz.png">
<a id="link1" href="www">linkable textleaf accessible</a>
<div id="link2" onclick="">linkable textleaf accessible</div>
</body>
</html>

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

@ -13,15 +13,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
src="../common.js"></script>
<script type="application/javascript"
src="events.js"></script>
src="../events.js"></script>
<script type="application/javascript"
src="actions.js"></script>
src="../actions.js"></script>
<script type="application/javascript"
src="role.js"></script>
src="../role.js"></script>
<script type="application/javascript"
src="states.js"></script>
src="../states.js"></script>
<script type="application/javascript">
@ -58,49 +58,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// test the accessible tree
var accTree = {
role: ROLE_GROUPING,
children: [
{ // start/stop button
role: ROLE_PUSHBUTTON,
name: "Play",
states: {
states: STATE_FOCUSABLE
}
},
{ // buffer bar
role: ROLE_PROGRESSBAR
},
{ // progress bar
role: ROLE_PROGRESSBAR
},
{ // slider of progress bar
role: ROLE_SLIDER,
name: "0:00 of 0:01 elapsed",
states: {
states: STATE_FOCUSABLE
}
},
{ // duration label, role="presentation"
role: ROLE_NOTHING
},
{ // mute button
role: ROLE_PUSHBUTTON,
name: "Mute",
states: {
states: STATE_FOCUSABLE
}
}
]
};
testAccessibleTree("audio", accTree);
//////////////////////////////////////////////////////////////////////////
// test actions of audio controls
todo(false, "Focus test are disabled until bug 494175 is fixed.");
var audioElm = getAccessible("audio");
var playBtn = audioElm.firstChild;
var scrubber = playBtn.nextSibling.nextSibling.nextSibling;
@ -112,24 +74,24 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [
new focusChecker(muteBtn),
// new focusChecker(muteBtn),
new nameChecker(muteBtn, "Unmute"),
]
},
{
ID: scrubber,
actionName: "activate",
events: null,
eventSeq: [
new focusChecker(scrubber)
]
},
// {
// ID: scrubber,
// actionName: "activate",
// events: null,
// eventSeq: [
// new focusChecker(scrubber)
// ]
// },
{
ID: playBtn,
actionName: "press",
events: CLICK_EVENTS,
eventSeq: [
new focusChecker(playBtn),
// new focusChecker(playBtn),
new nameChecker(playBtn, "Pause"),
]
}
@ -152,7 +114,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
<pre id="test">
</pre>
<audio id="audio" src="bug461281.ogg"
<audio id="audio" src="../bug461281.ogg"
controls="true"></audio>
<div id="eventDump"></div>

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

@ -30,11 +30,11 @@
var menu1 = document.getElementById("menu_item1");
menu1.open = true;
window.setTimeout(function() {
menu1.addEventListener("popupshown", function() {
var menu2 = document.getElementById("menu_item2");
menu2.open = true;
window.setTimeout(function() {
menu2.addEventListener("popupshown", function() {
testGroupAttrs("menu_item1.1", 1, 1);
testGroupAttrs("menu_item1.2", 1, 3);
testGroupAttrs("menu_item1.4", 2, 3);
@ -42,9 +42,12 @@
testGroupAttrs("menu_item2.1", 1, 2, 1);
testGroupAttrs("menu_item2.2", 2, 2, 1);
menu1.open = false;
menu2.open = false;
SimpleTest.finish();
}, 200);
}, 200);
}, false);
}, false);
//////////////////////////////////////////////////////////////////////////
// xul:tab

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

@ -93,7 +93,7 @@ function addA11yLoadEvent(aFunc)
if (state.value & STATE_BUSY)
return waitForDocLoad();
window.setTimeout(aFunc, 150);
window.setTimeout(aFunc, 0);
},
0
);

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

@ -118,6 +118,25 @@
}
}
function makeIFrameVisible(aID)
{
this.DOMNode = getNode(aID);
this.eventSeq = [
new invokerChecker(EVENT_REORDER, this.DOMNode.parentNode)
];
this.invoke = function makeIFrameVisible_invoke()
{
this.DOMNode.style.visibility = "visible";
}
this.getID = function makeIFrameVisible_getID()
{
return "The accessible for DOM document loaded before it's shown shouldn't have busy state.";
}
}
function openDialogWnd(aURL)
{
// Get application root accessible.
@ -224,7 +243,7 @@
// Debug stuff.
// gA11yEventDumpID = "eventdump";
// gA11yEventDumpToConsole = true;
//gA11yEventDumpToConsole = true;
function doTests()
{
@ -235,12 +254,30 @@
gQueue.push(new morphIFrame("iframe", kHide));
gQueue.push(new morphIFrame("iframe", kShow));
gQueue.push(new morphIFrame("iframe", kRemove));
gQueue.push(new makeIFrameVisible("iframe2"));
gQueue.push(new openDialogWnd("about:"));
gQueue.push(new openWndShutdownDoc());
gQueue.onFinish = doLastCallTests;
gQueue.invoke(); // Will call SimpleTest.finish();
}
function doLastCallTests()
{
//////////////////////////////////////////////////////////////////////////
// makeIFrameVisible() test, part2
// The document shouldn't have busy state (the DOM document was loaded
// before its accessible was created). Do this test lately to make sure
// the content of document accessible was created initially, prior to this
// the document accessible keeps busy state. The initial creation happens
// asynchronously after document creation, there are no events we could
// use to catch it.
var iframeDoc = getAccessible("iframe2").firstChild;
testStates(iframeDoc, 0, 0, STATE_BUSY);
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTests);
</script>
@ -268,6 +305,11 @@
title="Shutdown document accessible when presshell goes away">
Mozilla Bug 571459
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=658185"
title="The DOM document loaded before it's shown shouldn't have busy state">
Mozilla Bug 658185
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
@ -275,6 +317,7 @@
</pre>
<div id="testContainer"><iframe id="iframe"></iframe></div>
<div id="testContainer2"><iframe id="iframe2" src="about:" style="visibility: hidden;"></iframe></div>
<div id="eventdump"></div>
</body>
</html>

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

@ -49,6 +49,7 @@ _TEST_FILES =\
test_aria.html \
test_aria_imgmap.html \
test_aria_tabs.html \
test_comboboxes.xul \
test_doc.html \
test_docarticle.html \
test_editablebody.html \

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

@ -16,9 +16,9 @@
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js" />
<script type="application/javascript"
src="common.js" />
src="../common.js" />
<script type="application/javascript"
src="events.js" />
src="../events.js" />
<script type="application/javascript">
<![CDATA[
@ -64,6 +64,7 @@
//var searchbar = document.getElementById("searchbar");
//gQueue.push(new openHideCombobox(searchbar, true));
//gQueue.push(new openHideCombobox(searchbar, false));
todo(false, "Enable states test for XUL searchbar widget!");
gQueue.invoke(); // Will call SimpleTest.finish();
}

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

@ -30,24 +30,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
role: ROLE_GROUPING,
children: [
{ // start/stop button
role: ROLE_PUSHBUTTON
role: ROLE_PUSHBUTTON,
name: "Play",
children: []
},
{ // buffer bar
role: ROLE_PROGRESSBAR
role: ROLE_PROGRESSBAR,
children: []
},
{ // progress bar
role: ROLE_PROGRESSBAR
role: ROLE_PROGRESSBAR,
children: []
},
{ // slider of progress bar
role: ROLE_SLIDER
role: ROLE_SLIDER,
//name: "0:00 of 0:02 elapsed",
children: []
},
{ // mute button
role: ROLE_PUSHBUTTON
role: ROLE_PUSHBUTTON,
name: "Mute",
children: []
}
]
};
testAccessibleTree("audio", accTree);
todo(false, "Enable name test for slider. Fail on Linux.");
SimpleTest.finish();
}

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

@ -15,6 +15,8 @@
src="../common.js" />
<script type="application/javascript"
src="../role.js" />
<script type="application/javascript"
src="../events.js" />
<script type="application/javascript">
<![CDATA[
@ -108,6 +110,11 @@
]
};
function test_txc7() {
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
// XPFE and Toolkit autocomplete widgets differ.
var txc7 = document.getElementById("txc7");
if ("clearResults" in txc7) {
@ -139,11 +146,14 @@
}
]
}
);
);
test_txc7();
} else {
SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
// Dumb access to trigger popup lazy creation. (See code below.)
// Dumb access to trigger popup lazy creation.
waitForEvent(EVENT_REORDER, txc7, test_txc7);
txc7.popup;
accTree.children.push(
@ -161,17 +171,8 @@
}
]
}
);
);
}
// Delay txc7 test a bit, to let Toolkit popup lazy creation complete.
function test_txc7() {
testAccessibleTree("txc7", accTree);
SimpleTest.finish();
}
// SimpleTest.executeSoon() doesn't help here: use setTimeout() with a little delay.
setTimeout(test_txc7, 25);
}
SimpleTest.waitForExplicitFinish();

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

@ -123,7 +123,7 @@ var stringBundle;
// and targets
let io = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
let source = io.newURI(canvas.toDataURL("image/png", ""), "UTF8", null);
let source = io.newURI(canvas.toDataURL("image/png"), "UTF8", null);
let target = io.newFileURI(file);
// prepare to save the canvas data

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

@ -265,7 +265,7 @@ pref("browser.urlbar.doubleClickSelectsAll", true);
#else
pref("browser.urlbar.doubleClickSelectsAll", false);
#endif
pref("browser.urlbar.autoFill", true);
pref("browser.urlbar.autoFill", false);
// 0: Match anywhere (e.g., middle of words)
// 1: Match on word boundaries and then try matching anywhere
// 2: Match only on word boundaries (e.g., after / or .)

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

@ -48,6 +48,7 @@ let TabView = {
PREF_STARTUP_PAGE: "browser.startup.page",
PREF_RESTORE_ENABLED_ONCE: "browser.panorama.session_restore_enabled_once",
VISIBILITY_IDENTIFIER: "tabview-visibility",
GROUPS_IDENTIFIER: "tabview-groups",
// ----------
get windowTitle() {
@ -95,14 +96,21 @@ let TabView = {
// ___ visibility
let sessionstore =
Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
if (data && data == "true") {
this.show();
} else {
let self = this;
try {
data = sessionstore.getWindowValue(window, this.GROUPS_IDENTIFIER);
if (data) {
let parsedData = JSON.parse(data);
this.updateGroupNumberBroadcaster(parsedData.totalNumber || 0);
}
} catch (e) { }
// if a tab is changed from hidden to unhidden and the iframe is not
let self = this;
// if a tab is changed from hidden to unhidden and the iframe is not
// initialized, load the iframe and setup the tab.
this._tabShowEventListener = function (event) {
if (!self._window)
@ -380,6 +388,14 @@ let TabView = {
document.persist(toolbar.id, "currentset");
},
// ----------
// Function: updateGroupNumberBroadcaster
// Updates the group number broadcaster.
updateGroupNumberBroadcaster: function TabView_updateGroupNumberBroadcaster(number) {
let groupsNumber = document.getElementById("tabviewGroupsNumber");
groupsNumber.setAttribute("groups", number);
},
// ----------
// Function: enableSessionRestore
// Enables automatic session restore when the browser is started. Does

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

@ -2107,7 +2107,9 @@ let GroupItems = {
let activeGroupId = this._activeGroupItem ? this._activeGroupItem.id : null;
Storage.saveGroupItemsData(
gWindow, { nextID: this.nextID, activeGroupId: activeGroupId });
gWindow,
{ nextID: this.nextID, activeGroupId: activeGroupId,
totalNumber: this.groupItems.length });
},
// ----------

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

@ -1558,6 +1558,6 @@ TabCanvas.prototype = {
// ----------
// Function: toImageData
toImageData: function TabCanvas_toImageData() {
return this.canvas.toDataURL("image/png", "");
return this.canvas.toDataURL("image/png");
}
};

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

@ -956,12 +956,11 @@ let UI = {
// ----------
updateTabButton: function UI__updateTabButton() {
let groupsNumber = gWindow.document.getElementById("tabviewGroupsNumber");
let exitButton = document.getElementById("exit-button");
let numberOfGroups = GroupItems.groupItems.length;
groupsNumber.setAttribute("groups", numberOfGroups);
exitButton.setAttribute("groups", numberOfGroups);
gTabView.updateGroupNumberBroadcaster(numberOfGroups);
},
// ----------

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

@ -115,6 +115,7 @@ _BROWSER_FILES = \
browser_tabview_bug626791.js \
browser_tabview_bug627288.js \
browser_tabview_bug627736.js \
browser_tabview_bug628061.js \
browser_tabview_bug628165.js \
browser_tabview_bug628270.js \
browser_tabview_bug629189.js \

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

@ -0,0 +1,37 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let state = {
windows: [{
tabs: [{
entries: [{ url: "about:blank" }],
hidden: true,
extData: {"tabview-tab": '{"url":"about:blank","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}
},{
entries: [{ url: "about:blank" }],
hidden: false,
extData: {"tabview-tab": '{"url":"about:blank","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
}],
selected: 2,
extData: {
"tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
"tabview-group":
'{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
'"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
}
}]
};
function test() {
waitForExplicitFinish();
newWindowWithState(state, function(win) {
registerCleanupFunction(function() win.close());
is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
"2", "There are two groups");
waitForFocus(finish);
});
}

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

@ -32,7 +32,7 @@
height: 16px;
width: 16px;
-moz-margin-end: 4px;
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon.png");
list-style-image: url("moz-icon://stock/gtk-file?size=menu");
}
#all-sites-item > .site-container > .site-favicon {

8
build/autoconf/config.sub поставляемый
Просмотреть файл

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2009-12-04'
timestamp='2011-01-03'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@ -1432,6 +1432,9 @@ case $os in
-dicos*)
os=-dicos
;;
-android*)
os=android
;;
-none)
;;
*)
@ -1686,6 +1689,9 @@ case $basic_machine in
-vos*)
vendor=stratus
;;
*-android*|*-linuxandroid*)
vendor=linux-
;;
esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;;

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

@ -264,7 +264,25 @@ MOZ_ARG_WITH_STRING(android-sdk,
location where the Android SDK can be found (base directory, e.g. .../android/platforms/android-6)],
android_sdk=$withval)
if test "$target" = "arm-android-eabi" ; then
MOZ_ARG_WITH_STRING(android-platform,
[ --with-android-platform=DIR
location of platform dir, default NDK/build/platforms/android-5/arch-arm],
android_platform=$withval)
case "$target" in
arm-linux*-android*|*-linuxandroid*)
android_tool_prefix="arm-linux-androideabi"
;;
arm-android-eabi)
android_tool_prefix="arm-eabi"
;;
*)
android_tool_prefix="$target_os"
;;
esac
case "$target" in
*-android*|*-linuxandroid*)
if test -z "$android_ndk" ; then
AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
fi
@ -287,24 +305,30 @@ if test "$target" = "arm-android-eabi" ; then
fi
dnl set up compilers
AS="$android_toolchain"/bin/arm-eabi-as
CC="$android_toolchain"/bin/arm-eabi-gcc
CXX="$android_toolchain"/bin/arm-eabi-g++
CPP="$android_toolchain"/bin/arm-eabi-cpp
LD="$android_toolchain"/bin/arm-eabi-ld
AR="$android_toolchain"/bin/arm-eabi-ar
RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
STRIP="$android_toolchain"/bin/arm-eabi-strip
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++
CPP="$android_toolchain"/bin/"$android_tool_prefix"-cpp
LD="$android_toolchain"/bin/"$android_tool_prefix"-ld
AR="$android_toolchain"/bin/"$android_tool_prefix"-ar
RANLIB="$android_toolchain"/bin/"$android_tool_prefix"-ranlib
STRIP="$android_toolchain"/bin/"$android_tool_prefix"-strip
CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
if test -e "$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_static.a" ; then
STLPORT_CPPFLAGS="-I$android_ndk/sources/cxx-stl/stlport/stlport"
STLPORT_LDFLAGS="-L$android_ndk/sources/cxx-stl/stlport/libs/armeabi-v7a/ -lstlport_static"
fi
CPPFLAGS="-I$android_platform/usr/include $STLPORT_CPPFLAGS $CPPFLAGS"
CFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CFLAGS"
CXXFLAGS="-mandroid -I$android_platform/usr/include -fno-short-enums -fno-exceptions $CXXFLAGS"
LIBS="$LIBS $STLPORT_LDFLAGS"
dnl Add -llog by default, since we use it all over the place.
dnl Add --allow-shlib-undefined, because libGLESv2 links to an
dnl undefined symbol (present on the hardware, just not in the
dnl NDK.)
LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
LDFLAGS="-mandroid -L$android_platform/usr/lib -L$android_ndk/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform -llog -Wl,--allow-shlib-undefined $LDFLAGS"
dnl prevent cross compile section from using these flags as host flags
if test -z "$HOST_CPPFLAGS" ; then
@ -336,7 +360,8 @@ if test "$target" = "arm-android-eabi" ; then
CROSS_COMPILE=1
MOZ_CHROME_FILE_FORMAT=omni
ZLIB_DIR=yes
fi
;;
esac
AC_SUBST(ANDROID_NDK)
AC_SUBST(ANDROID_TOOLCHAIN)
@ -1223,7 +1248,7 @@ if test -n "$CROSS_COMPILE"; then
darwin*) OS_ARCH=Darwin OS_TARGET=Darwin ;;
esac
case "${target}" in
arm-android-eabi) OS_ARCH=Linux OS_TARGET=Android ;;
*-android*|*-linuxandroid*) OS_ARCH=Linux OS_TARGET=Android ;;
esac
else
OS_TARGET=`uname -s`
@ -2171,6 +2196,23 @@ ia64*-hpux*)
fi
;;
*-android*|*-linuxandroid*)
AC_DEFINE(NO_PW_GECOS)
no_x=yes
_PLATFORM_DEFAULT_TOOLKIT=cairo-android
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
*-*linux*)
# Note: both GNU_CC and INTEL_CC are set when using Intel's C compiler.
# Similarly for GNU_CXX and INTEL_CXX.
@ -2690,23 +2732,6 @@ alpha*-*-osf*)
HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
;;
*-android*)
AC_DEFINE(NO_PW_GECOS)
no_x=yes
_PLATFORM_DEFAULT_TOOLKIT=cairo-android
TARGET_NSPR_MDCPUCFG='\"md/_linux.cfg\"'
MOZ_GFX_OPTIMIZE_MOBILE=1
# If we're building with --enable-profiling, we need a frame pointer.
if test -z "$MOZ_PROFILING"; then
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
esac
dnl Only one oddball right now (QNX), but this gives us flexibility
@ -3323,25 +3348,6 @@ case $target in
AC_CHECK_LIB(socket, socket)
esac
dnl ========================================================
dnl Check whether we can compile code for Core Text
dnl (available on Mac OS X 10.5 or later)
dnl ========================================================
case "$target" in
*-darwin*)
AC_MSG_CHECKING([for Core Text])
AC_TRY_COMPILE([#include <ApplicationServices/ApplicationServices.h>],
[CTLineRef lineRef;],
ac_cv_have_core_text="yes",
ac_cv_have_core_text="no")
AC_MSG_RESULT([$ac_cv_have_core_text])
if test "$ac_cv_have_core_text" = "no"; then
AC_MSG_ERROR([Core Text is required (available on Mac OS X 10.5 or later).])
fi
;;
esac
XLDFLAGS="$X_LIBS"
XLIBS="$X_EXTRA_LIBS"
@ -4299,7 +4305,7 @@ if test "$ac_cv_thread_keyword" = yes; then
mips*-*)
:
;;
*-android*)
*-android*|*-linuxandroid*)
:
;;
*)
@ -4884,7 +4890,7 @@ case "$target_os" in
esac
case "${target}" in
arm-android-eabi)
*-android*|*-linuxandroid*)
NSS_DISABLE_DBM=1
USE_ARM_KUSER=1
MOZ_INSTALLER=
@ -6210,7 +6216,7 @@ i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
MOZ_CRASHREPORTER=1
fi
;;
arm-android-eabi)
*-android*|*-linuxandroid*)
MOZ_CRASHREPORTER=1
;;
*solaris*)
@ -7345,6 +7351,13 @@ else
*-*freebsd*)
AC_DEFINE(MOZ_MEMORY_BSD)
;;
*-android*|*-linuxandroid*)
AC_DEFINE(MOZ_MEMORY_LINUX)
AC_DEFINE(MOZ_MEMORY_ANDROID)
_WRAP_MALLOC=1
export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
;;
*-*linux*)
AC_DEFINE(MOZ_MEMORY_LINUX)
;;
@ -7393,13 +7406,6 @@ else
DLLFLAGS="$DLLFLAGS $MOZ_MEMORY_LDFLAGS"
export DLLFLAGS
;;
*-android*)
AC_DEFINE(MOZ_MEMORY_LINUX)
AC_DEFINE(MOZ_MEMORY_ANDROID)
_WRAP_MALLOC=1
export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc -lmozutils"
WRAP_MALLOC_CFLAGS="-Wl,--wrap=dlopen -Wl,--wrap=dlclose -Wl,--wrap=dlerror -Wl,--wrap=dlsym -Wl,--wrap=dladdr"
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
;;
@ -8401,7 +8407,6 @@ if test "$MOZ_TREE_CAIRO"; then
AC_DEFINE(HAVE_UINT64_T)
# Define macros for cairo-features.h
TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1"
if test "$MOZ_X11"; then
XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1"
XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1"
@ -8484,7 +8489,6 @@ if test "$MOZ_TREE_CAIRO"; then
AC_SUBST(QUARTZ_FONT_FEATURE)
AC_SUBST(PNG_FUNCTIONS_FEATURE)
AC_SUBST(QT_SURFACE_FEATURE)
AC_SUBST(TEE_SURFACE_FEATURE)
MOZ_CAIRO_LIBS='$(call EXPAND_LIBNAME_PATH,mozcairo,$(DEPTH)/gfx/cairo/cairo/src)'" $CAIRO_FT_LIBS"

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

@ -51,6 +51,17 @@
#include <ieeefp.h>
#endif
//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
#ifdef __FreeBSD__
#include <ieeefp.h>
#ifdef __alpha__
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
#else
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
#endif
static fp_except_t oldmask = fpsetmask(~allmask);
#endif
#include "nsAString.h"
#include "nsIStatefulFrame.h"
#include "nsINodeInfo.h"
@ -550,9 +561,6 @@ public:
static void SplitExpatName(const PRUnichar *aExpatName, nsIAtom **aPrefix,
nsIAtom **aTagName, PRInt32 *aNameSpaceID);
static nsAdoptingCString GetCharPref(const char *aPref);
static nsAdoptingString GetLocalizedStringPref(const char *aPref);
static nsAdoptingString GetStringPref(const char *aPref);
static void RegisterPrefCallback(const char *aPref,
PrefChangedFunc aCallback,
void * aClosure);
@ -1929,6 +1937,88 @@ public:
} \
} else
/**
* Macros to workaround math-bugs bugs in various platforms
*/
/**
* Stefan Hanske <sh990154@mail.uni-greifswald.de> reports:
* ARM is a little endian architecture but 64 bit double words are stored
* differently: the 32 bit words are in little endian byte order, the two words
* are stored in big endian`s way.
*/
#if defined(__arm) || defined(__arm32__) || defined(__arm26__) || defined(__arm__)
#if !defined(__VFP_FP__)
#define FPU_IS_ARM_FPA
#endif
#endif
typedef union dpun {
struct {
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
PRUint32 lo, hi;
#else
PRUint32 hi, lo;
#endif
} s;
PRFloat64 d;
public:
operator double() const {
return d;
}
} dpun;
/**
* Utility class for doubles
*/
#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
/**
* This version of the macros is safe for the alias optimizations
* that gcc does, but uses gcc-specific extensions.
*/
#define DOUBLE_HI32(x) (__extension__ ({ dpun u; u.d = (x); u.s.hi; }))
#define DOUBLE_LO32(x) (__extension__ ({ dpun u; u.d = (x); u.s.lo; }))
#else // __GNUC__
/* We don't know of any non-gcc compilers that perform alias optimization,
* so this code should work.
*/
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
#define DOUBLE_HI32(x) (((PRUint32 *)&(x))[1])
#define DOUBLE_LO32(x) (((PRUint32 *)&(x))[0])
#else
#define DOUBLE_HI32(x) (((PRUint32 *)&(x))[0])
#define DOUBLE_LO32(x) (((PRUint32 *)&(x))[1])
#endif
#endif // __GNUC__
#define DOUBLE_HI32_SIGNBIT 0x80000000
#define DOUBLE_HI32_EXPMASK 0x7ff00000
#define DOUBLE_HI32_MANTMASK 0x000fffff
#define DOUBLE_IS_NaN(x) \
((DOUBLE_HI32(x) & DOUBLE_HI32_EXPMASK) == DOUBLE_HI32_EXPMASK && \
(DOUBLE_LO32(x) || (DOUBLE_HI32(x) & DOUBLE_HI32_MANTMASK)))
#ifdef IS_BIG_ENDIAN
#define DOUBLE_NaN {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK, \
0xffffffff}}
#else
#define DOUBLE_NaN {{0xffffffff, \
DOUBLE_HI32_EXPMASK | DOUBLE_HI32_MANTMASK}}
#endif
#if defined(XP_WIN)
#define DOUBLE_COMPARE(LVAL, OP, RVAL) \
(!DOUBLE_IS_NaN(LVAL) && !DOUBLE_IS_NaN(RVAL) && (LVAL) OP (RVAL))
#else
#define DOUBLE_COMPARE(LVAL, OP, RVAL) ((LVAL) OP (RVAL))
#endif
/*
* Check whether a floating point number is finite (not +/-infinity and not a
* NaN value).

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

@ -2597,55 +2597,6 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
return aContent->IsLink(getter_AddRefs(absURI));
}
// static
nsAdoptingCString
nsContentUtils::GetCharPref(const char *aPref)
{
nsAdoptingCString result;
if (sPrefBranch) {
sPrefBranch->GetCharPref(aPref, getter_Copies(result));
}
return result;
}
// static
nsAdoptingString
nsContentUtils::GetLocalizedStringPref(const char *aPref)
{
nsAdoptingString result;
if (sPrefBranch) {
nsCOMPtr<nsIPrefLocalizedString> prefLocalString;
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsIPrefLocalizedString),
getter_AddRefs(prefLocalString));
if (prefLocalString) {
prefLocalString->GetData(getter_Copies(result));
}
}
return result;
}
// static
nsAdoptingString
nsContentUtils::GetStringPref(const char *aPref)
{
nsAdoptingString result;
if (sPrefBranch) {
nsCOMPtr<nsISupportsString> theString;
sPrefBranch->GetComplexValue(aPref, NS_GET_IID(nsISupportsString),
getter_AddRefs(theString));
if (theString) {
theString->ToString(getter_Copies(result));
}
}
return result;
}
// RegisterPrefCallback/UnregisterPrefCallback are for backward compatiblity
// with c-style observers.
@ -4475,7 +4426,7 @@ nsContentUtils::GetLocalizedEllipsis()
{
static PRUnichar sBuf[4] = { 0, 0, 0, 0 };
if (!sBuf[0]) {
nsAutoString tmp(GetLocalizedStringPref("intl.ellipsis"));
nsAdoptingString tmp = Preferences::GetLocalizedString("intl.ellipsis");
PRUint32 len = NS_MIN(PRUint32(tmp.Length()),
PRUint32(NS_ARRAY_LENGTH(sBuf) - 1));
CopyUnicodeTo(tmp, 0, sBuf, len);

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

@ -64,6 +64,7 @@
#include "nsStringStream.h"
#include "CheckedInt.h"
#include "nsJSUtils.h"
#include "mozilla/Preferences.h"
#include "plbase64.h"
#include "prmem.h"
@ -499,12 +500,12 @@ nsDOMFile::GuessCharset(nsIInputStream *aStream,
"universal_charset_detector");
if (!detector) {
// No universal charset detector, try the default charset detector
const nsAdoptingString& detectorName =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detectorName =
Preferences::GetLocalizedCString("intl.charset.detector");
if (!detectorName.IsEmpty()) {
nsCAutoString detectorContractID;
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
AppendUTF16toUTF8(detectorName, detectorContractID);
detectorContractID += detectorName;
detector = do_CreateInstance(detectorContractID.get());
}
}

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

@ -77,6 +77,9 @@
#include "nsLayoutStatics.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsFileDataProtocolHandler.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#define LOAD_STR "load"
#define ERROR_STR "error"
@ -684,12 +687,12 @@ nsDOMFileReader::GuessCharset(const char *aFileData,
"universal_charset_detector");
if (!detector) {
// No universal charset detector, try the default charset detector
const nsAdoptingString& detectorName =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detectorName =
Preferences::GetLocalizedCString("intl.charset.detector");
if (!detectorName.IsEmpty()) {
nsCAutoString detectorContractID;
detectorContractID.AssignLiteral(NS_CHARSET_DETECTOR_CONTRACTID_BASE);
AppendUTF16toUTF8(detectorName, detectorContractID);
detectorContractID += detectorName;
detector = do_CreateInstance(detectorContractID.get());
}
}

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

@ -1688,8 +1688,6 @@ NS_INTERFACE_TABLE_HEAD(nsDocument)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDocument)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMNSDocumentStyle)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOMDocumentXBL)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIScriptObjectPrincipal)
NS_INTERFACE_TABLE_ENTRY(nsDocument, nsIDOM3EventTarget)

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

@ -54,7 +54,6 @@
#include "nsIDOMXMLDocument.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMNSDocumentStyle.h"
#include "nsStubDocumentObserver.h"
#include "nsIDOM3EventTarget.h"
#include "nsIDOMNSEventTarget.h"
@ -491,7 +490,6 @@ protected:
class nsDocument : public nsIDocument,
public nsIDOMXMLDocument, // inherits nsIDOMDocument
public nsIDOMNSDocument,
public nsIDOMNSDocumentStyle,
public nsIDOMDocumentXBL,
public nsSupportsWeakReference,
public nsIDOMEventTarget,
@ -794,12 +792,6 @@ public:
// nsIDOMNSDocument
NS_DECL_NSIDOMNSDOCUMENT
// nsIDOMDocumentStyle
NS_DECL_NSIDOMDOCUMENTSTYLE
// nsIDOMNSDocumentStyle
NS_DECL_NSIDOMNSDOCUMENTSTYLE
// nsIDOMDocumentXBL
NS_DECL_NSIDOMDOCUMENTXBL

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

@ -1430,7 +1430,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::SetTransform(float m11, float m12, float m21, float m22, float dx, float dy)
{
if (!FloatValidate(m11,m12,m21,m22,dx,dy))
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_OK;
gfxMatrix matrix(m11, m12, m21, m22, dx, dy);
mThebes->SetMatrix(matrix);
@ -2097,7 +2097,7 @@ nsCanvasRenderingContext2D::BezierCurveTo(float cp1x, float cp1y,
float x, float y)
{
if (!FloatValidate(cp1x,cp1y,cp2x,cp2y,x,y))
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_OK;
mHasPath = PR_TRUE;
mThebes->CurveTo(gfxPoint(cp1x, cp1y),
@ -2111,7 +2111,7 @@ NS_IMETHODIMP
nsCanvasRenderingContext2D::ArcTo(float x1, float y1, float x2, float y2, float radius)
{
if (!FloatValidate(x1,y1,x2,y2,radius))
return NS_ERROR_DOM_SYNTAX_ERR;
return NS_OK;
if (radius < 0)
return NS_ERROR_DOM_INDEX_SIZE_ERR;

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

@ -80,6 +80,7 @@ _TEST_FILES_0 = \
test_2d.composite.uncovered.image.source-in.html \
test_2d.composite.uncovered.image.source-out.html \
test_toDataURL_lowercase_ascii.html \
test_toDataURL_parameters.html \
test_mozGetAsFile.html \
test_canvas_strokeStyle_getter.html \
test_bug613794.html \

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

@ -11880,7 +11880,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}
@ -12393,7 +12393,7 @@ isPixel(ctx, 90,45, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}
@ -18995,7 +18995,7 @@ isPixel(ctx, 50,25, 0,255,0,255, 0);
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}
@ -19537,21 +19537,23 @@ var canvas = document.getElementById('c614');
var ctx = canvas.getContext('2d');
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var _threw = false;
try {
var data = canvas.toDataURL('image/png', 'quality=100');
ok(false, "Should have thrown an exception for invalid args to png encoder");
}
catch (e) {
is(e.result, Components.results.NS_ERROR_INVALID_ARG, "Exception was wrong for png encoder");
_threw = true;
}
ok(!_threw, "Should not throw an exception for invalid args to png encoder");
_threw = false;
try {
var data = canvas.toDataURL('image/jpeg', 'foobar=true');
ok(false, "Should have thrown an exception for invalid args to jpeg encoder");
}
catch (e) {
is(e.result, Components.results.NS_ERROR_INVALID_ARG, "Exception was wrong for jpeg encoder");
_threw = true;
}
ok(!_threw, "Should not throw an exception for invalid args to jpeg encoder");
}
</script>
@ -20761,7 +20763,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}
@ -20788,7 +20790,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}
@ -20816,7 +20818,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
} catch (e) {
_thrown_outer = true;
}
todo(!_thrown_outer, 'should not throw exception');
ok(!_thrown_outer, 'should not throw exception');
}

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

@ -0,0 +1,55 @@
<!DOCTYPE HTML>
<title>Canvas test: toDataURL parameters (Bug 564388)</title>
<script src="/MochiKit/MochiKit.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
<body>
<p>
This test covers the JPEG quality parameter. If (when) the HTML5 spec changes the
allowed parameters for ToDataURL, new tests should go here.
</p>
<canvas id="c" width="100" height="100"><p class="fallback">FAIL (fallback content)</p></canvas>
<script>
var canvas = document.getElementById('c');
var ctx = canvas.getContext("2d");
ctx.strokeStyle = '#FF0000';
ctx.fillStyle = '#00FF00';
ctx.fillRect(0, 0, 100, 100);
ctx.beginPath();
ctx.moveTo(10, 10);
ctx.lineTo(90, 90);
ctx.stroke();
var pngData = canvas.toDataURL('image/png');
var pngQuality = canvas.toDataURL('image/png', 0.1);
is(pngQuality, pngData, "Quality is not supported for PNG images");
var data = canvas.toDataURL('image/jpeg');
if (data.match(/^data:image\/jpeg[;,]/)) {
// Test the JPEG quality parameter
var fullQuality = canvas.toDataURL('image/jpeg', 1.0);
var lowQuality = canvas.toDataURL('image/jpeg', 0.1);
isnot(lowQuality, fullQuality, "A low quality (0.1) should differ from high quality (1.0)");
var medQuality = canvas.toDataURL('image/jpeg', 0.5);
isnot(medQuality, fullQuality, "A medium quality (0.5) should differ from high (1.0)");
isnot(medQuality, lowQuality, "A medium quality (0.5) should differ from low (0.5)");
var tooHigh = canvas.toDataURL('image/jpeg', 2.0);
is(tooHigh, data, "Quality above 1.0 is treated as unspecified");
var tooLow = canvas.toDataURL('image/jpeg', -1.0);
is(tooLow, data, "Quality below 0.0 is treated as unspecified");
var lowQualityExtra = canvas.toDataURL('image/jpeg', 0.1, 'foo', 'bar', null);
is(lowQualityExtra, lowQuality, "Quality applies even if extra arguments are present");
var lowQualityUppercase = canvas.toDataURL('IMAGE/JPEG', 0.1);
is(lowQualityUppercase, lowQuality, "Quality applies to image/jpeg regardless of case");
var lowQualityString = canvas.toDataURL('image/jpeg', '0.1');
isnot(lowQualityString, lowQuality, "Quality must be a number (should not be a string)");
}
</script>

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

@ -1,4 +1,3 @@
conformance/canvas-test.html
conformance/gl-getshadersource.html
conformance/gl-object-get-calls.html
conformance/texture-npot.html

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

@ -365,10 +365,6 @@ function start() {
var testsToIgnore = [];
// canvas-test.html is currently failing on Windows XP test slaves
if (kIsWindows && !kIsWindowsVistaOrHigher)
testsToIgnore.push('conformance/canvas-test.html');
var testsSuccessful = [];
runTestSuite();

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

@ -57,6 +57,9 @@
#include "nsIScriptSecurityManager.h"
#include "nsIScriptError.h"
#include "nsDOMPopStateEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static const char* const sEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
@ -1088,8 +1091,7 @@ nsDOMEvent::PopupAllowedEventsChanged()
nsMemory::Free(sPopupAllowedEvents);
}
nsAdoptingCString str =
nsContentUtils::GetCharPref("dom.popup_allowed_events");
nsAdoptingCString str = Preferences::GetCString("dom.popup_allowed_events");
// We'll want to do this even if str is empty to avoid looking up
// this pref all the time if it's not set.

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

@ -181,7 +181,7 @@ protected:
PRUint32& aSize,
bool& aFellBackToPNG);
nsresult ToDataURLImpl(const nsAString& aMimeType,
const nsAString& aEncoderOptions,
nsIVariant* aEncoderOptions,
nsAString& aDataURL);
nsresult MozGetAsFileImpl(const nsAString& aName,
const nsAString& aType,

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

@ -68,7 +68,6 @@ CPPSRCS = \
nsHTMLButtonElement.cpp \
nsHTMLCanvasElement.cpp \
nsHTMLDataListElement.cpp \
nsHTMLDelElement.cpp \
nsHTMLDivElement.cpp \
nsHTMLFieldSetElement.cpp \
nsHTMLFontElement.cpp \
@ -86,6 +85,7 @@ CPPSRCS = \
nsHTMLLinkElement.cpp \
nsHTMLMapElement.cpp \
nsHTMLMetaElement.cpp \
nsHTMLModElement.cpp \
nsHTMLObjectElement.cpp \
nsHTMLOListElement.cpp \
nsHTMLSharedObjectElement.cpp \

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

@ -47,6 +47,7 @@
#include "nsIXPConnect.h"
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsMathUtils.h"
#include "nsFrameManager.h"
#include "nsDisplayList.h"
@ -196,32 +197,17 @@ nsHTMLCanvasElement::ParseAttribute(PRInt32 aNamespaceID,
// nsHTMLCanvasElement::toDataURL
NS_IMETHODIMP
nsHTMLCanvasElement::ToDataURL(const nsAString& aType, const nsAString& aParams,
nsHTMLCanvasElement::ToDataURL(const nsAString& aType, nsIVariant* aParams,
PRUint8 optional_argc, nsAString& aDataURL)
{
// do a trust check if this is a write-only canvas
// or if we're trying to use the 2-arg form
if ((mWriteOnly || optional_argc >= 2) &&
!nsContentUtils::IsCallerTrustedForRead()) {
if (mWriteOnly && !nsContentUtils::IsCallerTrustedForRead()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
return ToDataURLImpl(aType, aParams, aDataURL);
}
// nsHTMLCanvasElement::toDataURLAs
//
// Native-callers only
NS_IMETHODIMP
nsHTMLCanvasElement::ToDataURLAs(const nsAString& aMimeType,
const nsAString& aEncoderOptions,
nsAString& aDataURL)
{
return ToDataURLImpl(aMimeType, aEncoderOptions, aDataURL);
}
nsresult
nsHTMLCanvasElement::ExtractData(const nsAString& aType,
const nsAString& aOptions,
@ -323,7 +309,7 @@ nsHTMLCanvasElement::ExtractData(const nsAString& aType,
nsresult
nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
const nsAString& aEncoderOptions,
nsIVariant* aEncoderOptions,
nsAString& aDataURL)
{
bool fallbackToPNG = false;
@ -337,11 +323,30 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
nsAutoString type;
nsContentUtils::ASCIIToLower(aMimeType, type);
nsAutoString params;
// Quality parameter is only valid for the image/jpeg MIME type
if (type.EqualsLiteral("image/jpeg")) {
PRUint16 vartype;
if (aEncoderOptions &&
NS_SUCCEEDED(aEncoderOptions->GetDataType(&vartype)) &&
vartype <= nsIDataType::VTYPE_DOUBLE) {
double quality;
// Quality must be between 0.0 and 1.0, inclusive
if (NS_SUCCEEDED(aEncoderOptions->GetAsDouble(&quality)) &&
quality >= 0.0 && quality <= 1.0) {
params.AppendLiteral("quality=");
params.AppendInt(NS_lround(quality * 100.0));
}
}
}
PRUint32 imgSize = 0;
char* imgData;
nsresult rv = ExtractData(type, aEncoderOptions, imgData,
imgSize, fallbackToPNG);
nsresult rv = ExtractData(type, params, imgData, imgSize, fallbackToPNG);
NS_ENSURE_SUCCESS(rv, rv);
// base 64, result will be NULL terminated

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

@ -20,6 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ms2ger <ms2ger@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"),
@ -34,13 +35,13 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIDOMHTMLModElement.h"
#include "nsIDOMEventTarget.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
class nsHTMLModElement : public nsGenericHTMLElement,
public nsIDOMHTMLModElement
{
@ -64,11 +65,8 @@ public:
NS_DECL_NSIDOMHTMLMODELEMENT
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo()
{
return static_cast<nsXPCClassInfo*>(GetClassInfoInternal());
}
nsIClassInfo* GetClassInfoInternal();
virtual nsXPCClassInfo* GetClassInfo();
};
@ -87,28 +85,15 @@ nsHTMLModElement::~nsHTMLModElement()
NS_IMPL_ADDREF_INHERITED(nsHTMLModElement, nsGenericElement)
NS_IMPL_RELEASE_INHERITED(nsHTMLModElement, nsGenericElement)
DOMCI_DATA(HTMLDelElement, nsHTMLModElement)
DOMCI_DATA(HTMLInsElement, nsHTMLModElement)
nsIClassInfo*
nsHTMLModElement::GetClassInfoInternal()
{
if (mNodeInfo->Equals(nsGkAtoms::del)) {
return NS_GetDOMClassInfoInstance(eDOMClassInfo_HTMLDelElement_id);
}
if (mNodeInfo->Equals(nsGkAtoms::ins)) {
return NS_GetDOMClassInfoInstance(eDOMClassInfo_HTMLInsElement_id);
}
return nsnull;
}
DOMCI_NODE_DATA(HTMLModElement, nsHTMLModElement)
// QueryInterface implementation for nsHTMLModElement
NS_INTERFACE_TABLE_HEAD(nsHTMLModElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLModElement, nsIDOMHTMLModElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLModElement,
nsIDOMHTMLModElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLModElement,
nsGenericHTMLElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO_GETTER(GetClassInfoInternal)
NS_HTML_CONTENT_INTERFACE_MAP_END
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLModElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLModElement)

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

@ -52,11 +52,9 @@ function HTML_TAG(aTagName, aImplClass) {
if (interfaceName in Components.interfaces) { // no nsIDOMHTMLSpanElement
interfaces[aTagName].push(interfaceName);
interfacesNonClassinfo[aTagName].push("nsIDOMHTMLElement");
} else if (aTagName != "ins" && aTagName != "del") {
// Inherits directly from nsIDOMHTMLElement, unless it's "ins" or "del",
// which are weird.
} else {
// Inherits directly from nsIDOMHTMLElement.
interfaces[aTagName].push("nsIDOMHTMLElement");
}
var interfaceNameNS = "nsIDOMNS" + getClassName(aTagName);
@ -95,11 +93,9 @@ objectIfaces2.push("nsIImageLoadingContent");
applet
base
blockquote
del
dir
dl
embed
ins
isindex
menu
ol
@ -112,45 +108,45 @@ objectIfaces2.push("nsIImageLoadingContent");
*/
HTML_TAG("a", "Anchor");
HTML_TAG("abbr", ""); // HTMLElement
HTML_TAG("acronym", ""); // HTMLElement
HTML_TAG("address", ""); // HTMLElement
HTML_TAG("abbr", "");
HTML_TAG("acronym", "");
HTML_TAG("address", "");
HTML_TAG("applet", "Applet", [], objectIfaces);
HTML_TAG("area", "Area");
HTML_TAG("article", ""); // HTMLElement
HTML_TAG("aside", ""); // HTMLElement
HTML_TAG("b", ""); // HTMLElement
HTML_TAG("article", "");
HTML_TAG("aside", "");
HTML_TAG("b", "");
HTML_TAG("base", "Base");
HTML_TAG("bdo", ""); // HTMLElement
HTML_TAG("bdo", "");
HTML_TAG("bgsound", "Span");
HTML_TAG("big", ""); // HTMLElement
HTML_TAG("blink", ""); // HTMLElement
HTML_TAG("big", "");
HTML_TAG("blink", "");
HTML_TAG("blockquote", "Quote");
HTML_TAG("body", "Body");
HTML_TAG("br", "BR");
HTML_TAG("button", "Button");
HTML_TAG("canvas", "Canvas");
HTML_TAG("caption", "TableCaption");
HTML_TAG("center", ""); // HTMLElement
HTML_TAG("cite", ""); // HTMLElement
HTML_TAG("code", ""); // HTMLElement
HTML_TAG("center", "");
HTML_TAG("cite", "");
HTML_TAG("code", "");
HTML_TAG("col", "TableCol");
HTML_TAG("colgroup", "TableCol");
HTML_TAG("datalist", "DataList");
HTML_TAG("dd", ""); // HTMLElement
HTML_TAG("del", "Del", [ "nsIDOMHTMLModElement" ]);
HTML_TAG("dfn", ""); // HTMLElement
HTML_TAG("dd", "");
HTML_TAG("del", "Mod");
HTML_TAG("dfn", "");
HTML_TAG("dir", "Directory");
HTML_TAG("div", "Div");
HTML_TAG("dl", "DList");
HTML_TAG("dt", ""); // HTMLElement
HTML_TAG("em", ""); // HTMLElement
HTML_TAG("dt", "");
HTML_TAG("em", "");
HTML_TAG("embed", "Embed", [ "nsIDOMGetSVGDocument" ], objectIfaces);
HTML_TAG("fieldset", "FieldSet");
HTML_TAG("figcaption", "") // HTMLElement
HTML_TAG("figure", "") // HTMLElement
HTML_TAG("figcaption", "")
HTML_TAG("figure", "")
HTML_TAG("font", "Font");
HTML_TAG("footer", "") // HTMLElement
HTML_TAG("footer", "")
HTML_TAG("form", "Form", [], [ "nsIWebProgressListener" ]);
HTML_TAG("frame", "Frame", [], [ "nsIFrameLoaderOwner" ]);
HTML_TAG("frameset", "FrameSet");
@ -161,11 +157,11 @@ HTML_TAG("h4", "Heading");
HTML_TAG("h5", "Heading");
HTML_TAG("h6", "Heading");
HTML_TAG("head", "Head");
HTML_TAG("header", "") // HTMLElement
HTML_TAG("hgroup", "") // HTMLElement
HTML_TAG("header", "")
HTML_TAG("hgroup", "")
HTML_TAG("hr", "HR");
HTML_TAG("html", "Html");
HTML_TAG("i", ""); // HTMLElement
HTML_TAG("i", "");
HTML_TAG("iframe", "IFrame", [ "nsIDOMNSHTMLFrameElement", "nsIDOMGetSVGDocument" ],
[ "nsIFrameLoaderOwner" ]);
HTML_TAG("image", "Span");
@ -174,26 +170,26 @@ HTML_TAG("img", "Image", [], [ "imgIDecoderObserver",
HTML_TAG("input", "Input", [], [ "imgIDecoderObserver",
"nsIImageLoadingContent",
"nsIDOMNSEditableElement" ]);
HTML_TAG("ins", "Ins", [ "nsIDOMHTMLModElement" ]);
HTML_TAG("isindex", ""); // HTMLElement
HTML_TAG("kbd", ""); // HTMLElement
HTML_TAG("ins", "Mod");
HTML_TAG("isindex", "");
HTML_TAG("kbd", "");
HTML_TAG("keygen", "Span");
HTML_TAG("label", "Label");
HTML_TAG("legend", "Legend");
HTML_TAG("li", "LI");
HTML_TAG("link", "Link", [ "nsIDOMLinkStyle" ]);
HTML_TAG("listing", ""); // HTMLElement
HTML_TAG("listing", "");
HTML_TAG("map", "Map");
HTML_TAG("mark", ""); // HTMLElement
HTML_TAG("mark", "");
HTML_TAG("marquee", "Div");
HTML_TAG("menu", "Menu");
HTML_TAG("meta", "Meta");
HTML_TAG("multicol", "Span");
HTML_TAG("nav", "") // HTMLElement
HTML_TAG("nobr", ""); // HTMLElement
HTML_TAG("noembed", ""); // HTMLElement
HTML_TAG("noframes", ""); // HTMLElement
HTML_TAG("noscript", ""); // HTMLElement
HTML_TAG("nav", "")
HTML_TAG("nobr", "");
HTML_TAG("noembed", "");
HTML_TAG("noframes", "");
HTML_TAG("noscript", "");
HTML_TAG("object", "Object", [ "nsIDOMGetSVGDocument" ],
objectIfaces.concat([ "nsIImageLoadingContent" ]));
HTML_TAG("ol", "OList");
@ -201,21 +197,21 @@ HTML_TAG("optgroup", "OptGroup");
HTML_TAG("option", "Option");
HTML_TAG("p", "Paragraph");
HTML_TAG("param", "Param");
HTML_TAG("plaintext", ""); // HTMLElement
HTML_TAG("plaintext", "");
HTML_TAG("pre", "Pre");
HTML_TAG("q", "Quote");
HTML_TAG("s", ""); // HTMLElement
HTML_TAG("samp", ""); // HTMLElement
HTML_TAG("s", "");
HTML_TAG("samp", "");
HTML_TAG("script", "Script", [], [ "nsIScriptLoaderObserver" ]);
HTML_TAG("section", "") // HTMLElement
HTML_TAG("section", "")
HTML_TAG("select", "Select", ["nsIDOMHTMLSelectElement"]);
HTML_TAG("small", ""); // HTMLElement
HTML_TAG("small", "");
HTML_TAG("span", "Span");
HTML_TAG("strike", ""); // HTMLElement
HTML_TAG("strong", ""); // HTMLElement
HTML_TAG("strike", "");
HTML_TAG("strong", "");
HTML_TAG("style", "Style", [ "nsIDOMLinkStyle" ]);
HTML_TAG("sub", ""); // HTMLElement
HTML_TAG("sup", ""); // HTMLElement
HTML_TAG("sub", "");
HTML_TAG("sup", "");
HTML_TAG("table", "Table");
HTML_TAG("tbody", "TableSection");
HTML_TAG("td", "TableCell");
@ -225,12 +221,12 @@ HTML_TAG("th", "TableCell");
HTML_TAG("thead", "TableSection");
HTML_TAG("title", "Title");
HTML_TAG("tr", "TableRow");
HTML_TAG("tt", ""); // HTMLElement
HTML_TAG("u", ""); // HTMLElement
HTML_TAG("tt", "");
HTML_TAG("u", "");
HTML_TAG("ul", "UList");
HTML_TAG("var", ""); // HTMLElement
HTML_TAG("wbr", ""); // HTMLElement
HTML_TAG("xmp", ""); // HTMLElement
HTML_TAG("var", "");
HTML_TAG("wbr", "");
HTML_TAG("xmp", "");
function tagName(aTag) {
return "<" + aTag + ">";

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

@ -38,6 +38,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "MediaDocument.h"
#include "nsRect.h"
#include "nsHTMLDocument.h"
#include "nsIImageDocument.h"
@ -57,7 +58,6 @@
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "nsAutoPtr.h"
#include "nsMediaDocument.h"
#include "nsStyleSet.h"
#include "nsIChannel.h"
#include "nsIContentPolicy.h"
@ -76,34 +76,34 @@
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
#define CLICK_IMAGE_RESIZING_PREF "browser.enable_click_image_resizing"
//XXX A hack needed for Firefox's site specific zoom.
#define SITE_SPECIFIC_ZOOM "browser.zoom.siteSpecific"
class nsImageDocument;
namespace mozilla {
namespace dom {
class ImageDocument;
class ImageListener: public nsMediaDocumentStreamListener
class ImageListener : public MediaDocumentStreamListener
{
public:
ImageListener(nsImageDocument* aDocument);
ImageListener(ImageDocument* aDocument);
virtual ~ImageListener();
/* nsIRequestObserver */
NS_IMETHOD OnStartRequest(nsIRequest* request, nsISupports *ctxt);
};
class nsImageDocument : public nsMediaDocument,
public nsIImageDocument,
public nsStubImageDecoderObserver,
public nsIDOMEventListener
class ImageDocument : public MediaDocument
, public nsIImageDocument
, public nsStubImageDecoderObserver
, public nsIDOMEventListener
{
public:
nsImageDocument();
virtual ~nsImageDocument();
ImageDocument();
virtual ~ImageDocument();
NS_DECL_ISUPPORTS_INHERITED
@ -131,7 +131,7 @@ public:
// nsIDOMEventListener
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsImageDocument, nsMediaDocument)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ImageDocument, MediaDocument)
friend class ImageListener;
@ -178,8 +178,8 @@ protected:
float mOriginalZoomLevel;
};
ImageListener::ImageListener(nsImageDocument* aDocument)
: nsMediaDocumentStreamListener(aDocument)
ImageListener::ImageListener(ImageDocument* aDocument)
: MediaDocumentStreamListener(aDocument)
{
}
@ -192,7 +192,7 @@ ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
nsImageDocument *imgDoc = (nsImageDocument*)mDocument.get();
ImageDocument *imgDoc = static_cast<ImageDocument*>(mDocument.get());
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (!channel) {
return NS_ERROR_FAILURE;
@ -238,56 +238,51 @@ ImageListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
imgDoc->mObservingImageLoader = PR_TRUE;
imageLoader->LoadImageWithChannel(channel, getter_AddRefs(mNextStream));
return nsMediaDocumentStreamListener::OnStartRequest(request, ctxt);
return MediaDocumentStreamListener::OnStartRequest(request, ctxt);
}
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsImageDocument::nsImageDocument() : mOriginalZoomLevel(1.0)
ImageDocument::ImageDocument()
: mOriginalZoomLevel(1.0)
{
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
}
nsImageDocument::~nsImageDocument()
ImageDocument::~ImageDocument()
{
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsImageDocument)
NS_IMPL_CYCLE_COLLECTION_CLASS(ImageDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsImageDocument, nsMediaDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(ImageDocument, MediaDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mImageContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsImageDocument, nsMediaDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(ImageDocument, MediaDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mImageContent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ADDREF_INHERITED(nsImageDocument, nsMediaDocument)
NS_IMPL_RELEASE_INHERITED(nsImageDocument, nsMediaDocument)
NS_IMPL_ADDREF_INHERITED(ImageDocument, MediaDocument)
NS_IMPL_RELEASE_INHERITED(ImageDocument, MediaDocument)
DOMCI_NODE_DATA(ImageDocument, nsImageDocument)
DOMCI_NODE_DATA(ImageDocument, ImageDocument)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsImageDocument)
NS_HTML_DOCUMENT_INTERFACE_TABLE_BEGIN(nsImageDocument)
NS_INTERFACE_TABLE_ENTRY(nsImageDocument, nsIImageDocument)
NS_INTERFACE_TABLE_ENTRY(nsImageDocument, imgIDecoderObserver)
NS_INTERFACE_TABLE_ENTRY(nsImageDocument, imgIContainerObserver)
NS_INTERFACE_TABLE_ENTRY(nsImageDocument, nsIDOMEventListener)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(ImageDocument)
NS_HTML_DOCUMENT_INTERFACE_TABLE_BEGIN(ImageDocument)
NS_INTERFACE_TABLE_ENTRY(ImageDocument, nsIImageDocument)
NS_INTERFACE_TABLE_ENTRY(ImageDocument, imgIDecoderObserver)
NS_INTERFACE_TABLE_ENTRY(ImageDocument, imgIContainerObserver)
NS_INTERFACE_TABLE_ENTRY(ImageDocument, nsIDOMEventListener)
NS_OFFSET_AND_INTERFACE_TABLE_END
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ImageDocument)
NS_INTERFACE_MAP_END_INHERITING(nsMediaDocument)
NS_INTERFACE_MAP_END_INHERITING(MediaDocument)
nsresult
nsImageDocument::Init()
ImageDocument::Init()
{
nsresult rv = nsMediaDocument::Init();
nsresult rv = MediaDocument::Init();
NS_ENSURE_SUCCESS(rv, rv);
mResizeImageByDefault = Preferences::GetBool(AUTOMATIC_IMAGE_RESIZING_PREF);
@ -299,18 +294,17 @@ nsImageDocument::Init()
}
nsresult
nsImageDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
ImageDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
{
nsresult rv =
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
MediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer,
aDocListener, aReset, aSink);
if (NS_FAILED(rv)) {
return rv;
}
@ -320,15 +314,13 @@ nsImageDocument::StartDocumentLoad(const char* aCommand,
NS_ASSERTION(aDocListener, "null aDocListener");
*aDocListener = new ImageListener(this);
if (!*aDocListener)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aDocListener);
return NS_OK;
}
void
nsImageDocument::Destroy()
ImageDocument::Destroy()
{
if (mImageContent) {
// Remove our event listener from the image content.
@ -351,11 +343,11 @@ nsImageDocument::Destroy()
mImageContent = nsnull;
}
nsMediaDocument::Destroy();
MediaDocument::Destroy();
}
void
nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
ImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
{
// If the script global object is changing, we need to unhook our event
// listeners on the window.
@ -392,39 +384,39 @@ nsImageDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObjec
}
void
nsImageDocument::OnPageShow(PRBool aPersisted,
nsIDOMEventTarget* aDispatchStartTarget)
ImageDocument::OnPageShow(PRBool aPersisted,
nsIDOMEventTarget* aDispatchStartTarget)
{
if (aPersisted) {
mOriginalZoomLevel =
Preferences::GetBool(SITE_SPECIFIC_ZOOM, PR_FALSE) ? 1.0 : GetZoomLevel();
}
nsMediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
MediaDocument::OnPageShow(aPersisted, aDispatchStartTarget);
}
NS_IMETHODIMP
nsImageDocument::GetImageResizingEnabled(PRBool* aImageResizingEnabled)
ImageDocument::GetImageResizingEnabled(PRBool* aImageResizingEnabled)
{
*aImageResizingEnabled = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsImageDocument::GetImageIsOverflowing(PRBool* aImageIsOverflowing)
ImageDocument::GetImageIsOverflowing(PRBool* aImageIsOverflowing)
{
*aImageIsOverflowing = mImageIsOverflowing;
return NS_OK;
}
NS_IMETHODIMP
nsImageDocument::GetImageIsResized(PRBool* aImageIsResized)
ImageDocument::GetImageIsResized(PRBool* aImageIsResized)
{
*aImageIsResized = mImageIsResized;
return NS_OK;
}
NS_IMETHODIMP
nsImageDocument::GetImageRequest(imgIRequest** aImageRequest)
ImageDocument::GetImageRequest(imgIRequest** aImageRequest)
{
nsCOMPtr<nsIImageLoadingContent> imageLoader = do_QueryInterface(mImageContent);
if (imageLoader) {
@ -437,7 +429,7 @@ nsImageDocument::GetImageRequest(imgIRequest** aImageRequest)
}
NS_IMETHODIMP
nsImageDocument::ShrinkToFit()
ImageDocument::ShrinkToFit()
{
if (!mImageContent) {
return NS_OK;
@ -468,13 +460,13 @@ nsImageDocument::ShrinkToFit()
}
NS_IMETHODIMP
nsImageDocument::RestoreImageTo(PRInt32 aX, PRInt32 aY)
ImageDocument::RestoreImageTo(PRInt32 aX, PRInt32 aY)
{
return ScrollImageTo(aX, aY, PR_TRUE);
}
nsresult
nsImageDocument::ScrollImageTo(PRInt32 aX, PRInt32 aY, PRBool restoreImage)
ImageDocument::ScrollImageTo(PRInt32 aX, PRInt32 aY, PRBool restoreImage)
{
float ratio = GetRatio();
@ -499,7 +491,7 @@ nsImageDocument::ScrollImageTo(PRInt32 aX, PRInt32 aY, PRBool restoreImage)
}
NS_IMETHODIMP
nsImageDocument::RestoreImage()
ImageDocument::RestoreImage()
{
if (!mImageContent) {
return NS_OK;
@ -525,7 +517,7 @@ nsImageDocument::RestoreImage()
}
NS_IMETHODIMP
nsImageDocument::ToggleImageSize()
ImageDocument::ToggleImageSize()
{
mShouldResize = PR_TRUE;
if (mImageIsResized) {
@ -542,12 +534,12 @@ nsImageDocument::ToggleImageSize()
}
NS_IMETHODIMP
nsImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
ImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
{
aImage->GetWidth(&mImageWidth);
aImage->GetHeight(&mImageHeight);
nsCOMPtr<nsIRunnable> runnable =
NS_NewRunnableMethod(this, &nsImageDocument::DefaultCheckOverflowing);
NS_NewRunnableMethod(this, &ImageDocument::DefaultCheckOverflowing);
nsContentUtils::AddScriptRunner(runnable);
UpdateTitleAndCharset();
@ -555,9 +547,9 @@ nsImageDocument::OnStartContainer(imgIRequest* aRequest, imgIContainer* aImage)
}
NS_IMETHODIMP
nsImageDocument::OnStopDecode(imgIRequest *aRequest,
nsresult aStatus,
const PRUnichar *aStatusArg)
ImageDocument::OnStopDecode(imgIRequest *aRequest,
nsresult aStatus,
const PRUnichar *aStatusArg)
{
UpdateTitleAndCharset();
@ -585,7 +577,7 @@ nsImageDocument::OnStopDecode(imgIRequest *aRequest,
}
NS_IMETHODIMP
nsImageDocument::HandleEvent(nsIDOMEvent* aEvent)
ImageDocument::HandleEvent(nsIDOMEvent* aEvent)
{
nsAutoString eventType;
aEvent->GetType(eventType);
@ -645,10 +637,10 @@ nsImageDocument::HandleEvent(nsIDOMEvent* aEvent)
}
nsresult
nsImageDocument::CreateSyntheticDocument()
ImageDocument::CreateSyntheticDocument()
{
// Synthesize an html document that refers to the image
nsresult rv = nsMediaDocument::CreateSyntheticDocument();
nsresult rv = MediaDocument::CreateSyntheticDocument();
NS_ENSURE_SUCCESS(rv, rv);
Element* body = GetBodyElement();
@ -691,7 +683,7 @@ nsImageDocument::CreateSyntheticDocument()
}
nsresult
nsImageDocument::CheckOverflowing(PRBool changeState)
ImageDocument::CheckOverflowing(PRBool changeState)
{
/* Create a scope so that the style context gets destroyed before we might
* call RebuildStyleData. Also, holding onto pointers to the
@ -747,7 +739,7 @@ nsImageDocument::CheckOverflowing(PRBool changeState)
}
void
nsImageDocument::UpdateTitleAndCharset()
ImageDocument::UpdateTitleAndCharset()
{
nsCAutoString typeStr;
nsCOMPtr<imgIRequest> imageRequest;
@ -805,12 +797,12 @@ nsImageDocument::UpdateTitleAndCharset()
"ImageTitleWithDimensionsAndFile",
};
nsMediaDocument::UpdateTitleAndCharset(typeStr, formatNames,
mImageWidth, mImageHeight, status);
MediaDocument::UpdateTitleAndCharset(typeStr, formatNames,
mImageWidth, mImageHeight, status);
}
void
nsImageDocument::ResetZoomLevel()
ImageDocument::ResetZoomLevel()
{
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
if (docShell) {
@ -828,7 +820,7 @@ nsImageDocument::ResetZoomLevel()
}
float
nsImageDocument::GetZoomLevel()
ImageDocument::GetZoomLevel()
{
float zoomLevel = mOriginalZoomLevel;
nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(mDocumentContainer);
@ -843,17 +835,18 @@ nsImageDocument::GetZoomLevel()
return zoomLevel;
}
} // namespace dom
} // namespace mozilla
DOMCI_DATA(ImageDocument, mozilla::dom::ImageDocument)
nsresult
NS_NewImageDocument(nsIDocument** aResult)
{
nsImageDocument* doc = new nsImageDocument();
if (!doc) {
return NS_ERROR_OUT_OF_MEMORY;
}
mozilla::dom::ImageDocument* doc = new mozilla::dom::ImageDocument();
NS_ADDREF(doc);
nsresult rv = doc->Init();
nsresult rv = doc->Init();
if (NS_FAILED(rv)) {
NS_RELEASE(doc);
}

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

@ -51,13 +51,13 @@ CPPSRCS = \
nsHTMLContentSink.cpp \
nsHTMLFragmentContentSink.cpp \
nsHTMLDocument.cpp \
nsImageDocument.cpp \
nsMediaDocument.cpp \
nsPluginDocument.cpp \
ImageDocument.cpp \
MediaDocument.cpp \
PluginDocument.cpp \
$(NULL)
ifdef MOZ_MEDIA
CPPSRCS += nsVideoDocument.cpp
CPPSRCS += VideoDocument.cpp
endif
EXPORTS = \
@ -73,10 +73,10 @@ INCLUDES += \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../events/src \
-I$(srcdir)/../../content/src \
-I$(srcdir)/../../../../layout/style \
-I$(srcdir)/../../../../dom/base \
-I$(srcdir)/../../../../xpcom/io \
-I$(srcdir)/../../../../caps/include \
-I$(topsrcdir)/layout/style \
-I$(topsrcdir)/dom/base \
-I$(topsrcdir)/xpcom/io \
-I$(topsrcdir)/caps/include \
$(NULL)
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMediaDocument.h"
#include "MediaDocument.h"
#include "nsGkAtoms.h"
#include "nsRect.h"
#include "nsPresContext.h"
@ -53,29 +53,32 @@
#include "nsIDocumentCharsetInfo.h"
#include "nsNodeInfoManager.h"
nsMediaDocumentStreamListener::nsMediaDocumentStreamListener(nsMediaDocument *aDocument)
namespace mozilla {
namespace dom {
MediaDocumentStreamListener::MediaDocumentStreamListener(MediaDocument *aDocument)
{
mDocument = aDocument;
}
nsMediaDocumentStreamListener::~nsMediaDocumentStreamListener()
MediaDocumentStreamListener::~MediaDocumentStreamListener()
{
}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsMediaDocumentStreamListener,
NS_IMPL_THREADSAFE_ISUPPORTS2(MediaDocumentStreamListener,
nsIRequestObserver,
nsIStreamListener)
void
nsMediaDocumentStreamListener::SetStreamListener(nsIStreamListener *aListener)
MediaDocumentStreamListener::SetStreamListener(nsIStreamListener *aListener)
{
mNextStream = aListener;
}
NS_IMETHODIMP
nsMediaDocumentStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
MediaDocumentStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
@ -89,9 +92,9 @@ nsMediaDocumentStreamListener::OnStartRequest(nsIRequest* request, nsISupports *
}
NS_IMETHODIMP
nsMediaDocumentStreamListener::OnStopRequest(nsIRequest* request,
nsISupports *ctxt,
nsresult status)
MediaDocumentStreamListener::OnStopRequest(nsIRequest* request,
nsISupports *ctxt,
nsresult status)
{
nsresult rv = NS_OK;
if (mNextStream) {
@ -105,11 +108,11 @@ nsMediaDocumentStreamListener::OnStopRequest(nsIRequest* request,
}
NS_IMETHODIMP
nsMediaDocumentStreamListener::OnDataAvailable(nsIRequest* request,
nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset,
PRUint32 count)
MediaDocumentStreamListener::OnDataAvailable(nsIRequest* request,
nsISupports *ctxt,
nsIInputStream *inStr,
PRUint32 sourceOffset,
PRUint32 count)
{
if (mNextStream) {
return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
@ -118,8 +121,8 @@ nsMediaDocumentStreamListener::OnDataAvailable(nsIRequest* request,
return NS_OK;
}
// default format names for nsMediaDocument.
const char* const nsMediaDocument::sFormatNames[4] =
// default format names for MediaDocument.
const char* const MediaDocument::sFormatNames[4] =
{
"MediaTitleWithNoInfo", // eWithNoInfo
"MediaTitleWithFile", // eWithFile
@ -127,15 +130,15 @@ const char* const nsMediaDocument::sFormatNames[4] =
"" // eWithDimAndFile
};
nsMediaDocument::nsMediaDocument()
MediaDocument::MediaDocument()
{
}
nsMediaDocument::~nsMediaDocument()
MediaDocument::~MediaDocument()
{
}
nsresult
nsMediaDocument::Init()
MediaDocument::Init()
{
nsresult rv = nsHTMLDocument::Init();
NS_ENSURE_SUCCESS(rv, rv);
@ -152,13 +155,13 @@ nsMediaDocument::Init()
}
nsresult
nsMediaDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
MediaDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
{
nsresult rv = nsDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
@ -227,7 +230,7 @@ nsMediaDocument::StartDocumentLoad(const char* aCommand,
}
nsresult
nsMediaDocument::CreateSyntheticDocument()
MediaDocument::CreateSyntheticDocument()
{
// Synthesize an empty html document
nsresult rv;
@ -273,7 +276,7 @@ nsMediaDocument::CreateSyntheticDocument()
}
nsresult
nsMediaDocument::StartLayout()
MediaDocument::StartLayout()
{
mMayStartLayout = PR_TRUE;
nsCOMPtr<nsIPresShell> shell = GetShell();
@ -289,7 +292,7 @@ nsMediaDocument::StartLayout()
}
void
nsMediaDocument::GetFileName(nsAString& aResult)
MediaDocument::GetFileName(nsAString& aResult)
{
aResult.Truncate();
@ -329,10 +332,10 @@ nsMediaDocument::GetFileName(nsAString& aResult)
}
void
nsMediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
const char* const* aFormatNames,
PRInt32 aWidth, PRInt32 aHeight,
const nsAString& aStatus)
MediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
const char* const* aFormatNames,
PRInt32 aWidth, PRInt32 aHeight,
const nsAString& aStatus)
{
nsXPIDLString fileStr;
GetFileName(fileStr);
@ -394,3 +397,6 @@ nsMediaDocument::UpdateTitleAndCharset(const nsACString& aTypeStr,
SetTitle(titleWithStatus);
}
}
} // namespace dom
} // namespace mozilla

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

@ -35,8 +35,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsMediaDocument_h___
#define nsMediaDocument_h___
#ifndef mozilla_dom_MediaDocument_h
#define mozilla_dom_MediaDocument_h
#include "nsHTMLDocument.h"
#include "nsGenericHTMLElement.h"
@ -45,11 +45,14 @@
#define NSMEDIADOCUMENT_PROPERTIES_URI "chrome://global/locale/layout/MediaDocument.properties"
class nsMediaDocument : public nsHTMLDocument
namespace mozilla {
namespace dom {
class MediaDocument : public nsHTMLDocument
{
public:
nsMediaDocument();
virtual ~nsMediaDocument();
MediaDocument();
virtual ~MediaDocument();
virtual nsresult Init();
@ -64,7 +67,7 @@ public:
protected:
virtual nsresult CreateSyntheticDocument();
friend class nsMediaDocumentStreamListener;
friend class MediaDocumentStreamListener;
nsresult StartLayout();
void GetFileName(nsAString& aResult);
@ -77,7 +80,7 @@ protected:
// "ImageTitleWithDimesions", "ImageTitleWithDimensionsAndFile".
//
// Also see MediaDocument.properties if you want to define format names
// for a new subclass. aWidth and aHeight are pixels for |nsImageDocument|,
// for a new subclass. aWidth and aHeight are pixels for |ImageDocument|,
// but could be in other units for other 'media', in which case you have to
// define format names accordingly.
void UpdateTitleAndCharset(const nsACString& aTypeStr,
@ -94,11 +97,11 @@ private:
};
class nsMediaDocumentStreamListener: public nsIStreamListener
class MediaDocumentStreamListener: public nsIStreamListener
{
public:
nsMediaDocumentStreamListener(nsMediaDocument *aDocument);
virtual ~nsMediaDocumentStreamListener();
MediaDocumentStreamListener(MediaDocument *aDocument);
virtual ~MediaDocumentStreamListener();
void SetStreamListener(nsIStreamListener *aListener);
NS_DECL_ISUPPORTS
@ -107,9 +110,11 @@ public:
NS_DECL_NSISTREAMLISTENER
nsRefPtr<nsMediaDocument> mDocument;
nsRefPtr<MediaDocument> mDocument;
nsCOMPtr<nsIStreamListener> mNextStream;
};
} // namespace dom
} // namespace mozilla
#endif /* nsMediaDocument_h___ */
#endif /* mozilla_dom_MediaDocument_h */

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

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMediaDocument.h"
#include "MediaDocument.h"
#include "nsIPluginDocument.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
@ -48,14 +48,15 @@
#include "nsIPropertyBag2.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
class nsPluginDocument : public nsMediaDocument,
public nsIPluginDocument
class PluginDocument : public MediaDocument
, public nsIPluginDocument
{
public:
nsPluginDocument();
virtual ~nsPluginDocument();
PluginDocument();
virtual ~PluginDocument();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIPLUGINDOCUMENT
@ -78,14 +79,14 @@ public:
mWillHandleInstantiation = PR_FALSE;
}
void StartLayout() { nsMediaDocument::StartLayout(); }
void StartLayout() { MediaDocument::StartLayout(); }
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsPluginDocument, nsMediaDocument)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(PluginDocument, MediaDocument)
protected:
nsresult CreateSyntheticPluginDocument();
nsCOMPtr<nsIContent> mPluginContent;
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
nsRefPtr<MediaDocumentStreamListener> mStreamListener;
nsCString mMimeType;
// Hack to handle the fact that plug-in loading lives in frames and that the
@ -94,21 +95,23 @@ protected:
PRBool mWillHandleInstantiation;
};
class nsPluginStreamListener : public nsMediaDocumentStreamListener
class PluginStreamListener : public MediaDocumentStreamListener
{
public:
nsPluginStreamListener(nsPluginDocument* doc) :
nsMediaDocumentStreamListener(doc), mPluginDoc(doc) {}
PluginStreamListener(PluginDocument* doc)
: MediaDocumentStreamListener(doc)
, mPluginDoc(doc)
{}
NS_IMETHOD OnStartRequest(nsIRequest* request, nsISupports *ctxt);
private:
nsresult SetupPlugin();
nsRefPtr<nsPluginDocument> mPluginDoc;
nsRefPtr<PluginDocument> mPluginDoc;
};
NS_IMETHODIMP
nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
PluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
{
// Have to set up our plugin stuff before we call OnStartRequest, so
// that the plugin listener can get that call.
@ -116,12 +119,12 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
NS_ASSERTION(NS_FAILED(rv) || mNextStream,
"We should have a listener by now");
nsresult rv2 = nsMediaDocumentStreamListener::OnStartRequest(request, ctxt);
nsresult rv2 = MediaDocumentStreamListener::OnStartRequest(request, ctxt);
return NS_SUCCEEDED(rv) ? rv2 : rv;
}
nsresult
nsPluginStreamListener::SetupPlugin()
PluginStreamListener::SetupPlugin()
{
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
mPluginDoc->StartLayout();
@ -170,38 +173,38 @@ nsPluginStreamListener::SetupPlugin()
// NOTE! nsDocument::operator new() zeroes out all members, so don't
// bother initializing members to 0.
nsPluginDocument::nsPluginDocument()
PluginDocument::PluginDocument()
: mWillHandleInstantiation(PR_TRUE)
{
}
nsPluginDocument::~nsPluginDocument()
PluginDocument::~PluginDocument()
{
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsPluginDocument)
NS_IMPL_CYCLE_COLLECTION_CLASS(PluginDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsPluginDocument, nsMediaDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PluginDocument, MediaDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPluginContent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsPluginDocument, nsMediaDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PluginDocument, MediaDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPluginContent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsMediaDocument)
NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsMediaDocument)
NS_IMPL_ADDREF_INHERITED(PluginDocument, MediaDocument)
NS_IMPL_RELEASE_INHERITED(PluginDocument, MediaDocument)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsPluginDocument)
NS_INTERFACE_TABLE_INHERITED1(nsPluginDocument, nsIPluginDocument)
NS_INTERFACE_TABLE_TAIL_INHERITING(nsMediaDocument)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(PluginDocument)
NS_INTERFACE_TABLE_INHERITED1(PluginDocument, nsIPluginDocument)
NS_INTERFACE_TABLE_TAIL_INHERITING(MediaDocument)
void
nsPluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
PluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
{
// Set the script global object on the superclass before doing
// anything that might require it....
nsMediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
MediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
if (aScriptGlobalObject) {
if (!mPluginContent) {
@ -219,7 +222,7 @@ nsPluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObje
PRBool
nsPluginDocument::CanSavePresentation(nsIRequest *aNewRequest)
PluginDocument::CanSavePresentation(nsIRequest *aNewRequest)
{
// Full-page plugins cannot be cached, currently, because we don't have
// the stream listener data to feed to the plugin instance.
@ -228,13 +231,13 @@ nsPluginDocument::CanSavePresentation(nsIRequest *aNewRequest)
nsresult
nsPluginDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
PluginDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
{
// do not allow message panes to host full-page plugins
// returning an error causes helper apps to take over
@ -248,9 +251,8 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
}
nsresult rv =
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
MediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer,
aDocListener, aReset, aSink);
if (NS_FAILED(rv)) {
return rv;
}
@ -260,7 +262,7 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
return rv;
}
mStreamListener = new nsPluginStreamListener(this);
mStreamListener = new PluginStreamListener(this);
if (!mStreamListener) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -271,13 +273,13 @@ nsPluginDocument::StartDocumentLoad(const char* aCommand,
}
nsresult
nsPluginDocument::CreateSyntheticPluginDocument()
PluginDocument::CreateSyntheticPluginDocument()
{
NS_ASSERTION(!GetShell() || !GetShell()->DidInitialReflow(),
"Creating synthetic plugin document content too late");
// make our generic document
nsresult rv = nsMediaDocument::CreateSyntheticDocument();
nsresult rv = MediaDocument::CreateSyntheticDocument();
NS_ENSURE_SUCCESS(rv, rv);
// then attach our plugin
@ -333,19 +335,19 @@ nsPluginDocument::CreateSyntheticPluginDocument()
}
NS_IMETHODIMP
nsPluginDocument::SetStreamListener(nsIStreamListener *aListener)
PluginDocument::SetStreamListener(nsIStreamListener *aListener)
{
if (mStreamListener) {
mStreamListener->SetStreamListener(aListener);
}
nsMediaDocument::UpdateTitleAndCharset(mMimeType);
MediaDocument::UpdateTitleAndCharset(mMimeType);
return NS_OK;
}
NS_IMETHODIMP
nsPluginDocument::Print()
PluginDocument::Print()
{
NS_ENSURE_TRUE(mPluginContent, NS_ERROR_FAILURE);
@ -369,16 +371,19 @@ nsPluginDocument::Print()
}
NS_IMETHODIMP
nsPluginDocument::GetWillHandleInstantiation(PRBool* aWillHandle)
PluginDocument::GetWillHandleInstantiation(PRBool* aWillHandle)
{
*aWillHandle = mWillHandleInstantiation;
return NS_OK;
}
} // namespace dom
} // namespace mozilla
nsresult
NS_NewPluginDocument(nsIDocument** aResult)
{
nsPluginDocument* doc = new nsPluginDocument();
mozilla::dom::PluginDocument* doc = new mozilla::dom::PluginDocument();
if (!doc) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -35,7 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsMediaDocument.h"
#include "MediaDocument.h"
#include "nsGkAtoms.h"
#include "nsNodeInfoManager.h"
#include "nsContentCreatorFunctions.h"
@ -43,9 +43,10 @@
#include "nsIDocShellTreeItem.h"
#include "mozilla/dom/Element.h"
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
class nsVideoDocument : public nsMediaDocument
class VideoDocument : public MediaDocument
{
public:
virtual nsresult StartDocumentLoad(const char* aCommand,
@ -64,25 +65,24 @@ protected:
nsresult CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsIStreamListener** aListener);
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
nsRefPtr<MediaDocumentStreamListener> mStreamListener;
};
nsresult
nsVideoDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
VideoDocument::StartDocumentLoad(const char* aCommand,
nsIChannel* aChannel,
nsILoadGroup* aLoadGroup,
nsISupports* aContainer,
nsIStreamListener** aDocListener,
PRBool aReset,
nsIContentSink* aSink)
{
nsresult rv =
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
aContainer, aDocListener, aReset,
aSink);
MediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, aContainer,
aDocListener, aReset, aSink);
NS_ENSURE_SUCCESS(rv, rv);
mStreamListener = new nsMediaDocumentStreamListener(this);
mStreamListener = new MediaDocumentStreamListener(this);
if (!mStreamListener)
return NS_ERROR_OUT_OF_MEMORY;
@ -96,11 +96,11 @@ nsVideoDocument::StartDocumentLoad(const char* aCommand,
}
nsresult
nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsIStreamListener** aListener)
VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsIStreamListener** aListener)
{
// make our generic document
nsresult rv = nsMediaDocument::CreateSyntheticDocument();
nsresult rv = MediaDocument::CreateSyntheticDocument();
NS_ENSURE_SUCCESS(rv, rv);
Element* body = GetBodyElement();
@ -137,7 +137,7 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
}
void
nsVideoDocument::UpdateTitle(nsIChannel* aChannel)
VideoDocument::UpdateTitle(nsIChannel* aChannel)
{
if (!aChannel)
return;
@ -147,10 +147,13 @@ nsVideoDocument::UpdateTitle(nsIChannel* aChannel)
SetTitle(fileName);
}
} // namespace dom
} // namespace mozilla
nsresult
NS_NewVideoDocument(nsIDocument** aResult)
{
nsVideoDocument* doc = new nsVideoDocument();
mozilla::dom::VideoDocument* doc = new mozilla::dom::VideoDocument();
if (!doc) {
return NS_ERROR_OUT_OF_MEMORY;
}

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

@ -143,7 +143,9 @@
#include "nsHtml5Module.h"
#include "prprf.h"
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
using namespace mozilla::dom;
#define NS_MAX_DOCUMENT_WRITE_DEPTH 20
@ -184,14 +186,13 @@ static PRBool ConvertToMidasInternalCommand(const nsAString & inCommandID,
static int
MyPrefChangedCallback(const char*aPrefName, void* instance_data)
{
const nsAdoptingString& detector_name =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detector_name =
Preferences::GetLocalizedCString("intl.charset.detector");
if (detector_name.Length() > 0) {
if (!detector_name.IsEmpty()) {
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
DETECTOR_CONTRACTID_MAX);
PL_strncat(g_detector_contractid,
NS_ConvertUTF16toUTF8(detector_name).get(),
PL_strncat(g_detector_contractid, detector_name,
DETECTOR_CONTRACTID_MAX);
gPlugDetector = PR_TRUE;
} else {
@ -542,11 +543,11 @@ nsHTMLDocument::UseWeakDocTypeDefault(PRInt32& aCharsetSource,
// fallback value in case docshell return error
aCharset.AssignLiteral("ISO-8859-1");
const nsAdoptingString& defCharset =
nsContentUtils::GetLocalizedStringPref("intl.charset.default");
const nsAdoptingCString& defCharset =
Preferences::GetLocalizedCString("intl.charset.default");
if (!defCharset.IsEmpty()) {
LossyCopyUTF16toASCII(defCharset, aCharset);
aCharset = defCharset;
aCharsetSource = kCharsetFromWeakDocTypeDefault;
}
return PR_TRUE;
@ -588,14 +589,13 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsACString& aCharset,
nsresult rv_detect;
if(!gInitDetector) {
const nsAdoptingString& detector_name =
nsContentUtils::GetLocalizedStringPref("intl.charset.detector");
const nsAdoptingCString& detector_name =
Preferences::GetLocalizedCString("intl.charset.detector");
if(!detector_name.IsEmpty()) {
PL_strncpy(g_detector_contractid, NS_CHARSET_DETECTOR_CONTRACTID_BASE,
DETECTOR_CONTRACTID_MAX);
PL_strncat(g_detector_contractid,
NS_ConvertUTF16toUTF8(detector_name).get(),
PL_strncat(g_detector_contractid, detector_name,
DETECTOR_CONTRACTID_MAX);
gPlugDetector = PR_TRUE;
}

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

@ -59,6 +59,9 @@ extern "C" {
}
#include "mozilla/TimeStamp.h"
#include "nsThreadUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
#if defined(XP_MACOSX)
#define SA_PER_STREAM_VOLUME 1
@ -321,8 +324,7 @@ static mozilla::Mutex* gVolumeScaleLock = nsnull;
static double gVolumeScale = 1.0;
static int VolumeScaleChanged(const char* aPref, void *aClosure) {
nsAdoptingString value =
nsContentUtils::GetStringPref("media.volume_scale");
nsAdoptingString value = Preferences::GetString("media.volume_scale");
mozilla::MutexAutoLock lock(*gVolumeScaleLock);
if (value.IsEmpty()) {
gVolumeScale = 1.0;

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

@ -56,6 +56,9 @@
#include "nsSVGUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
/*static*/ PRBool
nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
@ -239,7 +242,7 @@ nsSVGFeatures::PassesConditionalProcessingTests(nsIContent *aContent,
value)) {
const nsAutoString acceptLangs(aAcceptLangs ? *aAcceptLangs :
nsContentUtils::GetLocalizedStringPref("intl.accept_languages"));
Preferences::GetLocalizedString("intl.accept_languages"));
// Get our language preferences
if (!acceptLangs.IsEmpty()) {

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

@ -39,6 +39,9 @@
#include "nsIFrame.h"
#include "nsISVGChildFrame.h"
#include "nsSVGUtils.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
////////////////////////////////////////////////////////////////////////
// implementation
@ -162,7 +165,7 @@ nsSVGSwitchElement::FindActiveChild() const
nsGkAtoms::yes, eCaseMatters);
const nsAdoptingString& acceptLangs =
nsContentUtils::GetLocalizedStringPref("intl.accept_languages");
Preferences::GetLocalizedString("intl.accept_languages");
PRUint32 count = GetChildCount();

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

@ -70,6 +70,9 @@
#include "nsIPrivateDOMEvent.h"
#include "nsISelectionController.h"
#include "nsGUIEvent.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
static nsINativeKeyBindings *sNativeEditorBindings = nsnull;
@ -124,7 +127,7 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
getter_AddRefs(mHTMLBindings));
const nsAdoptingCString& userHTMLBindingStr =
nsContentUtils::GetCharPref("dom.userHTMLBindings.uri");
Preferences::GetCString("dom.userHTMLBindings.uri");
if (!userHTMLBindingStr.IsEmpty()) {
NS_NewURI(getter_AddRefs(bindingURI), userHTMLBindingStr);
if (!bindingURI) {

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

@ -47,7 +47,6 @@ XPIDL_MODULE = content_xslt
EXPORTS = \
nsIDocumentTransformer.h \
txDouble.h \
$(NULL)
XPIDLSRCS = \

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

@ -1,133 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** 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
* Peter Van der Beken.
* Portions created by the Initial Developer are Copyright (C) 2005
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Peter Van der Beken <peterv@propagandism.org>
*
*
* 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 ***** */
#ifndef __txdouble_h__
#define __txdouble_h__
//A trick to handle IEEE floating point exceptions on FreeBSD - E.D.
#ifdef __FreeBSD__
#include <ieeefp.h>
#ifdef __alpha__
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP;
#else
static fp_except_t allmask = FP_X_INV|FP_X_OFL|FP_X_UFL|FP_X_DZ|FP_X_IMP|FP_X_DNML;
#endif
static fp_except_t oldmask = fpsetmask(~allmask);
#endif
/**
* Macros to workaround math-bugs bugs in various platforms
*/
/**
* Stefan Hanske <sh990154@mail.uni-greifswald.de> reports:
* ARM is a little endian architecture but 64 bit double words are stored
* differently: the 32 bit words are in little endian byte order, the two words
* are stored in big endian`s way.
*/
#if defined(__arm) || defined(__arm32__) || defined(__arm26__) || defined(__arm__)
#if !defined(__VFP_FP__)
#define FPU_IS_ARM_FPA
#endif
#endif
typedef union txdpun {
struct {
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
PRUint32 lo, hi;
#else
PRUint32 hi, lo;
#endif
} s;
PRFloat64 d;
public:
operator double() const {
return d;
}
} txdpun;
#if (__GNUC__ == 2 && __GNUC_MINOR__ > 95) || __GNUC__ > 2
/**
* This version of the macros is safe for the alias optimizations
* that gcc does, but uses gcc-specific extensions.
*/
#define TX_DOUBLE_HI32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.hi; }))
#define TX_DOUBLE_LO32(x) (__extension__ ({ txdpun u; u.d = (x); u.s.lo; }))
#else // __GNUC__
/* We don't know of any non-gcc compilers that perform alias optimization,
* so this code should work.
*/
#if defined(IS_LITTLE_ENDIAN) && !defined(FPU_IS_ARM_FPA)
#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[1])
#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[0])
#else
#define TX_DOUBLE_HI32(x) (((PRUint32 *)&(x))[0])
#define TX_DOUBLE_LO32(x) (((PRUint32 *)&(x))[1])
#endif
#endif // __GNUC__
#define TX_DOUBLE_HI32_SIGNBIT 0x80000000
#define TX_DOUBLE_HI32_EXPMASK 0x7ff00000
#define TX_DOUBLE_HI32_MANTMASK 0x000fffff
#define TX_DOUBLE_IS_NaN(x) \
((TX_DOUBLE_HI32(x) & TX_DOUBLE_HI32_EXPMASK) == TX_DOUBLE_HI32_EXPMASK && \
(TX_DOUBLE_LO32(x) || (TX_DOUBLE_HI32(x) & TX_DOUBLE_HI32_MANTMASK)))
#ifdef IS_BIG_ENDIAN
#define TX_DOUBLE_NaN {{TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK, \
0xffffffff}}
#else
#define TX_DOUBLE_NaN {{0xffffffff, \
TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK}}
#endif
#if defined(XP_WIN)
#define TX_DOUBLE_COMPARE(LVAL, OP, RVAL) \
(!TX_DOUBLE_IS_NaN(LVAL) && !TX_DOUBLE_IS_NaN(RVAL) && (LVAL) OP (RVAL))
#else
#define TX_DOUBLE_COMPARE(LVAL, OP, RVAL) ((LVAL) OP (RVAL))
#endif
#endif /* __txdouble_h__ */

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

@ -39,11 +39,11 @@
#ifndef __txCore_h__
#define __txCore_h__
#include "nsContentUtils.h"
#include "nscore.h"
#include "nsDebug.h"
#include "nsTraceRefcnt.h"
#include "prtypes.h"
#include "txDouble.h"
class nsAString;
@ -73,9 +73,9 @@ public:
/**
* Useful constants
*/
static const txdpun NaN;
static const txdpun POSITIVE_INFINITY;
static const txdpun NEGATIVE_INFINITY;
static const dpun NaN;
static const dpun POSITIVE_INFINITY;
static const dpun NEGATIVE_INFINITY;
/**
* Determines whether the given double represents positive or negative

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

@ -50,13 +50,13 @@
*/
//-- Initialize Double related constants
const txdpun Double::NaN = TX_DOUBLE_NaN;
const dpun Double::NaN = DOUBLE_NaN;
#ifdef IS_BIG_ENDIAN
const txdpun Double::POSITIVE_INFINITY = {{TX_DOUBLE_HI32_EXPMASK, 0}};
const txdpun Double::NEGATIVE_INFINITY = {{TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT, 0}};
const dpun Double::POSITIVE_INFINITY = {{DOUBLE_HI32_EXPMASK, 0}};
const txdpun Double::NEGATIVE_INFINITY = {{DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT, 0}};
#else
const txdpun Double::POSITIVE_INFINITY = {{0, TX_DOUBLE_HI32_EXPMASK}};
const txdpun Double::NEGATIVE_INFINITY = {{0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT}};
const dpun Double::POSITIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK}};
const dpun Double::NEGATIVE_INFINITY = {{0, DOUBLE_HI32_EXPMASK | DOUBLE_HI32_SIGNBIT}};
#endif
/*
@ -65,8 +65,8 @@ const txdpun Double::NEGATIVE_INFINITY = {{0, TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE
*/
MBool Double::isInfinite(double aDbl)
{
return ((TX_DOUBLE_HI32(aDbl) & ~TX_DOUBLE_HI32_SIGNBIT) == TX_DOUBLE_HI32_EXPMASK &&
!TX_DOUBLE_LO32(aDbl));
return ((DOUBLE_HI32(aDbl) & ~DOUBLE_HI32_SIGNBIT) == DOUBLE_HI32_EXPMASK &&
!DOUBLE_LO32(aDbl));
}
/*
@ -74,7 +74,7 @@ MBool Double::isInfinite(double aDbl)
*/
MBool Double::isNaN(double aDbl)
{
return TX_DOUBLE_IS_NaN(aDbl);
return DOUBLE_IS_NaN(aDbl);
}
/*
@ -82,7 +82,7 @@ MBool Double::isNaN(double aDbl)
*/
MBool Double::isNeg(double aDbl)
{
return (TX_DOUBLE_HI32(aDbl) & TX_DOUBLE_HI32_SIGNBIT) != 0;
return (DOUBLE_HI32(aDbl) & DOUBLE_HI32_SIGNBIT) != 0;
}
/*

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

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsContentUtils.h"
#include "txExpr.h"
#include "txDouble.h"
#include "txNodeSet.h"
#include "txIXPathContext.h"
#include "txXPathTreeWalker.h"
@ -119,7 +119,7 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
rtype == txAExprResult::NUMBER) {
double lval = aLeft->numberValue();
double rval = aRight->numberValue();
result = TX_DOUBLE_COMPARE(lval, ==, rval);
result = DOUBLE_COMPARE(lval, ==, rval);
}
// Otherwise compare as strings. Try to use the stringobject in
@ -154,19 +154,19 @@ RelationalExpr::compareResults(txIEvalContext* aContext, txAExprResult* aLeft,
switch (mOp) {
case LESS_THAN:
{
return TX_DOUBLE_COMPARE(leftDbl, <, rightDbl);
return DOUBLE_COMPARE(leftDbl, <, rightDbl);
}
case LESS_OR_EQUAL:
{
return TX_DOUBLE_COMPARE(leftDbl, <=, rightDbl);
return DOUBLE_COMPARE(leftDbl, <=, rightDbl);
}
case GREATER_THAN:
{
return TX_DOUBLE_COMPARE(leftDbl, >, rightDbl);
return DOUBLE_COMPARE(leftDbl, >, rightDbl);
}
case GREATER_OR_EQUAL:
{
return TX_DOUBLE_COMPARE(leftDbl, >=, rightDbl);
return DOUBLE_COMPARE(leftDbl, >=, rightDbl);
}
default:
{

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

@ -25868,7 +25868,7 @@ SQLITE_API int sqlite3_fullsync_count = 0;
** If you know that your system does support fdatasync() correctly,
** then simply compile with -Dfdatasync=fdatasync
*/
#if !defined(fdatasync) && !defined(__linux__)
#if (!defined(fdatasync) && !defined(__linux__)) || defined(ANDROID)
# define fdatasync fsync
#endif

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

@ -251,7 +251,6 @@
#ifdef MOZ_CSS_ANIMATIONS
#include "nsIDOMAnimationEvent.h"
#endif
#include "nsIDOMNSDocumentStyle.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMLinkStyle.h"
@ -795,8 +794,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLDListElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLDelElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLDirectoryElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLDivElement, nsElementSH,
@ -829,8 +826,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLInputElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLInsElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLIsIndexElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLLIElement, nsElementSH,
@ -847,6 +842,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLMetaElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLModElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLOListElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(HTMLObjectElement, nsHTMLPluginObjElementSH,
@ -2328,8 +2325,6 @@ nsDOMClassInfo::RegisterExternalClasses()
#define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget) \
@ -2728,11 +2723,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(HTMLDelElement, nsIDOMHTMLElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLModElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLDirectoryElement, nsIDOMHTMLDirectoryElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDirectoryElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
@ -2814,11 +2804,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(HTMLInsElement, nsIDOMHTMLElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLModElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLIsIndexElement, nsIDOMHTMLIsIndexElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLIsIndexElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
@ -2860,6 +2845,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLModElement, nsIDOMHTMLModElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLModElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(HTMLOListElement, nsIDOMHTMLOListElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLOListElement)
DOM_CLASSINFO_GENERIC_HTML_MAP_ENTRIES

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

@ -94,7 +94,6 @@ DOMCI_CLASS(HTMLBodyElement)
DOMCI_CLASS(HTMLButtonElement)
DOMCI_CLASS(HTMLDataListElement)
DOMCI_CLASS(HTMLDListElement)
DOMCI_CLASS(HTMLDelElement)
DOMCI_CLASS(HTMLDirectoryElement)
DOMCI_CLASS(HTMLDivElement)
DOMCI_CLASS(HTMLEmbedElement)
@ -110,7 +109,6 @@ DOMCI_CLASS(HTMLHtmlElement)
DOMCI_CLASS(HTMLIFrameElement)
DOMCI_CLASS(HTMLImageElement)
DOMCI_CLASS(HTMLInputElement)
DOMCI_CLASS(HTMLInsElement)
DOMCI_CLASS(HTMLIsIndexElement)
DOMCI_CLASS(HTMLLIElement)
DOMCI_CLASS(HTMLLabelElement)
@ -119,6 +117,7 @@ DOMCI_CLASS(HTMLLinkElement)
DOMCI_CLASS(HTMLMapElement)
DOMCI_CLASS(HTMLMenuElement)
DOMCI_CLASS(HTMLMetaElement)
DOMCI_CLASS(HTMLModElement)
DOMCI_CLASS(HTMLOListElement)
DOMCI_CLASS(HTMLObjectElement)
DOMCI_CLASS(HTMLOptGroupElement)

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

@ -920,8 +920,8 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
}
if (gDumpFile == nsnull) {
const nsAdoptingCString& fname =
nsContentUtils::GetCharPref("browser.dom.window.dump.file");
const nsAdoptingCString& fname =
Preferences::GetCString("browser.dom.window.dump.file");
if (!fname.IsEmpty()) {
// if this fails to open, Dump() knows to just go to stdout
// on null.
@ -5007,7 +5007,7 @@ nsGlobalWindow::Home()
return NS_OK;
nsAdoptingString homeURL =
nsContentUtils::GetLocalizedStringPref(PREF_BROWSER_STARTUP_HOMEPAGE);
Preferences::GetLocalizedString(PREF_BROWSER_STARTUP_HOMEPAGE);
if (homeURL.IsEmpty()) {
// if all else fails, use this
@ -10547,11 +10547,11 @@ nsresult
NS_GetNavigatorPlatform(nsAString& aPlatform)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.platform.override");
const nsAdoptingString& override =
Preferences::GetString("general.platform.override");
if (override) {
CopyUTF8toUTF16(override, aPlatform);
aPlatform = override;
return NS_OK;
}
}
@ -10591,11 +10591,11 @@ nsresult
NS_GetNavigatorAppVersion(nsAString& aAppVersion)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.appversion.override");
const nsAdoptingString& override =
Preferences::GetString("general.appversion.override");
if (override) {
CopyUTF8toUTF16(override, aAppVersion);
aAppVersion = override;
return NS_OK;
}
}
@ -10628,11 +10628,11 @@ nsresult
NS_GetNavigatorAppName(nsAString& aAppName)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.appname.override");
const nsAdoptingString& override =
Preferences::GetString("general.appname.override");
if (override) {
CopyUTF8toUTF16(override, aAppName);
aAppName = override;
return NS_OK;
}
}
@ -10691,7 +10691,7 @@ nsNavigator::GetLanguage(nsAString& aLanguage)
{
// e.g. "de-de, en-us,en"
const nsAdoptingString& acceptLang =
nsContentUtils::GetLocalizedStringPref("intl.accept_languages");
Preferences::GetLocalizedString("intl.accept_languages");
// take everything before the first "," or ";", without trailing space
nsCharSeparatedTokenizer langTokenizer(acceptLang, ',');
const nsSubstring &firstLangPart = langTokenizer.nextToken();
@ -10736,11 +10736,11 @@ NS_IMETHODIMP
nsNavigator::GetOscpu(nsAString& aOSCPU)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.oscpu.override");
const nsAdoptingString& override =
Preferences::GetString("general.oscpu.override");
if (override) {
CopyUTF8toUTF16(override, aOSCPU);
aOSCPU = override;
return NS_OK;
}
}
@ -10791,21 +10791,21 @@ NS_IMETHODIMP
nsNavigator::GetProductSub(nsAString& aProductSub)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.productSub.override");
const nsAdoptingString& override =
Preferences::GetString("general.productSub.override");
if (override) {
CopyUTF8toUTF16(override, aProductSub);
aProductSub = override;
return NS_OK;
} else {
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
const nsAdoptingCString& override2 =
nsContentUtils::GetCharPref("general.useragent.productSub");
}
if (override2) {
CopyUTF8toUTF16(override2, aProductSub);
return NS_OK;
}
// 'general.useragent.productSub' backwards compatible with 1.8 branch.
const nsAdoptingString& override2 =
Preferences::GetString("general.useragent.productSub");
if (override2) {
aProductSub = override2;
return NS_OK;
}
}
@ -10878,11 +10878,11 @@ NS_IMETHODIMP
nsNavigator::GetBuildID(nsAString& aBuildID)
{
if (!nsContentUtils::IsCallerTrustedForRead()) {
const nsAdoptingCString& override =
nsContentUtils::GetCharPref("general.buildID.override");
const nsAdoptingString& override =
Preferences::GetString("general.buildID.override");
if (override) {
CopyUTF8toUTF16(override, aBuildID);
aBuildID = override;
return NS_OK;
}
}

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

@ -25,6 +25,7 @@
* Jonas Sicking <sicking@bigfoot.com>
* Ms2ger <ms2ger@gmail.com>
* Tom Pixley <joki@netscape.com>
* Boris Zbarsky <bzbarsky@mit.edu>
*
* 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"),
@ -59,7 +60,7 @@ interface nsIDOMTreeWalker;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(61b2159c-614e-4aff-a626-f34af9bb1759)]
[scriptable, uuid(6e229ccc-ee4a-458b-a298-6ce3146f0904)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -143,4 +144,80 @@ interface nsIDOMDocument : nsIDOMNode
nsIDOMEvent createEvent(in DOMString eventType)
raises(DOMException);
readonly attribute nsIDOMStyleSheetList styleSheets;
/**
* This attribute must return the preferred style sheet set as set by the
* author. It is determined from the order of style sheet declarations and
* the Default-Style HTTP headers, as eventually defined elsewhere in the Web
* Apps 1.0 specification. If there is no preferred style sheet set, this
* attribute must return the empty string. The case of this attribute must
* exactly match the case given by the author where the preferred style sheet
* is specified or implied. This attribute must never return null.
*/
readonly attribute DOMString preferredStyleSheetSet;
/**
* This attribute indicates which style sheet set is in use. This attribute
* is live; changing the disabled attribute on style sheets directly will
* change the value of this attribute.
*
* If all the sheets that are enabled and have a title have the same title
* (by case-sensitive comparisons) then the value of this attribute must be
* exactly equal to the title of the first enabled style sheet with a title
* in the styleSheets list. Otherwise, if style sheets from different sets
* are enabled, then the return value must be null (there is no way to
* determine what the currently selected style sheet set is in those
* conditions). Otherwise, either all style sheets that have a title are
* disabled, or there are no alternate style sheets, and
* selectedStyleSheetSet must return the empty string.
*
* Setting this attribute to the null value must have no effect.
*
* Setting this attribute to a non-null value must call
* enableStyleSheetsForSet() with that value as the function's argument, and
* set lastStyleSheetSet to that value.
*
* From the DOM's perspective, all views have the same
* selectedStyleSheetSet. If a UA supports multiple views with different
* selected alternate style sheets, then this attribute (and the StyleSheet
* interface's disabled attribute) must return and set the value for the
* default view.
*/
attribute DOMString selectedStyleSheetSet;
/*
* This property must initially have the value null. Its value changes when
* the selectedStyleSheetSet attribute is set.
*/
readonly attribute DOMString lastStyleSheetSet;
/**
* This must return the live list of the currently available style sheet
* sets. This list is constructed by enumerating all the style sheets for
* this document available to the implementation, in the order they are
* listed in the styleSheets attribute, adding the title of each style sheet
* with a title to the list, avoiding duplicates by dropping titles that
* match (case-sensitively) titles that have already been added to the
* list.
*/
readonly attribute nsIDOMDOMStringList styleSheetSets;
/**
* Calling this method must change the disabled attribute on each StyleSheet
* object with a title attribute with a length greater than 0 in the
* styleSheets attribute, so that all those whose title matches the name
* argument are enabled, and all others are disabled. Title matches must be
* case-sensitive. Calling this method with the empty string disables all
* alternate and preferred style sheets (but does not change the state of
* persistent style sheets, that is those with no title attribute).
*
* Calling this method with a null value must have no effect.
*
* Style sheets that do not have a title are never affected by this
* method. This method does not change the values of the lastStyleSheetSet or
* preferredStyleSheetSet attributes.
*/
void enableStyleSheetsForSet(in DOMString name);
};

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

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(75f617b4-1c61-4122-9fd7-f4243672848b)]
[scriptable, uuid(8f688a87-637d-40f0-95f9-913de35ac6d7)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

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

@ -68,7 +68,6 @@ XPIDLSRCS = \
nsIDOMCSSStyleRule.idl \
nsIDOMCSSUnknownRule.idl \
nsIDOMCounter.idl \
nsIDOMDocumentCSS.idl \
nsIDOMRGBColor.idl \
nsIDOMRect.idl \
nsIDOMNSRGBAColor.idl \

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

@ -53,8 +53,9 @@
*/
interface nsIDOMFile;
interface nsIVariant;
[scriptable, uuid(2e98cd39-2269-493a-a3bb-abe85be2523c)]
[scriptable, uuid(010d8e6f-86ba-47ad-a04f-1a4d75f1caf8)]
interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
{
attribute unsigned long width;
@ -68,18 +69,10 @@ interface nsIDOMHTMLCanvasElement : nsIDOMHTMLElement
// Valid calls are:
// toDataURL(); -- defaults to image/png
// toDataURL(type); -- uses given type
// toDataURL(type, params); -- only available to trusted callers
// toDataURL(type, params); -- uses given type, and any valid parameters
[optional_argc] DOMString toDataURL([optional] in DOMString type,
[optional] in DOMString params);
[optional] in nsIVariant params);
// This version lets you specify different image types and pass parameters
// to the encoder. For example toDataURLAs("image/png", "transparency=none")
// gives you a PNG with the alpha channel discarded. See the encoder for
// the options string that it supports. Separate multiple options with
// semicolons.
[noscript] DOMString toDataURLAs(in DOMString mimeType, in DOMString encoderOptions);
// Valid calls are
// mozGetAsFile(name); -- defaults to image/png
// mozGetAsFile(name, type); -- uses given type

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

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(eb3750ae-d156-4b97-b200-f35276c6510f)]
[scriptable, uuid(a48d2e22-e0e7-49eb-bfd2-71386595cd9a)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString title;

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

@ -47,7 +47,6 @@ XPIDL_MODULE = dom_stylesheets
GRE_MODULE = 1
SDK_XPIDLSRCS = \
nsIDOMDocumentStyle.idl \
nsIDOMMediaList.idl \
nsIDOMStyleSheet.idl \
nsIDOMStyleSheetList.idl \
@ -55,7 +54,6 @@ SDK_XPIDLSRCS = \
XPIDLSRCS = \
nsIDOMLinkStyle.idl \
nsIDOMNSDocumentStyle.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

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

@ -1,129 +0,0 @@
/* -*- Mode: IDL; 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 nsIDOMNSDocumentStyle interface definition.
*
* The Initial Developer of the Original Code is
* Boris Zbarsky <bzbarsky@mit.edu>
* Portions created by the Initial Developer are Copyright (C) 2003
* 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 "domstubs.idl"
#include "nsIDOMDocumentStyle.idl"
/**
* The nsIDOMNSDocumentStyle interface is an extension to the
* nsIDOMDocumentStyle interface. This interface exposes more ways to interact
* with style sheets in the Document Object Model. This interface is currently
* very much experimental.
*
* NOTE: This interface represents the additions to nsIDOMDocumentStyle defined
* by <http://whatwg.org/specs/web-apps/current-work/#alternate-style-sheets>.
* The comments here describe our implementation; if those comments don't match
* that spec, file bugs.
*/
[scriptable, uuid(26311d10-7e24-4c7b-bb3d-17aad86f4d88)]
interface nsIDOMNSDocumentStyle : nsIDOMDocumentStyle
{
/**
* This attribute must return the preferred style sheet set as set by the
* author. It is determined from the order of style sheet declarations and
* the Default-Style HTTP headers, as eventually defined elsewhere in the Web
* Apps 1.0 specification. If there is no preferred style sheet set, this
* attribute must return the empty string. The case of this attribute must
* exactly match the case given by the author where the preferred style sheet
* is specified or implied. This attribute must never return null.
*/
readonly attribute DOMString preferredStyleSheetSet;
/**
* This attribute indicates which style sheet set is in use. This attribute
* is live; changing the disabled attribute on style sheets directly will
* change the value of this attribute.
*
* If all the sheets that are enabled and have a title have the same title
* (by case-sensitive comparisons) then the value of this attribute must be
* exactly equal to the title of the first enabled style sheet with a title
* in the styleSheets list. Otherwise, if style sheets from different sets
* are enabled, then the return value must be null (there is no way to
* determine what the currently selected style sheet set is in those
* conditions). Otherwise, either all style sheets that have a title are
* disabled, or there are no alternate style sheets, and
* selectedStyleSheetSet must return the empty string.
*
* Setting this attribute to the null value must have no effect.
*
* Setting this attribute to a non-null value must call
* enableStyleSheetsForSet() with that value as the function's argument, and
* set lastStyleSheetSet to that value.
*
* From the DOM's perspective, all views have the same
* selectedStyleSheetSet. If a UA supports multiple views with different
* selected alternate style sheets, then this attribute (and the StyleSheet
* interface's disabled attribute) must return and set the value for the
* default view.
*/
attribute DOMString selectedStyleSheetSet;
/*
* This property must initially have the value null. Its value changes when
* the selectedStyleSheetSet attribute is set.
*/
readonly attribute DOMString lastStyleSheetSet;
/**
* This must return the live list of the currently available style sheet
* sets. This list is constructed by enumerating all the style sheets for
* this document available to the implementation, in the order they are
* listed in the styleSheets attribute, adding the title of each style sheet
* with a title to the list, avoiding duplicates by dropping titles that
* match (case-sensitively) titles that have already been added to the
* list.
*/
readonly attribute nsIDOMDOMStringList styleSheetSets;
/**
* Calling this method must change the disabled attribute on each StyleSheet
* object with a title attribute with a length greater than 0 in the
* styleSheets attribute, so that all those whose title matches the name
* argument are enabled, and all others are disabled. Title matches must be
* case-sensitive. Calling this method with the empty string disables all
* alternate and preferred style sheets (but does not change the state of
* persistent style sheets, that is those with no title attribute).
*
* Calling this method with a null value must have no effect.
*
* Style sheets that do not have a title are never affected by this
* method. This method does not change the values of the lastStyleSheetSet or
* preferredStyleSheetSet attributes.
*/
void enableStyleSheetsForSet(in DOMString name);
};

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

@ -39,7 +39,7 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(2de25143-3fcb-4afc-8900-2c046fb6dc94)]
[scriptable, uuid(27c3e91d-d17d-40bd-ac56-e6b8096a955e)]
interface nsIDOMSVGDocument : nsIDOMDocument
{
readonly attribute DOMString title;

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

@ -966,8 +966,7 @@ nsresult nsPluginHost::InstantiatePluginForChannel(nsIChannel* aChannel,
nsresult
nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
nsIPluginInstanceOwner* aOwner,
PRBool aAllowOpeningStreams)
nsIPluginInstanceOwner* aOwner)
{
NS_ENSURE_ARG_POINTER(aOwner);
@ -1000,14 +999,9 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
return rv;
}
// Security checks
// Can't do security checks without a URI - hopefully the plugin will take
// care of that
// No need to do the security check if aAllowOpeningStreams is
// false; we don't plan to do any network access in that case.
// Furthermore, doing it could reenter plugin instantiation, which
// would be Bad.
if (aURL && aAllowOpeningStreams) {
// Security checks. Can't do security checks without a URI - hopefully the plugin
// will take care of that.
if (aURL) {
nsCOMPtr<nsIScriptSecurityManager> secMan =
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
if (NS_FAILED(rv))
@ -1044,14 +1038,14 @@ nsPluginHost::InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
isJava = pluginTag->mIsJavaPlugin;
}
// Determine if the scheme of this URL is one we can handle internaly because we should
// Determine if the scheme of this URL is one we can handle internally because we should
// only open the initial stream if it's one that we can handle internally. Otherwise
// |NS_OpenURI| in |InstantiateEmbeddedPlugin| may open up a OS protocal registered helper app
// Also set bCanHandleInternally to true if aAllowOpeningStreams is
// false; we don't want to do any network traffic in that case.
PRBool bCanHandleInternally = PR_FALSE;
nsCAutoString scheme;
if (aURL && aAllowOpeningStreams && NS_SUCCEEDED(aURL->GetScheme(scheme))) {
if (aURL && NS_SUCCEEDED(aURL->GetScheme(scheme))) {
nsCAutoString contractID(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX);
contractID += scheme;
ToLowerCase(contractID);

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

@ -219,8 +219,7 @@ public:
// The last argument should be false if we already have an in-flight stream
// and don't need to set up a new stream.
nsresult InstantiateEmbeddedPlugin(const char *aMimeType, nsIURI* aURL,
nsIPluginInstanceOwner* aOwner,
PRBool aAllowOpeningStreams);
nsIPluginInstanceOwner* aOwner);
nsresult InstantiateFullPagePlugin(const char *aMimeType,
nsIURI* aURI,

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

@ -653,22 +653,8 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request,
mOwner->GetWindow(window);
if (!mPluginInstance && window) {
nsRefPtr<nsPluginHost> pluginHost = dont_AddRef(nsPluginHost::GetInst());
// determine if we need to try embedded again. FullPage takes a different code path
PRInt32 mode;
mOwner->GetMode(&mode);
if (mode == NP_EMBED) {
// Make sure to not allow new streams to be opened here; we've
// already got a stream for this data; we just need a properly
// set up plugin instance.
rv = pluginHost->InstantiateEmbeddedPlugin(aContentType.get(), aURL,
mOwner, PR_FALSE);
}
else {
rv = pluginHost->SetUpPluginInstance(aContentType.get(), aURL, mOwner);
}
if (NS_OK == rv) {
rv = pluginHost->SetUpPluginInstance(aContentType.get(), aURL, mOwner);
if (NS_SUCCEEDED(rv)) {
mOwner->GetInstance(getter_AddRefs(pluginInstRefPtr));
mPluginInstance = pluginInstRefPtr.get();
if (mPluginInstance) {

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

@ -32,20 +32,6 @@ new Test.Unit.Runner({
this.assertEqual("Hello world!", h2.innerHTML);
},
testAsynchronousRequest: function() {
this.assertEqual("", $("content").innerHTML);
new Ajax.Request("../fixtures/hello.js", extendDefault({
asynchronous: true,
method: 'get',
evalJS: 'force'
}));
this.wait(1000, function() {
var h2 = $("content").firstChild;
this.assertEqual("Hello world!", h2.innerHTML);
});
},
testUpdater: function() {
this.assertEqual("", $("content").innerHTML);

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

@ -1,97 +1,97 @@
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
#include <d3d9.h>
#include <windows.h>
namespace gl
{
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
#if !defined(ANGLE_DISABLE_PERF)
if (perfActive())
{
char message[4096];
int len = vsprintf_s(message, format, vararg);
if (len < 0)
{
return;
}
// There are no ASCII variants of these D3DPERF functions.
wchar_t wideMessage[4096];
for (int i = 0; i < len; ++i)
{
wideMessage[i] = message[i];
}
wideMessage[len] = 0;
perfFunc(0, wideMessage);
}
#endif
#if !defined(ANGLE_DISABLE_TRACE)
#if defined(NDEBUG)
if (traceFileDebugOnly)
{
return;
}
#endif
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if (file)
{
vfprintf(file, format, vararg);
fclose(file);
}
#endif
}
void trace(bool traceFileDebugOnly, const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
va_end(vararg);
}
bool perfActive()
{
#if defined(ANGLE_DISABLE_PERF)
return false;
#else
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// debug.cpp: Debugging utilities.
#include "common/debug.h"
#include <stdio.h>
#include <stdarg.h>
#include <d3d9.h>
#include <windows.h>
namespace gl
{
typedef void (WINAPI *PerfOutputFunction)(D3DCOLOR, LPCWSTR);
static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg)
{
#if !defined(ANGLE_DISABLE_PERF)
if (perfActive())
{
char message[4096];
int len = vsprintf_s(message, format, vararg);
if (len < 0)
{
return;
}
// There are no ASCII variants of these D3DPERF functions.
wchar_t wideMessage[4096];
for (int i = 0; i < len; ++i)
{
wideMessage[i] = message[i];
}
wideMessage[len] = 0;
perfFunc(0, wideMessage);
}
#endif
#if !defined(ANGLE_DISABLE_TRACE)
#if defined(NDEBUG)
if (traceFileDebugOnly)
{
return;
}
#endif
FILE* file = fopen(TRACE_OUTPUT_FILE, "a");
if (file)
{
vfprintf(file, format, vararg);
fclose(file);
}
#endif
}
void trace(bool traceFileDebugOnly, const char *format, ...)
{
va_list vararg;
va_start(vararg, format);
output(traceFileDebugOnly, D3DPERF_SetMarker, format, vararg);
va_end(vararg);
}
bool perfActive()
{
#if defined(ANGLE_DISABLE_PERF)
return false;
#else
static bool active = D3DPERF_GetStatus() != 0;
return active;
#endif
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg);
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
#if !defined(ANGLE_DISABLE_PERF)
if (perfActive())
{
D3DPERF_EndEvent();
}
#endif
}
}
return active;
#endif
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
va_list vararg;
va_start(vararg, format);
output(true, reinterpret_cast<PerfOutputFunction>(D3DPERF_BeginEvent), format, vararg);
va_end(vararg);
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
#if !defined(ANGLE_DISABLE_PERF)
if (perfActive())
{
D3DPERF_EndEvent();
}
#endif
}
}

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

@ -14,9 +14,9 @@
#include <algorithm>
#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#endif
#include <intrin.h>

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

@ -8,10 +8,10 @@
#ifndef LIBGLESV2_MATHUTIL_H_
#define LIBGLESV2_MATHUTIL_H_
#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#endif
#include <intrin.h>

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

@ -865,7 +865,7 @@ std::string getTempPath()
return std::string();
}
return path;
return path;
}
void writeFile(const char* path, const void* content, size_t size)
@ -878,5 +878,5 @@ void writeFile(const char* path, const void* content, size_t size)
}
fwrite(content, sizeof(char), size, file);
fclose(file);
fclose(file);
}

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

@ -70,25 +70,20 @@ CSRCS = \
cairo-arc.c \
cairo-array.c \
cairo-atomic.c \
cairo-base64-stream.c \
cairo-bentley-ottmann.c \
cairo-bentley-ottmann-rectilinear.c \
cairo-bentley-ottmann-rectangular.c \
cairo-botor-scan-converter.c \
cairo-boxes.c \
cairo-base64-stream.c \
cairo-cache.c \
cairo-clip.c \
cairo-color.c \
cairo-composite-rectangles.c \
cairo-debug.c \
cairo-deflate-stream.c \
cairo-device.c \
cairo-fixed.c \
cairo-font-face.c \
cairo-font-face-twin.c \
cairo-font-face-twin-data.c \
cairo-font-options.c \
cairo-freed-pool.c \
cairo-freelist.c \
cairo-gstate.c \
cairo-hash.c \
@ -99,7 +94,6 @@ CSRCS = \
cairo-matrix.c \
cairo-misc.c \
cairo-mutex.c \
cairo-observer.c \
cairo-output-stream.c \
cairo-paginated-surface.c \
cairo-path.c \
@ -113,7 +107,6 @@ CSRCS = \
cairo-polygon.c \
cairo-recording-surface.c \
cairo-rectangle.c \
cairo-rectangular-scan-converter.c \
cairo-region.c \
cairo-scaled-font.c \
cairo-scaled-font-subsets.c \
@ -124,9 +117,6 @@ CSRCS = \
cairo-surface.c \
cairo-surface-clipper.c \
cairo-surface-fallback.c \
cairo-surface-offset.c \
cairo-surface-snapshot.c \
cairo-surface-subsurface.c \
cairo-surface-wrapper.c \
cairo-tee-surface.c \
cairo-tor-scan-converter.c \
@ -140,7 +130,7 @@ CSRCS = \
EXPORTS_NAMESPACES = cairo
EXPORTS_cairo = cairo.h cairo-version.h cairo-features.h cairo-platform.h cairo-deprecated.h cairo-rename.h cairo-tee.h
EXPORTS_cairo = cairo.h cairo-version.h cairo-features.h cairo-platform.h cairo-deprecated.h cairo-rename.h
# cairo-type1-subset.c should be here, but it's only supported on freetype platforms
@ -163,7 +153,6 @@ PDF_EXPORTS = cairo-pdf.h
PS_EXPORTS = cairo-ps.h
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
DEFINES += -DDISABLE_SOME_FLOATING_POINT
CSRCS += cairo-win32-surface.c
ifndef WINCE
@ -280,4 +269,3 @@ endif
cairo-features.h: $(srcdir)/cairo-features.h.in $(GLOBAL_DEPS)
$(PERL) $(AUTOCONF_TOOLS)/make-makefile -t $(topsrcdir) -d $(DEPTH) ./$@
cat cairo-dwrite-font.i | gzip | python -c "import base64,sys; base64.encode(sys.stdin,sys.stdout)"

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

@ -11,7 +11,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -37,8 +37,6 @@
#include "cairoint.h"
CAIRO_BEGIN_DECLS
cairo_private cairo_surface_t *
_cairo_analysis_surface_create (cairo_surface_t *target);
@ -73,6 +71,4 @@ _cairo_analysis_surface_merge_status (cairo_int_status_t status_a,
cairo_private cairo_surface_t *
_cairo_null_surface_create (cairo_content_t content);
CAIRO_END_DECLS
#endif /* CAIRO_ANALYSIS_SURFACE_H */

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -37,10 +37,8 @@
#include "cairoint.h"
#include "cairo-analysis-surface-private.h"
#include "cairo-error-private.h"
#include "cairo-paginated-private.h"
#include "cairo-recording-surface-private.h"
#include "cairo-surface-subsurface-private.h"
#include "cairo-region-private.h"
typedef struct {
@ -101,11 +99,10 @@ _analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
cairo_bool_t old_has_ctm;
cairo_matrix_t old_ctm, p2d;
cairo_status_t status;
cairo_surface_t *source;
assert (pattern->type == CAIRO_PATTERN_TYPE_SURFACE);
surface_pattern = (const cairo_surface_pattern_t *) pattern;
assert (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING);
assert (_cairo_surface_is_recording (surface_pattern->surface));
old_ctm = surface->ctm;
old_has_ctm = surface->has_ctm;
@ -117,13 +114,8 @@ _analyze_recording_surface_pattern (cairo_analysis_surface_t *surface,
cairo_matrix_multiply (&surface->ctm, &p2d, &surface->ctm);
surface->has_ctm = ! _cairo_matrix_is_identity (&surface->ctm);
source = surface_pattern->surface;
if (source->backend->type == CAIRO_SURFACE_TYPE_SUBSURFACE) {
cairo_surface_subsurface_t *sub = (cairo_surface_subsurface_t *) source;
source = sub->target;
}
status = _cairo_recording_surface_replay_and_create_regions (source, &surface->base);
status = _cairo_recording_surface_replay_and_create_regions (surface_pattern->surface,
&surface->base);
surface->ctm = old_ctm;
surface->has_ctm = old_has_ctm;
@ -404,9 +396,9 @@ _cairo_analysis_surface_stroke (void *abstract_surface,
cairo_operator_t op,
const cairo_pattern_t *source,
cairo_path_fixed_t *path,
const cairo_stroke_style_t *style,
const cairo_matrix_t *ctm,
const cairo_matrix_t *ctm_inverse,
cairo_stroke_style_t *style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
double tolerance,
cairo_antialias_t antialias,
cairo_clip_t *clip)
@ -724,9 +716,7 @@ _cairo_analysis_surface_create (cairo_surface_t *target)
/* I believe the content type here is truly arbitrary. I'm quite
* sure nothing will ever use this value. */
_cairo_surface_init (&surface->base,
&cairo_analysis_surface_backend,
NULL, /* device */
_cairo_surface_init (&surface->base, &cairo_analysis_surface_backend,
CAIRO_CONTENT_COLOR_ALPHA);
cairo_matrix_init_identity (&surface->ctm);
@ -841,9 +831,9 @@ typedef cairo_int_status_t
cairo_operator_t op,
const cairo_pattern_t *source,
cairo_path_fixed_t *path,
const cairo_stroke_style_t *style,
const cairo_matrix_t *ctm,
const cairo_matrix_t *ctm_inverse,
cairo_stroke_style_t *style,
cairo_matrix_t *ctm,
cairo_matrix_t *ctm_inverse,
double tolerance,
cairo_antialias_t antialias,
cairo_clip_t *clip);
@ -916,10 +906,7 @@ _cairo_null_surface_create (cairo_content_t content)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
}
_cairo_surface_init (surface,
&cairo_null_surface_backend,
NULL, /* device */
content);
_cairo_surface_init (surface, &cairo_null_surface_backend, content);
return surface;
}

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -36,7 +36,6 @@
*/
#include "cairoint.h"
#include "cairo-error-private.h"
/**
* _cairo_array_init:
@ -261,7 +260,7 @@ _cairo_array_append (cairo_array_t *array,
}
/**
* _cairo_array_append_multiple:
* _cairo_array_append:
* @array: a #cairo_array_t
*
* Append one or more items onto the array by growing the array by

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

@ -1,7 +1,6 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2007 Chris Wilson
* Copyright © 2010 Andrea Canciani
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
@ -13,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -33,7 +32,6 @@
*
* Contributor(s):
* Chris Wilson <chris@chris-wilson.co.uk>
* Andrea Canciani <ranma42@gmail.com>
*/
#ifndef CAIRO_ATOMIC_PRIVATE_H
@ -59,29 +57,12 @@ CAIRO_BEGIN_DECLS
typedef int cairo_atomic_int_t;
#ifdef ATOMIC_OP_NEEDS_MEMORY_BARRIER
static cairo_always_inline cairo_atomic_int_t
_cairo_atomic_int_get (cairo_atomic_int_t *x)
{
__sync_synchronize ();
return *x;
}
static cairo_always_inline void *
_cairo_atomic_ptr_get (void **x)
{
__sync_synchronize ();
return *x;
}
#else
# define _cairo_atomic_int_get(x) (*x)
# define _cairo_atomic_ptr_get(x) (*x)
#endif
# define _cairo_atomic_int_set(x, value) ((*x) = value)
# define _cairo_atomic_int_inc(x) ((void) __sync_fetch_and_add(x, 1))
# define _cairo_atomic_int_dec_and_test(x) (__sync_fetch_and_add(x, -1) == 1)
# define _cairo_atomic_int_cmpxchg(x, oldv, newv) __sync_bool_compare_and_swap (x, oldv, newv)
# define _cairo_atomic_int_cmpxchg_return_old(x, oldv, newv) __sync_val_compare_and_swap (x, oldv, newv)
# define _cairo_atomic_int_cmpxchg(x, oldv, newv) __sync_val_compare_and_swap (x, oldv, newv)
#if SIZEOF_VOID_P==SIZEOF_INT
typedef int cairo_atomic_intptr_t;
@ -94,10 +75,7 @@ typedef long long cairo_atomic_intptr_t;
#endif
# define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) \
__sync_bool_compare_and_swap ((cairo_atomic_intptr_t*)x, (cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv)
# define _cairo_atomic_ptr_cmpxchg_return_old(x, oldv, newv) \
_cairo_atomic_intptr_to_voidptr (__sync_val_compare_and_swap ((cairo_atomic_intptr_t*)x, (cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv))
(void*)__sync_val_compare_and_swap ((cairo_atomic_intptr_t*)x, (cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv)
#endif
@ -109,10 +87,11 @@ typedef long long cairo_atomic_intptr_t;
typedef AO_t cairo_atomic_int_t;
# define _cairo_atomic_int_get(x) (AO_load_full (x))
# define _cairo_atomic_int_set(x, value) (AO_store_full (x))
# define _cairo_atomic_int_inc(x) ((void) AO_fetch_and_add1_full(x))
# define _cairo_atomic_int_dec_and_test(x) (AO_fetch_and_sub1_full(x) == 1)
# define _cairo_atomic_int_cmpxchg(x, oldv, newv) AO_compare_and_swap_full(x, oldv, newv)
# define _cairo_atomic_int_cmpxchg(x, oldv, newv) ((cairo_atomic_int_t) AO_compare_and_swap_full(x, oldv, newv) ? oldv : *x)
#if SIZEOF_VOID_P==SIZEOF_INT
typedef unsigned int cairo_atomic_intptr_t;
@ -124,129 +103,45 @@ typedef unsigned long long cairo_atomic_intptr_t;
#error No matching integer pointer type
#endif
# define _cairo_atomic_ptr_get(x) _cairo_atomic_intptr_to_voidptr (AO_load_full (x))
# define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) \
_cairo_atomic_int_cmpxchg ((cairo_atomic_intptr_t*)(x), (cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv)
(void*) (cairo_atomic_intptr_t) _cairo_atomic_int_cmpxchg ((cairo_atomic_intptr_t*)(x), (cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv)
#endif
#if HAVE_OS_ATOMIC_OPS
#include <libkern/OSAtomic.h>
#define HAS_ATOMIC_OPS 1
typedef int32_t cairo_atomic_int_t;
# define _cairo_atomic_int_get(x) (OSMemoryBarrier(), *(x))
# define _cairo_atomic_int_inc(x) ((void) OSAtomicIncrement32Barrier (x))
# define _cairo_atomic_int_dec_and_test(x) (OSAtomicDecrement32Barrier (x) == 0)
# define _cairo_atomic_int_cmpxchg(x, oldv, newv) OSAtomicCompareAndSwap32Barrier(oldv, newv, x)
#if SIZEOF_VOID_P==4
typedef int32_t cairo_atomic_intptr_t;
# define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) \
OSAtomicCompareAndSwap32Barrier((cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv, (cairo_atomic_intptr_t *)x)
#elif SIZEOF_VOID_P==8
typedef int64_t cairo_atomic_intptr_t;
# define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) \
OSAtomicCompareAndSwap64Barrier((cairo_atomic_intptr_t)oldv, (cairo_atomic_intptr_t)newv, (cairo_atomic_intptr_t *)x)
#else
#error No matching integer pointer type
#endif
# define _cairo_atomic_ptr_get(x) (OSMemoryBarrier(), *(x))
#endif
#ifndef HAS_ATOMIC_OPS
#if SIZEOF_VOID_P==SIZEOF_INT
typedef unsigned int cairo_atomic_intptr_t;
#elif SIZEOF_VOID_P==SIZEOF_LONG
typedef unsigned long cairo_atomic_intptr_t;
#elif SIZEOF_VOID_P==SIZEOF_LONG_LONG
typedef unsigned long long cairo_atomic_intptr_t;
#else
#error No matching integer pointer type
#endif
typedef cairo_atomic_intptr_t cairo_atomic_int_t;
typedef int cairo_atomic_int_t;
cairo_private void
_cairo_atomic_int_inc (cairo_atomic_int_t *x);
_cairo_atomic_int_inc (int *x);
cairo_private cairo_bool_t
_cairo_atomic_int_dec_and_test (cairo_atomic_int_t *x);
_cairo_atomic_int_dec_and_test (int *x);
cairo_private cairo_atomic_int_t
_cairo_atomic_int_cmpxchg_return_old_impl (cairo_atomic_int_t *x, cairo_atomic_int_t oldv, cairo_atomic_int_t newv);
cairo_private int
_cairo_atomic_int_cmpxchg (int *x, int oldv, int newv);
cairo_private void *
_cairo_atomic_ptr_cmpxchg_return_old_impl (void **x, void *oldv, void *newv);
#define _cairo_atomic_int_cmpxchg_return_old(x, oldv, newv) _cairo_atomic_int_cmpxchg_return_old_impl (x, oldv, newv)
#define _cairo_atomic_ptr_cmpxchg_return_old(x, oldv, newv) _cairo_atomic_ptr_cmpxchg_return_old_impl (x, oldv, newv)
_cairo_atomic_ptr_cmpxchg (void **x, void *oldv, void *newv);
#ifdef ATOMIC_OP_NEEDS_MEMORY_BARRIER
cairo_private cairo_atomic_int_t
_cairo_atomic_int_get (cairo_atomic_int_t *x);
# define _cairo_atomic_ptr_get(x) (void *) _cairo_atomic_int_get((cairo_atomic_int_t *) x)
# include "cairo-compiler-private.h"
cairo_private int
_cairo_atomic_int_get (int *x);
cairo_private void
_cairo_atomic_int_set (int *x, int value);
#else
# define _cairo_atomic_int_get(x) (*x)
# define _cairo_atomic_ptr_get(x) (*x)
# define _cairo_atomic_int_set(x, value) ((*x) = value)
#endif
#else
/* Workaround GCC complaining about casts */
static cairo_always_inline void *
_cairo_atomic_intptr_to_voidptr (cairo_atomic_intptr_t x)
{
return (void *) x;
}
static cairo_always_inline cairo_atomic_int_t
_cairo_atomic_int_cmpxchg_return_old_fallback(cairo_atomic_int_t *x, cairo_atomic_int_t oldv, cairo_atomic_int_t newv)
{
cairo_atomic_int_t curr;
do {
curr = _cairo_atomic_int_get (x);
} while (curr == oldv && !_cairo_atomic_int_cmpxchg (x, oldv, newv));
return curr;
}
static cairo_always_inline void *
_cairo_atomic_ptr_cmpxchg_return_old_fallback(void **x, void *oldv, void *newv)
{
void *curr;
do {
curr = _cairo_atomic_ptr_get (x);
} while (curr == oldv && !_cairo_atomic_ptr_cmpxchg (x, oldv, newv));
return curr;
}
#endif
#ifndef _cairo_atomic_int_cmpxchg_return_old
#define _cairo_atomic_int_cmpxchg_return_old(x, oldv, newv) _cairo_atomic_int_cmpxchg_return_old_fallback (x, oldv, newv)
#endif
#ifndef _cairo_atomic_ptr_cmpxchg_return_old
#define _cairo_atomic_ptr_cmpxchg_return_old(x, oldv, newv) _cairo_atomic_ptr_cmpxchg_return_old_fallback (x, oldv, newv)
#endif
#ifndef _cairo_atomic_int_cmpxchg
#define _cairo_atomic_int_cmpxchg(x, oldv, newv) (_cairo_atomic_int_cmpxchg_return_old (x, oldv, newv) == oldv)
#endif
#ifndef _cairo_atomic_ptr_cmpxchg
#define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) (_cairo_atomic_ptr_cmpxchg_return_old (x, oldv, newv) == oldv)
#endif
#define _cairo_atomic_uint_get(x) _cairo_atomic_int_get(x)

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -42,7 +42,7 @@ COMPILE_TIME_ASSERT(sizeof(void*) == sizeof(int) ||
sizeof(void*) == sizeof(long long));
#else
void
_cairo_atomic_int_inc (cairo_atomic_intptr_t *x)
_cairo_atomic_int_inc (int *x)
{
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
*x += 1;
@ -50,7 +50,7 @@ _cairo_atomic_int_inc (cairo_atomic_intptr_t *x)
}
cairo_bool_t
_cairo_atomic_int_dec_and_test (cairo_atomic_intptr_t *x)
_cairo_atomic_int_dec_and_test (int *x)
{
cairo_bool_t ret;
@ -61,10 +61,10 @@ _cairo_atomic_int_dec_and_test (cairo_atomic_intptr_t *x)
return ret;
}
cairo_atomic_intptr_t
_cairo_atomic_int_cmpxchg_return_old_impl (cairo_atomic_intptr_t *x, cairo_atomic_intptr_t oldv, cairo_atomic_intptr_t newv)
int
_cairo_atomic_int_cmpxchg (int *x, int oldv, int newv)
{
cairo_atomic_intptr_t ret;
int ret;
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
ret = *x;
@ -76,7 +76,7 @@ _cairo_atomic_int_cmpxchg_return_old_impl (cairo_atomic_intptr_t *x, cairo_atomi
}
void *
_cairo_atomic_ptr_cmpxchg_return_old_impl (void **x, void *oldv, void *newv)
_cairo_atomic_ptr_cmpxchg (void **x, void *oldv, void *newv)
{
void *ret;
@ -88,12 +88,13 @@ _cairo_atomic_ptr_cmpxchg_return_old_impl (void **x, void *oldv, void *newv)
return ret;
}
#endif
#ifdef ATOMIC_OP_NEEDS_MEMORY_BARRIER
cairo_atomic_intptr_t
_cairo_atomic_int_get (cairo_atomic_intptr_t *x)
int
_cairo_atomic_int_get (int *x)
{
cairo_atomic_intptr_t ret;
int ret;
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
ret = *x;
@ -101,6 +102,12 @@ _cairo_atomic_int_get (cairo_atomic_intptr_t *x)
return ret;
}
#endif
void
_cairo_atomic_int_set (int *x, int value)
{
CAIRO_MUTEX_LOCK (_cairo_atomic_mutex);
*x = value;
CAIRO_MUTEX_UNLOCK (_cairo_atomic_mutex);
}
#endif

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

@ -14,7 +14,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -37,7 +37,6 @@
*/
#include "cairoint.h"
#include "cairo-error-private.h"
#include "cairo-output-stream-private.h"
typedef struct _cairo_base64_stream {

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

@ -13,7 +13,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -35,7 +35,6 @@
*/
#include "cairoint.h"
#include "cairo-error-private.h"
#include "cairo-output-stream-private.h"
typedef struct _cairo_base85_stream {

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -13,7 +13,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -38,9 +38,7 @@
/* Provide definitions for standalone compilation */
#include "cairoint.h"
#include "cairo-boxes-private.h"
#include "cairo-combsort-private.h"
#include "cairo-error-private.h"
typedef struct _cairo_bo_edge cairo_bo_edge_t;
typedef struct _cairo_bo_trap cairo_bo_trap_t;
@ -217,33 +215,20 @@ edges_collinear (const cairo_bo_edge_t *a, const cairo_bo_edge_t *b)
static cairo_status_t
_cairo_bo_edge_end_trap (cairo_bo_edge_t *left,
int32_t bot,
cairo_bool_t do_traps,
void *container)
cairo_traps_t *traps)
{
cairo_bo_trap_t *trap = &left->deferred_trap;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
/* Only emit (trivial) non-degenerate trapezoids with positive height. */
if (likely (trap->top < bot)) {
if (do_traps) {
_cairo_traps_add_trap (container,
trap->top, bot,
&left->edge.line, &trap->right->edge.line);
status = _cairo_traps_status ((cairo_traps_t *) container);
} else {
cairo_box_t box;
box.p1.x = left->edge.line.p1.x;
box.p1.y = trap->top;
box.p2.x = trap->right->edge.line.p1.x;
box.p2.y = bot;
status = _cairo_boxes_add (container, &box);
}
_cairo_traps_add_trap (traps,
trap->top, bot,
&left->edge.line, &trap->right->edge.line);
}
trap->right = NULL;
return status;
return _cairo_traps_status (traps);
}
/* Start a new trapezoid at the given top y coordinate, whose edges
@ -255,8 +240,7 @@ static inline cairo_status_t
_cairo_bo_edge_start_or_continue_trap (cairo_bo_edge_t *left,
cairo_bo_edge_t *right,
int top,
cairo_bool_t do_traps,
void *container)
cairo_traps_t *traps)
{
cairo_status_t status;
@ -271,7 +255,7 @@ _cairo_bo_edge_start_or_continue_trap (cairo_bo_edge_t *left,
return CAIRO_STATUS_SUCCESS;
}
status = _cairo_bo_edge_end_trap (left, top, do_traps, container);
status = _cairo_bo_edge_end_trap (left, top, traps);
if (unlikely (status))
return status;
}
@ -288,8 +272,7 @@ static inline cairo_status_t
_active_edges_to_traps (cairo_bo_edge_t *left,
int32_t top,
cairo_fill_rule_t fill_rule,
cairo_bool_t do_traps,
void *container)
cairo_traps_t *traps)
{
cairo_bo_edge_t *right;
cairo_status_t status;
@ -320,7 +303,7 @@ _active_edges_to_traps (cairo_bo_edge_t *left,
right = left->next;
while (right != NULL) {
if (right->deferred_trap.right != NULL) {
status = _cairo_bo_edge_end_trap (right, top, do_traps, container);
status = _cairo_bo_edge_end_trap (right, top, traps);
if (unlikely (status))
return status;
}
@ -338,8 +321,8 @@ _active_edges_to_traps (cairo_bo_edge_t *left,
right = right->next;
}
status = _cairo_bo_edge_start_or_continue_trap (left, right, top,
do_traps, container);
status = _cairo_bo_edge_start_or_continue_trap (left, right,
top, traps);
if (unlikely (status))
return status;
@ -354,7 +337,7 @@ _active_edges_to_traps (cairo_bo_edge_t *left,
right = left->next;
while (right != NULL) {
if (right->deferred_trap.right != NULL) {
status = _cairo_bo_edge_end_trap (right, top, do_traps, container);
status = _cairo_bo_edge_end_trap (right, top, traps);
if (unlikely (status))
return status;
}
@ -375,8 +358,8 @@ _active_edges_to_traps (cairo_bo_edge_t *left,
right = right->next;
}
status = _cairo_bo_edge_start_or_continue_trap (left, right, top,
do_traps, container);
status = _cairo_bo_edge_start_or_continue_trap (left, right,
top, traps);
if (unlikely (status))
return status;
@ -393,8 +376,7 @@ static cairo_status_t
_cairo_bentley_ottmann_tessellate_rectilinear (cairo_bo_event_t **start_events,
int num_events,
cairo_fill_rule_t fill_rule,
cairo_bool_t do_traps,
void *container)
cairo_traps_t *traps)
{
cairo_bo_sweep_line_t sweep_line;
cairo_bo_event_t *event;
@ -406,7 +388,7 @@ _cairo_bentley_ottmann_tessellate_rectilinear (cairo_bo_event_t **start_events
if (event->point.y != sweep_line.current_y) {
status = _active_edges_to_traps (sweep_line.head,
sweep_line.current_y,
fill_rule, do_traps, container);
fill_rule, traps);
if (unlikely (status))
return status;
@ -424,7 +406,7 @@ _cairo_bentley_ottmann_tessellate_rectilinear (cairo_bo_event_t **start_events
if (event->edge->deferred_trap.right != NULL) {
status = _cairo_bo_edge_end_trap (event->edge,
sweep_line.current_y,
do_traps, container);
traps);
if (unlikely (status))
return status;
}
@ -494,8 +476,7 @@ _cairo_bentley_ottmann_tessellate_rectilinear_polygon (cairo_traps_t *traps,
}
status = _cairo_bentley_ottmann_tessellate_rectilinear (event_ptrs, j,
fill_rule,
TRUE, traps);
fill_rule, traps);
if (events != stack_events)
free (events);
@ -504,72 +485,6 @@ _cairo_bentley_ottmann_tessellate_rectilinear_polygon (cairo_traps_t *traps,
return status;
}
cairo_status_t
_cairo_bentley_ottmann_tessellate_rectilinear_polygon_to_boxes (const cairo_polygon_t *polygon,
cairo_fill_rule_t fill_rule,
cairo_boxes_t *boxes)
{
cairo_status_t status;
cairo_bo_event_t stack_events[CAIRO_STACK_ARRAY_LENGTH (cairo_bo_event_t)];
cairo_bo_event_t *events;
cairo_bo_event_t *stack_event_ptrs[ARRAY_LENGTH (stack_events) + 1];
cairo_bo_event_t **event_ptrs;
cairo_bo_edge_t stack_edges[ARRAY_LENGTH (stack_events)];
cairo_bo_edge_t *edges;
int num_events;
int i, j;
if (unlikely (polygon->num_edges == 0))
return CAIRO_STATUS_SUCCESS;
num_events = 2 * polygon->num_edges;
events = stack_events;
event_ptrs = stack_event_ptrs;
edges = stack_edges;
if (num_events > ARRAY_LENGTH (stack_events)) {
events = _cairo_malloc_ab_plus_c (num_events,
sizeof (cairo_bo_event_t) +
sizeof (cairo_bo_edge_t) +
sizeof (cairo_bo_event_t *),
sizeof (cairo_bo_event_t *));
if (unlikely (events == NULL))
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
event_ptrs = (cairo_bo_event_t **) (events + num_events);
edges = (cairo_bo_edge_t *) (event_ptrs + num_events + 1);
}
for (i = j = 0; i < polygon->num_edges; i++) {
edges[i].edge = polygon->edges[i];
edges[i].deferred_trap.right = NULL;
edges[i].prev = NULL;
edges[i].next = NULL;
event_ptrs[j] = &events[j];
events[j].type = CAIRO_BO_EVENT_TYPE_START;
events[j].point.y = polygon->edges[i].top;
events[j].point.x = polygon->edges[i].line.p1.x;
events[j].edge = &edges[i];
j++;
event_ptrs[j] = &events[j];
events[j].type = CAIRO_BO_EVENT_TYPE_STOP;
events[j].point.y = polygon->edges[i].bottom;
events[j].point.x = polygon->edges[i].line.p1.x;
events[j].edge = &edges[i];
j++;
}
status = _cairo_bentley_ottmann_tessellate_rectilinear (event_ptrs, j,
fill_rule,
FALSE, boxes);
if (events != stack_events)
free (events);
return status;
}
cairo_status_t
_cairo_bentley_ottmann_tessellate_rectilinear_traps (cairo_traps_t *traps,
cairo_fill_rule_t fill_rule)
@ -657,7 +572,7 @@ _cairo_bentley_ottmann_tessellate_rectilinear_traps (cairo_traps_t *traps,
_cairo_traps_clear (traps);
status = _cairo_bentley_ottmann_tessellate_rectilinear (event_ptrs, j,
fill_rule,
TRUE, traps);
traps);
traps->is_rectilinear = TRUE;
if (events != stack_events)

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

@ -13,7 +13,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -38,7 +38,6 @@
/* Provide definitions for standalone compilation */
#include "cairoint.h"
#include "cairo-error-private.h"
#include "cairo-freelist-private.h"
#include "cairo-combsort-private.h"
@ -130,25 +129,21 @@ static void
dump_traps (cairo_traps_t *traps, const char *filename)
{
FILE *file;
cairo_box_t extents;
int n;
if (getenv ("CAIRO_DEBUG_TRAPS") == NULL)
return;
#if 0
if (traps->has_limits) {
printf ("%s: limits=(%d, %d, %d, %d)\n",
filename,
traps->limits.p1.x, traps->limits.p1.y,
traps->limits.p2.x, traps->limits.p2.y);
}
#endif
_cairo_traps_extents (traps, &extents);
printf ("%s: extents=(%d, %d, %d, %d)\n",
filename,
extents.p1.x, extents.p1.y,
extents.p2.x, extents.p2.y);
traps->extents.p1.x, traps->extents.p1.y,
traps->extents.p2.x, traps->extents.p2.y);
file = fopen (filename, "a");
if (file != NULL) {

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,84 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.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/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* Contributor(s):
* Chris Wilson <chris@chris-wilson.co.uk>
*/
#ifndef CAIRO_BOXES_H
#define CAIRO_BOXES_H
#include "cairo-types-private.h"
#include "cairo-compiler-private.h"
struct _cairo_boxes_t {
cairo_status_t status;
cairo_box_t limit;
const cairo_box_t *limits;
int num_limits;
int num_boxes;
unsigned int is_pixel_aligned : 1;
struct _cairo_boxes_chunk {
struct _cairo_boxes_chunk *next;
cairo_box_t *base;
int count;
int size;
} chunks, *tail;
cairo_box_t boxes_embedded[32];
};
cairo_private void
_cairo_boxes_init (cairo_boxes_t *boxes);
cairo_private void
_cairo_boxes_init_for_array (cairo_boxes_t *boxes,
cairo_box_t *array,
int num_boxes);
cairo_private void
_cairo_boxes_limit (cairo_boxes_t *boxes,
const cairo_box_t *limits,
int num_limits);
cairo_private cairo_status_t
_cairo_boxes_add (cairo_boxes_t *boxes,
const cairo_box_t *box);
cairo_private void
_cairo_boxes_extents (const cairo_boxes_t *boxes,
cairo_rectangle_int_t *extents);
cairo_private void
_cairo_boxes_clear (cairo_boxes_t *boxes);
cairo_private void
_cairo_boxes_fini (cairo_boxes_t *boxes);
#endif /* CAIRO_BOXES_H */

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

@ -1,300 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.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/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* Contributor(s):
* Chris Wilson <chris@chris-wilson.co.uk>
*/
#include "cairoint.h"
#include "cairo-boxes-private.h"
#include "cairo-error-private.h"
void
_cairo_boxes_init (cairo_boxes_t *boxes)
{
boxes->status = CAIRO_STATUS_SUCCESS;
boxes->num_limits = 0;
boxes->num_boxes = 0;
boxes->tail = &boxes->chunks;
boxes->chunks.next = NULL;
boxes->chunks.base = boxes->boxes_embedded;
boxes->chunks.size = ARRAY_LENGTH (boxes->boxes_embedded);
boxes->chunks.count = 0;
boxes->is_pixel_aligned = TRUE;
}
void
_cairo_boxes_init_for_array (cairo_boxes_t *boxes,
cairo_box_t *array,
int num_boxes)
{
int n;
boxes->status = CAIRO_STATUS_SUCCESS;
boxes->num_limits = 0;
boxes->num_boxes = num_boxes;
boxes->tail = &boxes->chunks;
boxes->chunks.next = NULL;
boxes->chunks.base = array;
boxes->chunks.size = num_boxes;
boxes->chunks.count = num_boxes;
for (n = 0; n < num_boxes; n++) {
if (! _cairo_fixed_is_integer (array[n].p1.x) ||
! _cairo_fixed_is_integer (array[n].p1.y) ||
! _cairo_fixed_is_integer (array[n].p2.x) ||
! _cairo_fixed_is_integer (array[n].p2.y))
{
break;
}
}
boxes->is_pixel_aligned = n == num_boxes;
}
void
_cairo_boxes_limit (cairo_boxes_t *boxes,
const cairo_box_t *limits,
int num_limits)
{
int n;
boxes->limits = limits;
boxes->num_limits = num_limits;
if (boxes->num_limits) {
boxes->limit = limits[0];
for (n = 1; n < num_limits; n++) {
if (limits[n].p1.x < boxes->limit.p1.x)
boxes->limit.p1.x = limits[n].p1.x;
if (limits[n].p1.y < boxes->limit.p1.y)
boxes->limit.p1.y = limits[n].p1.y;
if (limits[n].p2.x > boxes->limit.p2.x)
boxes->limit.p2.x = limits[n].p2.x;
if (limits[n].p2.y > boxes->limit.p2.y)
boxes->limit.p2.y = limits[n].p2.y;
}
}
}
static void
_cairo_boxes_add_internal (cairo_boxes_t *boxes,
const cairo_box_t *box)
{
struct _cairo_boxes_chunk *chunk;
if (unlikely (boxes->status))
return;
chunk = boxes->tail;
if (unlikely (chunk->count == chunk->size)) {
int size;
size = chunk->size * 2;
chunk->next = _cairo_malloc_ab_plus_c (size,
sizeof (cairo_box_t),
sizeof (struct _cairo_boxes_chunk));
if (unlikely (chunk->next == NULL)) {
boxes->status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
return;
}
chunk = chunk->next;
boxes->tail = chunk;
chunk->next = NULL;
chunk->count = 0;
chunk->size = size;
chunk->base = (cairo_box_t *) (chunk + 1);
}
chunk->base[chunk->count++] = *box;
boxes->num_boxes++;
if (boxes->is_pixel_aligned) {
boxes->is_pixel_aligned =
_cairo_fixed_is_integer (box->p1.x) &&
_cairo_fixed_is_integer (box->p1.y) &&
_cairo_fixed_is_integer (box->p2.x) &&
_cairo_fixed_is_integer (box->p2.y);
}
}
cairo_status_t
_cairo_boxes_add (cairo_boxes_t *boxes,
const cairo_box_t *box)
{
if (box->p1.y == box->p2.y)
return CAIRO_STATUS_SUCCESS;
if (box->p1.x == box->p2.x)
return CAIRO_STATUS_SUCCESS;
if (boxes->num_limits) {
cairo_point_t p1, p2;
cairo_bool_t reversed = FALSE;
int n;
/* support counter-clockwise winding for rectangular tessellation */
if (box->p1.x < box->p2.x) {
p1.x = box->p1.x;
p2.x = box->p2.x;
} else {
p2.x = box->p1.x;
p1.x = box->p2.x;
reversed = ! reversed;
}
if (p1.x >= boxes->limit.p2.x || p2.x <= boxes->limit.p1.x)
return CAIRO_STATUS_SUCCESS;
if (box->p1.y < box->p2.y) {
p1.y = box->p1.y;
p2.y = box->p2.y;
} else {
p2.y = box->p1.y;
p1.y = box->p2.y;
reversed = ! reversed;
}
if (p1.y >= boxes->limit.p2.y || p2.y <= boxes->limit.p1.y)
return CAIRO_STATUS_SUCCESS;
for (n = 0; n < boxes->num_limits; n++) {
const cairo_box_t *limits = &boxes->limits[n];
cairo_box_t _box;
cairo_point_t _p1, _p2;
if (p1.x >= limits->p2.x || p2.x <= limits->p1.x)
continue;
if (p1.y >= limits->p2.y || p2.y <= limits->p1.y)
continue;
/* Otherwise, clip the box to the limits. */
_p1 = p1;
if (_p1.x < limits->p1.x)
_p1.x = limits->p1.x;
if (_p1.y < limits->p1.y)
_p1.y = limits->p1.y;
_p2 = p2;
if (_p2.x > limits->p2.x)
_p2.x = limits->p2.x;
if (_p2.y > limits->p2.y)
_p2.y = limits->p2.y;
if (_p2.y <= _p1.y || _p2.x <= _p1.x)
continue;
_box.p1.y = _p1.y;
_box.p2.y = _p2.y;
if (reversed) {
_box.p1.x = _p2.x;
_box.p2.x = _p1.x;
} else {
_box.p1.x = _p1.x;
_box.p2.x = _p2.x;
}
_cairo_boxes_add_internal (boxes, &_box);
}
} else {
_cairo_boxes_add_internal (boxes, box);
}
return boxes->status;
}
void
_cairo_boxes_extents (const cairo_boxes_t *boxes,
cairo_rectangle_int_t *extents)
{
const struct _cairo_boxes_chunk *chunk;
cairo_box_t box;
int i;
box.p1.y = box.p1.x = INT_MAX;
box.p2.y = box.p2.x = INT_MIN;
for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
const cairo_box_t *b = chunk->base;
for (i = 0; i < chunk->count; i++) {
if (b[i].p1.x < box.p1.x)
box.p1.x = b[i].p1.x;
if (b[i].p1.y < box.p1.y)
box.p1.y = b[i].p1.y;
if (b[i].p2.x > box.p2.x)
box.p2.x = b[i].p2.x;
if (b[i].p2.y > box.p2.y)
box.p2.y = b[i].p2.y;
}
}
_cairo_box_round_to_rectangle (&box, extents);
}
void
_cairo_boxes_clear (cairo_boxes_t *boxes)
{
struct _cairo_boxes_chunk *chunk, *next;
for (chunk = boxes->chunks.next; chunk != NULL; chunk = next) {
next = chunk->next;
free (chunk);
}
boxes->tail = &boxes->chunks;
boxes->chunks.next = 0;
boxes->chunks.count = 0;
boxes->num_boxes = 0;
boxes->is_pixel_aligned = TRUE;
}
void
_cairo_boxes_fini (cairo_boxes_t *boxes)
{
struct _cairo_boxes_chunk *chunk, *next;
for (chunk = boxes->chunks.next; chunk != NULL; chunk = next) {
next = chunk->next;
free (chunk);
}
}

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

@ -13,7 +13,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*

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

@ -13,7 +13,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -37,7 +37,6 @@
*/
#include "cairoint.h"
#include "cairo-error-private.h"
static void
_cairo_cache_shrink_to_accommodate (cairo_cache_t *cache,
@ -175,7 +174,9 @@ _cairo_cache_thaw (cairo_cache_t *cache)
{
assert (cache->freeze_count > 0);
if (--cache->freeze_count == 0)
cache->freeze_count--;
if (cache->freeze_count == 0)
_cairo_cache_shrink_to_accommodate (cache, 0);
}
@ -239,6 +240,9 @@ static void
_cairo_cache_shrink_to_accommodate (cairo_cache_t *cache,
unsigned long additional)
{
if (cache->freeze_count)
return;
while (cache->size + additional > cache->max_size) {
if (! _cairo_cache_remove_random (cache))
return;
@ -263,8 +267,7 @@ _cairo_cache_insert (cairo_cache_t *cache,
{
cairo_status_t status;
if (entry->size && ! cache->freeze_count)
_cairo_cache_shrink_to_accommodate (cache, entry->size);
_cairo_cache_shrink_to_accommodate (cache, entry->size);
status = _cairo_hash_table_insert (cache->hash_table,
(cairo_hash_entry_t *) entry);

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -41,7 +41,6 @@
#define _BSD_SOURCE /* for snprintf(), strdup() */
#include "cairoint.h"
#include "cairo-error-private.h"
#if CAIRO_HAS_FONT_SUBSET
@ -118,7 +117,6 @@ typedef struct _cairo_cff_font {
cairo_array_t local_sub_index;
int num_glyphs;
cairo_bool_t is_cid;
int units_per_em;
/* CID Font Data */
int *fdselect;
@ -1774,9 +1772,6 @@ _cairo_cff_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
font->y_max = (int16_t) be16_to_cpu (head.y_max);
font->ascent = (int16_t) be16_to_cpu (hhea.ascender);
font->descent = (int16_t) be16_to_cpu (hhea.descender);
font->units_per_em = (int16_t) be16_to_cpu (head.units_per_em);
if (font->units_per_em == 0)
font->units_per_em = 1000;
font->font_name = NULL;
status = _cairo_truetype_read_font_name (scaled_font_subset->scaled_font,
@ -1960,20 +1955,20 @@ _cairo_cff_subset_init (cairo_cff_subset_t *cff_subset,
cff_subset->font_name = NULL;
}
cff_subset->widths = calloc (sizeof (double), font->scaled_font_subset->num_glyphs);
cff_subset->widths = calloc (sizeof (int), font->scaled_font_subset->num_glyphs);
if (unlikely (cff_subset->widths == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail3;
}
for (i = 0; i < font->scaled_font_subset->num_glyphs; i++)
cff_subset->widths[i] = (double)font->widths[i]/font->units_per_em;
cff_subset->widths[i] = font->widths[i];
cff_subset->x_min = (double)font->x_min/font->units_per_em;
cff_subset->y_min = (double)font->y_min/font->units_per_em;
cff_subset->x_max = (double)font->x_max/font->units_per_em;
cff_subset->y_max = (double)font->y_max/font->units_per_em;
cff_subset->ascent = (double)font->ascent/font->units_per_em;
cff_subset->descent = (double)font->descent/font->units_per_em;
cff_subset->x_min = font->x_min;
cff_subset->y_min = font->y_min;
cff_subset->x_max = font->x_max;
cff_subset->y_max = font->y_max;
cff_subset->ascent = font->ascent;
cff_subset->descent = font->descent;
cff_subset->data = malloc (length);
if (unlikely (cff_subset->data == NULL)) {
@ -2217,21 +2212,21 @@ _cairo_cff_fallback_init (cairo_cff_subset_t *cff_subset,
goto fail2;
}
cff_subset->widths = calloc (sizeof (double), font->scaled_font_subset->num_glyphs);
cff_subset->widths = calloc (sizeof (int), font->scaled_font_subset->num_glyphs);
if (unlikely (cff_subset->widths == NULL)) {
status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
goto fail3;
}
for (i = 0; i < font->scaled_font_subset->num_glyphs; i++)
cff_subset->widths[i] = (double)type2_subset.widths[i]/1000;
cff_subset->widths[i] = type2_subset.widths[i];
cff_subset->x_min = (double)type2_subset.x_min/1000;
cff_subset->y_min = (double)type2_subset.y_min/1000;
cff_subset->x_max = (double)type2_subset.x_max/1000;
cff_subset->y_max = (double)type2_subset.y_max/1000;
cff_subset->ascent = (double)type2_subset.y_max/1000;
cff_subset->descent = (double)type2_subset.y_min/1000;
cff_subset->x_min = type2_subset.x_min;
cff_subset->y_min = type2_subset.y_min;
cff_subset->x_max = type2_subset.x_max;
cff_subset->y_max = type2_subset.y_max;
cff_subset->ascent = type2_subset.y_max;
cff_subset->descent = type2_subset.y_min;
cff_subset->data = malloc (length);
if (unlikely (cff_subset->data == NULL)) {

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

@ -12,7 +12,7 @@
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
@ -76,6 +76,10 @@ struct _cairo_clip {
cairo_private void
_cairo_clip_init (cairo_clip_t *clip);
cairo_private cairo_status_t
_cairo_clip_init_rectangle (cairo_clip_t *clip,
const cairo_rectangle_int_t *rect);
cairo_private_no_warn cairo_clip_t *
_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other);
@ -87,10 +91,6 @@ _cairo_clip_init_copy_transformed (cairo_clip_t *clip,
cairo_private void
_cairo_clip_reset (cairo_clip_t *clip);
cairo_private cairo_bool_t
_cairo_clip_equal (const cairo_clip_t *clip_a,
const cairo_clip_t *clip_b);
#define _cairo_clip_fini(clip) _cairo_clip_reset (clip)
cairo_private cairo_status_t
@ -112,12 +112,12 @@ cairo_private const cairo_rectangle_int_t *
_cairo_clip_get_extents (const cairo_clip_t *clip);
cairo_private cairo_surface_t *
_cairo_clip_get_surface (cairo_clip_t *clip, cairo_surface_t *dst, int *tx, int *ty);
_cairo_clip_get_surface (cairo_clip_t *clip, cairo_surface_t *dst);
cairo_private cairo_status_t
_cairo_clip_combine_with_surface (cairo_clip_t *clip,
cairo_surface_t *dst,
int dst_x, int dst_y);
const cairo_rectangle_int_t *extents);
cairo_private cairo_int_status_t
_cairo_clip_get_region (cairo_clip_t *clip,
@ -128,20 +128,6 @@ _cairo_clip_get_boxes (cairo_clip_t *clip,
cairo_box_t **boxes,
int *count);
cairo_private cairo_status_t
_cairo_clip_to_boxes (cairo_clip_t **clip,
cairo_composite_rectangles_t *extents,
cairo_box_t **boxes,
int *num_boxes);
cairo_private cairo_bool_t
_cairo_clip_contains_rectangle (cairo_clip_t *clip,
const cairo_rectangle_int_t *rect);
cairo_private cairo_bool_t
_cairo_clip_contains_extents (cairo_clip_t *clip,
const cairo_composite_rectangles_t *extents);
cairo_private void
_cairo_clip_drop_cache (cairo_clip_t *clip);

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