Merge mozilla-central to b2g-inbound

This commit is contained in:
Carsten "Tomcat" Book 2014-11-27 17:07:08 +01:00
Родитель 406d09b35e 089e37c12a
Коммит 87dd032f55
120 изменённых файлов: 3528 добавлений и 1437 удалений

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

@ -422,6 +422,8 @@ pref("browser.search.update.interval", 21600);
// enable search suggestions by default
pref("browser.search.suggest.enabled", true);
pref("browser.search.showOneOffButtons", true);
#ifdef MOZ_OFFICIAL_BRANDING
// {moz:official} expands to "official"
pref("browser.search.official", true);

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

@ -415,6 +415,15 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#browser-autocomplete-result-popup");
}
#PopupSearchAutoComplete {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#browser-search-autocomplete-result-popup");
margin-left: -23px;
}
searchbar[oneoffui] {
-moz-binding: url("chrome://browser/content/search/search.xml#searchbar-flare") !important;
}
#PopupAutoCompleteRichResult {
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup");
}

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

@ -3304,13 +3304,6 @@ const BrowserSearch = {
return;
}
// Append the URI and an appropriate title to the browser data.
// Use documentURIObject in the check for shouldLoadFavIcon so that we
// do the right thing with about:-style error pages. Bug 453442
var iconURL = null;
if (gBrowser.shouldLoadFavIcon(uri))
iconURL = uri.prePath + "/favicon.ico";
var hidden = false;
// If this engine (identified by title) is already in the list, add it
// to the list of hidden engines rather than to the main list.
@ -3323,7 +3316,8 @@ const BrowserSearch = {
engines.push({ uri: engine.href,
title: engine.title,
icon: iconURL });
get icon() { return browser.mIconURL; }
});
if (hidden)
browser.hiddenEngines = engines;
@ -7821,4 +7815,3 @@ let PanicButtonNotifier = {
popup.hidePopup();
},
};

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

@ -140,6 +140,9 @@
<!-- for search and content formfill/pw manager -->
<panel type="autocomplete" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
<!-- for search with one-off buttons -->
<panel type="autocomplete" id="PopupSearchAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>

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

@ -4,6 +4,12 @@
let originalTab;
let newTab;
function isCurrent(tab, msg) {
const tolerance = 1;
const difference = Math.abs(Date.now() - tab.lastAccessed);
ok(difference <= tolerance, msg + " (difference: " + difference + ")");
}
function test() {
waitForExplicitFinish();
@ -12,7 +18,7 @@ function test() {
}
function step2() {
is(originalTab.lastAccessed, Date.now(), "selected tab has the current timestamp");
isCurrent(originalTab, "selected tab has the current timestamp");
newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
setTimeout(step3, 100);
}
@ -20,15 +26,14 @@ function step2() {
function step3() {
ok(newTab.lastAccessed < Date.now(), "new tab hasn't been selected so far");
gBrowser.selectedTab = newTab;
is(newTab.lastAccessed, Date.now(), "new tab has the current timestamp after being selected");
isCurrent(newTab, "new tab has the current timestamp after being selected");
setTimeout(step4, 100);
}
function step4() {
ok(originalTab.lastAccessed < Date.now(),
"original tab has old timestamp after being deselected");
is(newTab.lastAccessed, Date.now(),
"new tab has the current timestamp since it's still selected");
isCurrent(newTab, "new tab has the current timestamp since it's still selected");
gBrowser.removeTab(newTab);
finish();

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

@ -951,6 +951,269 @@
</implementation>
</binding>
<!-- Note: this binding is applied to the autocomplete popup used in the Search bar -->
<binding id="browser-search-autocomplete-result-popup" extends="chrome://browser/content/urlbarBindings.xml#browser-autocomplete-result-popup">
<resources>
<stylesheet src="chrome://browser/skin/searchbar.css"/>
</resources>
<content ignorekeys="true" level="top" consumeoutsideclicks="false">
<xul:hbox xbl:inherits="collapsed=showonlysettings"
class="search-panel-header search-panel-current-engine">
<xul:image class="searchbar-engine-image" xbl:inherits="src"/>
<xul:label anonid="searchbar-engine-name" flex="1" crop="end"/>
</xul:hbox>
<xul:tree anonid="tree" flex="1"
class="autocomplete-tree plain search-panel-tree"
hidecolumnpicker="true" seltype="single">
<xul:treecols anonid="treecols">
<xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1" overflow="true"/>
</xul:treecols>
<xul:treechildren class="autocomplete-treebody"/>
</xul:tree>
<xul:hbox anonid="search-panel-one-offs-header"
class="search-panel-header search-panel-current-input"
xbl:inherits="hidden=showonlysettings">
<xul:label anonid="searchbar-oneoffheader-before" value="&searchFor.label;"/>
<xul:label anonid="searchbar-oneoffheader-searchtext" flex="1" crop="end" class="search-panel-input-value"/>
<xul:label anonid="searchbar-oneoffheader-after" flex="10000" value="&searchWith.label;"/>
</xul:hbox>
<xul:description anonid="search-panel-one-offs"
class="search-panel-one-offs"
xbl:inherits="hidden=showonlysettings"/>
<xul:vbox anonid="add-engines"/>
<xul:button anonid="search-settings"
xbl:inherits="showonlysettings"
oncommand="openPreferences('paneSearch')"
class="search-setting-button search-panel-header"
label="&changeSearchSettings.button;"/>
</content>
<handlers>
<handler event="popupshowing"><![CDATA[
// First handle deciding if we are showing the reduced version of the
// popup containing only the preferences button. We do this if the
// glass icon has been clicked if the text field is empty.
let searchbar = document.getElementById("searchbar");
let tree = document.getAnonymousElementByAttribute(this, "anonid",
"tree")
if (searchbar.hasAttribute("showonlysettings")) {
searchbar.removeAttribute("showonlysettings");
this.setAttribute("showonlysettings", "true");
// Setting this with an xbl-inherited attribute gets overridden the
// second time the user clicks the glass icon for some reason...
tree.collapsed = true;
}
else {
this.removeAttribute("showonlysettings");
tree.collapsed = false;
}
// Show the current default engine in the top header of the panel.
let currentEngine = Services.search.currentEngine;
let uri = currentEngine.iconURI;
if (uri) {
uri = uri.spec;
this.setAttribute("src", PlacesUtils.getImageURLForResolution(window, uri));
}
else {
// If the default has just been changed to a provider without icon,
// avoid showing the icon of the previous default provider.
this.removeAttribute("src");
}
const kBundleURI = "chrome://browser/locale/search.properties";
let bundle = Services.strings.createBundle(kBundleURI);
let headerText = bundle.formatStringFromName("searchHeader",
[currentEngine.name], 1);
document.getAnonymousElementByAttribute(this, "anonid", "searchbar-engine-name")
.setAttribute("value", headerText);
// Update the 'Search for <keywords> with:" header.
let headerSearchText =
document.getAnonymousElementByAttribute(this, "anonid",
"searchbar-oneoffheader-searchtext");
let textbox = searchbar.textbox;
let self = this;
let keyPressHandler = function() {
headerSearchText.setAttribute("value", textbox.value);
if (textbox.value)
self.removeAttribute("showonlysettings");
};
textbox.addEventListener("keyup", keyPressHandler);
this.addEventListener("popuphiding", function hiding() {
textbox.removeEventListener("keyup", keyPressHandler);
this.removeEventListener("popuphiding", hiding);
});
keyPressHandler();
// Handle opensearch items. This needs to be done before building the
// list of one off providers, as that code will return early if all the
// alternative engines are hidden.
let addEngineList =
document.getAnonymousElementByAttribute(this, "anonid", "add-engines");
while (addEngineList.firstChild)
addEngineList.firstChild.remove();
const kXULNS =
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
let addEngines = getBrowser().mCurrentBrowser.engines;
if (addEngines && addEngines.length > 0) {
const kBundleURI = "chrome://browser/locale/search.properties";
let bundle = Services.strings.createBundle(kBundleURI);
for (let engine of addEngines) {
let button = document.createElementNS(kXULNS, "button");
let label = bundle.formatStringFromName("cmd_addFoundEngine",
[engine.title], 1);
button.setAttribute("class", "addengine-item");
button.setAttribute("label", label);
button.setAttribute("pack", "start");
button.setAttribute("crop", "end");
button.setAttribute("tooltiptext", engine.uri);
button.setAttribute("uri", engine.uri);
if (engine.icon) {
let uri = PlacesUtils.getImageURLForResolution(window, engine.icon);
button.setAttribute("image", uri);
}
button.setAttribute("title", engine.title);
addEngineList.appendChild(button);
}
}
// Finally, build the list of one-off buttons.
let list = document.getAnonymousElementByAttribute(this, "anonid",
"search-panel-one-offs")
while (list.firstChild)
list.firstChild.remove();
let hiddenList;
try {
let pref =
Services.prefs.getCharPref("browser.search.hiddenOneOffs");
hiddenList = pref ? pref.split(",") : [];
} catch(e) {
hiddenList = [];
}
let engines = Services.search.getVisibleEngines()
.filter(e => e.name != currentEngine.name &&
hiddenList.indexOf(e.name) == -1);
let header = document.getAnonymousElementByAttribute(this, "anonid",
"search-panel-one-offs-header")
header.collapsed = list.collapsed = !engines.length;
if (!engines.length)
return;
let panel = document.getElementById("PopupSearchAutoComplete");
let minWidth = parseInt(panel.width) + 23;
panel.setAttribute("style", "min-width: " + minWidth + "px");
// 49px is the min-width of each search engine button,
// adapt this const when changing the css.
// It's actually 48px + 1px of right border.
// The + 1 is because the last button doesn't have a right border.
let panelWidth = parseInt(panel.clientWidth);
let enginesPerRow = Math.floor((panelWidth + 1) / 49);
let buttonWidth = Math.floor(panelWidth / enginesPerRow);
// There will be an emtpy area of:
// panelWidth - enginesPerRow * buttonWidth px
// at the end of each row.
// If the <description> tag with the list of search engines doesn't have
// a fixed height, the panel will be sized incorrectly, causing the bottom
// of the suggestion <tree> to be hidden.
let rowCount = Math.ceil(engines.length / enginesPerRow);
let height = rowCount * 33; // 32px per row, 1px border.
list.setAttribute("height", height + "px");
let dummyItems = enginesPerRow - (engines.length % enginesPerRow || enginesPerRow);
for (let i = 0; i < engines.length; ++i) {
let engine = engines[i];
let button = document.createElementNS(kXULNS, "button");
button.setAttribute("label", engine.name);
let uri = "chrome://browser/skin/search-engine-placeholder.png";
if (engine.iconURI) {
uri = PlacesUtils.getImageURLForResolution(window, engine.iconURI.spec);
}
button.setAttribute("image", uri);
button.setAttribute("class", "searchbar-engine-one-off-item");
button.setAttribute("tooltiptext", engine.name);
button.setAttribute("width", buttonWidth);
button.engine = engine;
if ((i + 1) % enginesPerRow == 0)
button.classList.add("last-of-row");
if (i >= engines.length + dummyItems - enginesPerRow)
button.classList.add("last-row");
list.appendChild(button);
}
while (dummyItems) {
let button = document.createElementNS(kXULNS, "button");
button.setAttribute("class", "searchbar-engine-one-off-item dummy last-row");
button.setAttribute("width", buttonWidth);
if (!--dummyItems)
button.classList.add("last-of-row");
list.appendChild(button);
}
]]></handler>
<handler event="mousedown"><![CDATA[
// Required to receive click events from the buttons on Linux.
event.preventDefault();
]]></handler>
<handler event="mouseover"><![CDATA[
let target = event.originalTarget;
if (target.localName == "button" &&
target.classList.contains("searchbar-engine-one-off-item") &&
!target.classList.contains("dummy")) {
let list = document.getAnonymousElementByAttribute(this, "anonid",
"search-panel-one-offs")
for (let button = list.firstChild; button; button = button.nextSibling)
button.removeAttribute("selected");
}
]]></handler>
<handler event="click"><![CDATA[
if (event.button == 2)
return; // ignore right clicks.
let button = event.originalTarget;
if (button.localName != "button" || !button.engine)
return;
let searchbar = document.getElementById("searchbar");
searchbar.handleSearchCommand(event, button.engine);
]]></handler>
<handler event="command"><![CDATA[
let target = event.originalTarget;
if (target.classList.contains("addengine-item")) {
// On success, hide and reshow the panel to show the new engine.
let installCallback = {
onSuccess: function(engine) {
event.target.hidePopup();
BrowserSearch.searchBar.openSuggestionsPanel();
}
}
Services.search.addEngine(target.getAttribute("uri"),
Ci.nsISearchEngine.DATA_XML,
target.getAttribute("src"), false,
installCallback);
}
]]></handler>
</handlers>
</binding>
<binding id="urlbar-rich-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup">
<implementation>
<field name="_maxResults">0</field>

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

@ -67,6 +67,13 @@ add_task(function*() {
yield PanelUI.show();
yield waitForCondition(() => "value" in searchbar && searchbar.value === "");
// Focusing a non-empty searchbox will cause us to open the
// autocomplete panel and search for suggestions, which would
// trigger network requests. Temporarily disable suggestions.
let suggestEnabled =
Services.prefs.getBoolPref("browser.search.suggest.enabled");
Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
searchbar.value = "foo";
searchbar.focus();
// Reaching into this context menu is pretty evil, but hey... it's a test.
@ -83,12 +90,18 @@ add_task(function*() {
EventUtils.synthesizeMouseAtCenter(selectAll, {});
yield contextMenuHidden;
// Hide the suggestion panel.
searchbar.textbox.popup.hidePopup();
ok(isPanelUIOpen(), "Panel should still be open");
let hiddenPanelPromise = promisePanelHidden(window);
EventUtils.synthesizeKey("VK_ESCAPE", {});
yield hiddenPanelPromise;
ok(!isPanelUIOpen(), "Panel should no longer be open");
Services.prefs.setBoolPref("browser.search.suggest.enabled", suggestEnabled);
CustomizableUI.reset();
});
add_task(function*() {
@ -121,4 +134,3 @@ registerCleanupFunction(function() {
PanelUI.hide();
}
});

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

@ -587,8 +587,10 @@ loop.panel = (function(_, mozL10n) {
React.DOM.span({className: "room-notification"}),
room.roomName,
React.DOM.button({className: copyButtonClasses,
title: mozL10n.get("rooms_list_copy_url_tooltip"),
onClick: this.handleCopyButtonClick}),
React.DOM.button({className: "delete-link",
title: mozL10n.get("rooms_list_delete_tooltip"),
onClick: this.handleDeleteButtonClick})
),
React.DOM.p(null,

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

@ -587,8 +587,10 @@ loop.panel = (function(_, mozL10n) {
<span className="room-notification" />
{room.roomName}
<button className={copyButtonClasses}
title={mozL10n.get("rooms_list_copy_url_tooltip")}
onClick={this.handleCopyButtonClick} />
<button className="delete-link"
title={mozL10n.get("rooms_list_delete_tooltip")}
onClick={this.handleDeleteButtonClick} />
</h2>
<p>

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

@ -251,7 +251,7 @@ loop.roomViews = (function(mozL10n) {
var localStreamClasses = React.addons.classSet({
local: true,
"local-stream": true,
"local-stream-audio": !this.state.videoMuted,
"local-stream-audio": this.state.videoMuted,
"room-preview": this.state.roomState !== ROOM_STATES.HAS_PARTICIPANTS
});

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

@ -251,7 +251,7 @@ loop.roomViews = (function(mozL10n) {
var localStreamClasses = React.addons.classSet({
local: true,
"local-stream": true,
"local-stream-audio": !this.state.videoMuted,
"local-stream-audio": this.state.videoMuted,
"room-preview": this.state.roomState !== ROOM_STATES.HAS_PARTICIPANTS
});

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

@ -342,7 +342,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
hide: !this._roomIsActive(),
local: true,
"local-stream": true,
"local-stream-audio": false
"local-stream-audio": this.state.videoMuted
});
return (

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

@ -342,7 +342,7 @@ loop.standaloneRoomViews = (function(mozL10n) {
hide: !this._roomIsActive(),
local: true,
"local-stream": true,
"local-stream-audio": false
"local-stream-audio": this.state.videoMuted
});
return (

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

@ -330,5 +330,20 @@ describe("loop.roomViews", function () {
loop.shared.views.FeedbackView);
});
});
describe("Mute", function() {
it("should render local media as audio-only if video is muted",
function() {
activeRoomStore.setStoreState({
roomState: ROOM_STATES.SESSION_CONNECTED,
videoMuted: true
});
view = mountTestComponent();
expect(view.getDOMNode().querySelector(".local-stream-audio"))
.not.eql(null);
});
});
});
});

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

@ -311,6 +311,19 @@ describe("loop.standaloneRoomViews", function() {
sinon.assert.calledWithExactly(dispatch, new sharedActions.FeedbackComplete());
});
});
describe("Mute", function() {
it("should render local media as audio-only if video is muted",
function() {
activeRoomStore.setStoreState({
roomState: ROOM_STATES.SESSION_CONNECTED,
videoMuted: true
});
expect(view.getDOMNode().querySelector(".local-stream-audio"))
.not.eql(null);
});
});
});
});
});

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

@ -14,3 +14,5 @@ browser.jar:
content/browser/preferences/in-content/content.js
content/browser/preferences/in-content/sync.js
content/browser/preferences/in-content/security.js
content/browser/preferences/in-content/search.css
content/browser/preferences/in-content/search.js

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

@ -24,6 +24,7 @@ function init_all() {
gSubDialog.init();
gMainPane.init();
gSearchPane.init();
gPrivacyPane.init();
gAdvancedPane.init();
gApplicationsPane.init();

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

@ -14,6 +14,7 @@
<?xml-stylesheet
href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<?xml-stylesheet href="chrome://browser/content/preferences/in-content/search.css"?>
<!DOCTYPE page [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
@ -22,6 +23,7 @@
"chrome://browser/locale/preferences/preferences.dtd">
<!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
<!ENTITY % tabsDTD SYSTEM "chrome://browser/locale/preferences/tabs.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
<!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
<!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
<!ENTITY % securityDTD SYSTEM
@ -39,6 +41,7 @@
%preferencesDTD;
%privacyDTD;
%tabsDTD;
%searchDTD;
%syncBrandDTD;
%syncDTD;
%securityDTD;
@ -96,6 +99,16 @@
<label class="category-name" flex="1">&paneGeneral.title;</label>
</richlistitem>
<richlistitem id="category-search"
class="category"
value="paneSearch"
helpTopic="prefs-main"
tooltiptext="&paneSearch.title;"
align="center">
<image class="category-icon"/>
<label class="category-name" flex="1">&paneSearch.title;</label>
</richlistitem>
<richlistitem id="category-content"
class="category"
value="paneContent"
@ -162,6 +175,7 @@
<vbox class="main-content" flex="1">
<prefpane id="mainPrefPane">
#include main.xul
#include search.xul
#include privacy.xul
#include advanced.xul
#include applications.xul

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

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#oneClickProvidersList richlistitem {
-moz-binding: url("chrome://global/content/bindings/checkbox.xml#checkbox");
}
.searchengine-menuitem > .menu-iconic-left {
display: -moz-box
}
.checkbox-label-box {
-moz-box-align: center;
}
.checkbox-icon {
-moz-margin-end: 8px;
max-width: 16px;
}

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

@ -0,0 +1,75 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gSearchPane = {
init: function ()
{
if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
document.getElementById("category-search").hidden = true;
if (document.location.hash == "#search")
document.location.hash = "";
return;
}
let list = document.getElementById("defaultEngine");
let currentEngine = Services.search.currentEngine.name;
Services.search.getVisibleEngines().forEach(e => {
let item = list.appendItem(e.name);
item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
if (e.iconURI)
item.setAttribute("image", e.iconURI.spec);
item.engine = e;
if (e.name == currentEngine)
list.selectedItem = item;
});
this.displayOneClickEnginesList();
document.getElementById("oneClickProvidersList")
.addEventListener("CheckboxStateChange", gSearchPane.saveOneClickEnginesList);
},
displayOneClickEnginesList: function () {
let richlistbox = document.getElementById("oneClickProvidersList");
let pref = document.getElementById("browser.search.hiddenOneOffs").value;
let hiddenList = pref ? pref.split(",") : [];
while (richlistbox.firstChild)
richlistbox.firstChild.remove();
let currentEngine = Services.search.currentEngine.name;
Services.search.getVisibleEngines().forEach(e => {
if (e.name == currentEngine)
return;
let item = document.createElement("richlistitem");
item.setAttribute("label", e.name);
if (hiddenList.indexOf(e.name) == -1)
item.setAttribute("checked", "true");
if (e.iconURI)
item.setAttribute("src", e.iconURI.spec);
richlistbox.appendChild(item);
});
},
saveOneClickEnginesList: function () {
let richlistbox = document.getElementById("oneClickProvidersList");
let hiddenList = [];
for (let child of richlistbox.childNodes) {
if (!child.checked)
hiddenList.push(child.getAttribute("label"));
}
document.getElementById("browser.search.hiddenOneOffs").value =
hiddenList.join(",");
},
setDefaultEngine: function () {
Services.search.currentEngine =
document.getElementById("defaultEngine").selectedItem.engine;
this.displayOneClickEnginesList();
}
};

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

@ -0,0 +1,47 @@
<preferences id="searchPreferences">
<!-- Suggest -->
<preference id="browser.search.suggest.enabled"
name="browser.search.suggest.enabled"
type="bool"/>
<!-- One off providers -->
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="string"/>
</preferences>
<script type="application/javascript"
src="chrome://browser/content/preferences/in-content/search.js"/>
<hbox id="header-search"
class="header"
hidden="true"
data-category="paneSearch">
<label class="header-name">&paneSearch.title;</label>
</hbox>
<!-- Default Search Engine -->
<groupbox id="defaultEngineGroup" align="start" data-category="paneSearch">
<caption label="&defaultSearchEngine.label;"/>
<label>&chooseYourDefaultSearchEngine.label;</label>
<menulist id="defaultEngine" oncommand="gSearchPane.setDefaultEngine();">
<menupopup/>
</menulist>
<checkbox id="suggestionsInSearchFieldsCheckbox"
label="&provideSearchSuggestions.label;"
accesskey="&provideSearchSuggestions.accesskey;"
preference="browser.search.suggest.enabled"/>
</groupbox>
<groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">
<caption label="&oneClickSearchEngines.label;"/>
<label>&chooseWhichOneToDisplay.label;</label>
<richlistbox id="oneClickProvidersList"/>
<hbox pack="end">
<label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"
onclick="if (event.button == 0) { Services.wm.getMostRecentWindow('navigator:browser').BrowserSearch.loadAddEngines(); }"/>
</hbox>
</groupbox>

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

@ -31,6 +31,7 @@ browser.jar:
* content/browser/preferences/permissions.xul
* content/browser/preferences/permissions.js
* content/browser/preferences/preferences.xul
content/browser/preferences/preferences.js
content/browser/preferences/privacy.xul
* content/browser/preferences/privacy.js
content/browser/preferences/sanitize.xul
@ -43,6 +44,9 @@ browser.jar:
content/browser/preferences/sync.xul
content/browser/preferences/sync.js
#endif
content/browser/preferences/search.xul
content/browser/preferences/search.css
content/browser/preferences/search.js
* content/browser/preferences/tabs.xul
* content/browser/preferences/tabs.js
* content/browser/preferences/translation.xul

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

@ -0,0 +1,19 @@
/* - This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
if (!Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
addEventListener("load", function onLoad() {
removeEventListener("load", onLoad);
let pane =
document.getAnonymousElementByAttribute(document.documentElement,
"pane", "paneSearch");
pane.hidden = true;
if (pane.selected)
document.documentElement.showPane(document.getElementById("paneMain"));
});
}

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

@ -16,6 +16,7 @@
-->
<?xml-stylesheet href="chrome://browser/content/preferences/handlers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/applications.css"?>
<?xml-stylesheet href="chrome://browser/content/preferences/search.css"?>
<!DOCTYPE prefwindow [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
@ -66,6 +67,8 @@
src="chrome://browser/content/preferences/main.xul"/>
<prefpane id="paneTabs" label="&paneTabs.title;"
src="chrome://browser/content/preferences/tabs.xul"/>
<prefpane id="paneSearch" label="&paneSearch.title;"
src="chrome://browser/content/preferences/search.xul"/>
<prefpane id="paneContent" label="&paneContent.title;"
src="chrome://browser/content/preferences/content.xul"/>
<prefpane id="paneApplications" label="&paneApplications.title;"
@ -81,6 +84,8 @@
<prefpane id="paneAdvanced" label="&paneAdvanced.title;"
src="chrome://browser/content/preferences/advanced.xul"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/preferences.js"/>
#ifdef XP_MACOSX
#include ../../base/content/browserMountPoints.inc
#endif

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

@ -0,0 +1,29 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#oneClickProvidersList richlistitem {
-moz-binding: url("chrome://global/content/bindings/checkbox.xml#checkbox");
-moz-padding-start: 5px;
height: 22px; /* setting the height of checkboxes is required to let the
window auto-sizing code work. */
}
#oneClickProvidersList {
height: 178px;
}
.searchengine-menuitem > .menu-iconic-left {
display: -moz-box
}
.checkbox-label-box {
-moz-box-align: center;
-moz-appearance: none;
border: none;
}
.checkbox-icon {
margin: 3px 3px;
max-width: 16px;
}

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

@ -0,0 +1,68 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gSearchPane = {
init: function ()
{
let list = document.getElementById("defaultEngine");
let currentEngine = Services.search.currentEngine.name;
Services.search.getVisibleEngines().forEach(e => {
let item = list.appendItem(e.name);
item.setAttribute("class", "menuitem-iconic searchengine-menuitem menuitem-with-favicon");
if (e.iconURI)
item.setAttribute("image", e.iconURI.spec);
item.engine = e;
if (e.name == currentEngine)
list.selectedItem = item;
});
this.displayOneClickEnginesList();
document.getElementById("oneClickProvidersList")
.addEventListener("CheckboxStateChange", gSearchPane.saveOneClickEnginesList);
},
displayOneClickEnginesList: function () {
let richlistbox = document.getElementById("oneClickProvidersList");
let pref = document.getElementById("browser.search.hiddenOneOffs").value;
let hiddenList = pref ? pref.split(",") : [];
while (richlistbox.firstChild)
richlistbox.firstChild.remove();
let currentEngine = Services.search.currentEngine.name;
Services.search.getVisibleEngines().forEach(e => {
if (e.name == currentEngine)
return;
let item = document.createElement("richlistitem");
item.setAttribute("label", e.name);
if (hiddenList.indexOf(e.name) == -1)
item.setAttribute("checked", "true");
if (e.iconURI)
item.setAttribute("src", e.iconURI.spec);
richlistbox.appendChild(item);
});
},
saveOneClickEnginesList: function () {
let richlistbox = document.getElementById("oneClickProvidersList");
let hiddenList = [];
for (let child of richlistbox.childNodes) {
if (!child.checked)
hiddenList.push(child.getAttribute("label"));
}
document.getElementById("browser.search.hiddenOneOffs").value =
hiddenList.join(",");
},
setDefaultEngine: function () {
Services.search.currentEngine =
document.getElementById("defaultEngine").selectedItem.engine;
this.displayOneClickEnginesList();
}
};

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

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE overlay [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
<!ENTITY % searchDTD SYSTEM "chrome://browser/locale/preferences/search.dtd">
%brandDTD;
%searchDTD;
]>
<overlay id="SearchPaneOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<prefpane id="paneSearch" helpTopic="prefs-search"
onpaneload="gSearchPane.init();">
<preferences id="searchPreferences">
<!-- Suggest -->
<preference id="browser.search.suggest.enabled"
name="browser.search.suggest.enabled"
type="bool"/>
<!-- One off providers -->
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="string"/>
</preferences>
<script type="application/javascript" src="chrome://browser/content/preferences/search.js"/>
<!-- Default Search Engine -->
<groupbox id="defaultEngineGroup" align="start">
<caption label="&defaultSearchEngine.label;"/>
<label>&chooseYourDefaultSearchEngine.label;</label>
<menulist id="defaultEngine" oncommand="gSearchPane.setDefaultEngine();">
<menupopup/>
</menulist>
<checkbox id="suggestionsInSearchFieldsCheckbox"
label="&provideSearchSuggestions.label;"
accesskey="&provideSearchSuggestions.accesskey;"
preference="browser.search.suggest.enabled"/>
</groupbox>
<groupbox id="oneClickSearchProvidersGroup">
<caption label="&oneClickSearchEngines.label;"/>
<label>&chooseWhichOneToDisplay.label;</label>
<richlistbox id="oneClickProvidersList"/>
<hbox pack="end" style="margin-bottom: 1em">
<label id="addEngines" class="text-link" value="&addMoreSearchEngines.label;"
onclick="if (event.button == 0) { Services.wm.getMostRecentWindow('navigator:browser').BrowserSearch.loadAddEngines(); }"/>
</hbox>
</groupbox>
</prefpane>
</overlay>

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

@ -73,6 +73,12 @@
<implementation implements="nsIObserver">
<constructor><![CDATA[
if (!this.hasAttribute("oneoffui") &&
Services.prefs.getBoolPref("browser.search.showOneOffButtons")) {
this.setAttribute("oneoffui", "true");
return;
}
if (this.parentNode.parentNode.localName == "toolbarpaletteitem")
return;
// Make sure we rebuild the popup in onpopupshowing
@ -100,6 +106,11 @@
]]></constructor>
<destructor><![CDATA[
this.destroy();
]]></destructor>
<method name="destroy">
<body><![CDATA[
if (this._initialized) {
this._initialized = false;
@ -112,7 +123,8 @@
// the world. But make sure it's actually pointing to us.
if (this._textbox.mController.input == this)
this._textbox.mController.input = null;
]]></destructor>
]]></body>
</method>
<field name="_stringBundle">document.getAnonymousElementByAttribute(this,
"anonid", "searchbar-stringbundle");</field>
@ -304,7 +316,12 @@
var name = this.currentEngine.name;
var text = this._stringBundle.getFormattedString("searchtip", [name]);
this._textbox.placeholder = name;
if (Services.prefs.getBoolPref("browser.search.showOneOffButtons"))
this._textbox.placeholder = this._stringBundle.getString("searchPlaceholder");
else
this._textbox.placeholder = name;
this._textbox.label = text;
this._textbox.tooltipText = text;
]]></body>
@ -449,6 +466,7 @@
<method name="handleSearchCommand">
<parameter name="aEvent"/>
<parameter name="aEngine"/>
<body><![CDATA[
var textBox = this._textbox;
var textValue = textBox.value;
@ -465,13 +483,14 @@
where = "tab";
}
this.doSearch(textValue, where);
this.doSearch(textValue, where, aEngine);
]]></body>
</method>
<method name="doSearch">
<parameter name="aData"/>
<parameter name="aWhere"/>
<parameter name="aEngine"/>
<body><![CDATA[
var textBox = this._textbox;
@ -485,10 +504,11 @@
Components.utils.reportError("Saving search to form history failed: " + aError.message);
}});
}
let engine = aEngine || this.currentEngine;
var submission = engine.getSubmission(aData, null, "searchbar");
BrowserSearch.recordSearchInHealthReport(engine, "searchbar");
// null parameter below specifies HTML response for search
var submission = this.currentEngine.getSubmission(aData, null, "searchbar");
BrowserSearch.recordSearchInHealthReport(this.currentEngine, "searchbar");
openUILinkIn(submission.uri.spec, aWhere, null, submission.postData);
]]></body>
</method>
@ -536,6 +556,124 @@
</handlers>
</binding>
<binding id="searchbar-flare" extends="chrome://browser/content/search/search.xml#searchbar">
<resources>
<stylesheet src="chrome://browser/content/search/searchbarBindings.css"/>
<stylesheet src="chrome://browser/skin/searchbar.css"/>
</resources>
<content>
<xul:stringbundle src="chrome://browser/locale/search.properties"
anonid="searchbar-stringbundle"/>
<!--
There is a dependency between "maxrows" attribute and
"SuggestAutoComplete._historyLimit" (nsSearchSuggestions.js). Changing
one of them requires changing the other one.
-->
<xul:textbox class="searchbar-textbox"
anonid="searchbar-textbox"
type="autocomplete"
flex="1"
autocompletepopup="PopupSearchAutoComplete"
autocompletesearch="search-autocomplete"
autocompletesearchparam="searchbar-history"
maxrows="10"
completeselectedindex="true"
tabscrolling="true"
xbl:inherits="disabled,disableautocomplete,searchengine,src,newlines">
<!--
Empty <box> to properly position the icon within the autocomplete
binding's anonymous children (the autocomplete binding positions <box>
children differently)
-->
<xul:box>
<xul:hbox class="searchbar-search-button-container">
<xul:image class="searchbar-search-button"
anonid="searchbar-search-button"
tooltiptext="&searchEndCap.label;"/>
</xul:hbox>
<xul:button class="searchbar-engine-button"
type="menu"
anonid="searchbar-engine-button">
<xul:image class="searchbar-engine-image" xbl:inherits="src"/>
<xul:image class="searchbar-dropmarker-image"/>
<xul:menupopup class="searchbar-popup"
anonid="searchbar-popup">
<xul:menuseparator/>
<xul:menuitem class="open-engine-manager"
anonid="open-engine-manager"
label="&cmd_engineManager.label;"
oncommand="openManager(event);"/>
</xul:menupopup>
</xul:button>
</xul:box>
<xul:hbox class="search-go-container">
<xul:image class="search-go-button" hidden="true"
anonid="search-go-button"
onclick="handleSearchCommand(event);"
tooltiptext="&searchEndCap.label;"/>
</xul:hbox>
</xul:textbox>
</content>
<implementation>
<destructor><![CDATA[
// For some reason the destructor of the base binding is called
// automatically when the window is closed, but now when the node
// is removed from the DOM.
this.destroy();
]]></destructor>
<method name="selectEngine">
<body><![CDATA[
// Override this method to avoid accidentally changing the default
// engine using the keyboard shortcuts of the old UI.
]]></body>
</method>
<method name="updateGoButtonVisibility">
<body><![CDATA[
document.getAnonymousElementByAttribute(this, "anonid",
"search-go-button")
.hidden = !this._textbox.value;
]]></body>
</method>
<method name="openSuggestionsPanel">
<parameter name="aShowOnlySettingsIfEmpty"/>
<body><![CDATA[
if (this._textbox.open)
return;
this._textbox.showHistoryPopup();
if (this._textbox.value) {
// showHistoryPopup does a startSearch("") call, ensure the
// controller handles the text from the input box instead:
this._textbox.mController.handleText();
}
else if (aShowOnlySettingsIfEmpty) {
this.setAttribute("showonlysettings", "true");
}
]]></body>
</method>
</implementation>
<handlers>
<handler event="input" action="this.updateGoButtonVisibility();"/>
<handler event="drop" action="this.updateGoButtonVisibility();"/>
<handler event="focus">
<![CDATA[
if (this._textbox.value)
this.openSuggestionsPanel();
]]></handler>
<handler event="click">
<![CDATA[
if (event.originalTarget.getAttribute("anonid") == "searchbar-search-button")
this.openSuggestionsPanel(true);
]]></handler>
</handlers>
</binding>
<binding id="searchbar-textbox"
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
<implementation implements="nsIObserver">
@ -731,11 +869,154 @@
<parameter name="aEvent"/>
<body><![CDATA[
var evt = aEvent || this.mEnterEvent;
document.getBindingParent(this).handleSearchCommand(evt);
let engine;
let oneOff = this.getSelectedOneOff();
if (oneOff)
engine = oneOff.engine;
document.getBindingParent(this).handleSearchCommand(evt, engine);
this.mEnterEvent = null;
]]></body>
</method>
<method name="getSelectedOneOff">
<body><![CDATA[
let list = document.getAnonymousElementByAttribute(this.popup, "anonid",
"search-panel-one-offs");
if (!list)
return null;
for (let button = list.firstChild; button; button = button.nextSibling) {
if (button.hasAttribute("selected"))
return button;
}
return null;
]]></body>
</method>
<method name="handleKeyboardNavigation">
<parameter name="aEvent"/>
<body><![CDATA[
// XXXFlorian This method could likely be shortened with a helper
// handling moving the selection within the one-off list and
// returning a boolean indicating if the event should be stopped.
let popup = this.popup;
if (!popup.popupOpen)
return;
if (aEvent.keyCode == KeyEvent.DOM_VK_DOWN &&
popup.hasAttribute("showonlysettings")) {
// If the suggestion tree is collapsed, don't let the down arrow
// key event reach the tree.
aEvent.preventDefault();
aEvent.stopPropagation();
return;
}
let list = document.getAnonymousElementByAttribute(popup, "anonid",
"search-panel-one-offs");
if (!list)
return;
let selectedButton = this.getSelectedOneOff();
// If the last suggestion is selected, DOWN selects the first one-off.
if (aEvent.keyCode == KeyEvent.DOM_VK_DOWN &&
popup.selectedIndex + 1 == popup.view.rowCount) {
if (selectedButton)
selectedButton.removeAttribute("selected");
selectedButton = list.firstChild;
if (selectedButton)
selectedButton.setAttribute("selected", "true");
}
// If no suggestion is selected and a one-off is selected,
// UP and DOWN cycle through one-off buttons.
if (popup.selectedIndex == -1 && selectedButton &&
(aEvent.keyCode == KeyEvent.DOM_VK_DOWN ||
aEvent.keyCode == KeyEvent.DOM_VK_UP)) {
selectedButton.removeAttribute("selected");
if (aEvent.keyCode == KeyEvent.DOM_VK_DOWN)
selectedButton = selectedButton.nextSibling;
else
selectedButton = selectedButton.previousSibling;
if (selectedButton && selectedButton.classList.contains("dummy"))
selectedButton = null;
if (selectedButton) {
selectedButton.setAttribute("selected", "true");
aEvent.preventDefault();
aEvent.stopPropagation();
}
else {
// Set the selectedIndex to something that will make
// handleKeyNavigation (called by autocomplete.xml's onKeyPress
// method) reset the text field value to what the user typed.
if (aEvent.keyCode == KeyEvent.DOM_VK_UP)
popup.selectedIndex = popup.view.rowCount;
else
popup.selectedIndex = popup.view.rowCount - 1;
}
}
// If nothing is selected, UP selects the last one-off button.
if (aEvent.keyCode == KeyEvent.DOM_VK_UP &&
popup.selectedIndex == -1 && !selectedButton) {
selectedButton = list.lastChild;
while (selectedButton.classList.contains("dummy"))
selectedButton = selectedButton.previousSibling;
selectedButton.setAttribute("selected", "true");
aEvent.preventDefault();
aEvent.stopPropagation();
}
if (aEvent.keyCode == KeyEvent.DOM_VK_TAB) {
if (selectedButton) {
// TAB cycles though the list of one-off buttons.
selectedButton.removeAttribute("selected");
if (aEvent.shiftKey)
selectedButton = selectedButton.previousSibling;
else
selectedButton = selectedButton.nextSibling;
// Avoid selecting dummy buttons.
if (selectedButton && selectedButton.classList.contains("dummy"))
selectedButton = null;
// If we are out of the list, revert the text field to what the user typed.
if (!selectedButton) {
// Set the selectedIndex to something that will make
// handleKeyNavigation (called by autocomplete.xml's onKeyPress
// method) reset the text field value to what the user typed.
popup.selectedIndex = aEvent.shiftKey ? 0 : popup.view.rowCount - 1;
return;
}
}
else {
// If no selection, select the first or last one-off button.
if (aEvent.shiftKey) {
selectedButton = list.lastChild;
while (selectedButton.classList.contains("dummy"))
selectedButton = selectedButton.previousSibling;
}
else {
selectedButton = list.firstChild;
}
}
selectedButton.setAttribute("selected", "true");
aEvent.preventDefault();
aEvent.stopPropagation();
}
]]></body>
</method>
<!-- nsIController -->
<field name="searchbarController" readonly="true"><![CDATA[({
_self: this,
@ -772,6 +1053,9 @@
</implementation>
<handlers>
<handler event="keypress" phase="capturing"
action="return this.handleKeyboardNavigation(event);"/>
<handler event="keypress" keycode="VK_UP" modifiers="accel"
phase="capturing"
action="document.getBindingParent(this).selectEngine(event, false);"/>

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

@ -1,7 +1,10 @@
function test() {
var searchBar = BrowserSearch.searchBar;
ok(searchBar, "got search bar");
if (searchBar.getAttribute("oneoffui"))
return; // The oneoffui removes the menu that's being tested here.
searchBar.focus();
var pbo = searchBar._popup.popupBoxObject;

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

@ -141,6 +141,7 @@ function* prepareTest() {
searchBar.removeEventListener("focus", onFocus);
deferred.resolve();
});
gURLBar.focus();
searchBar.focus();
} else {
deferred.resolve();
@ -228,11 +229,10 @@ add_task(function testShiftMiddleClick() {
add_task(function testDropText() {
yield prepareTest();
let promisePreventPopup = promiseEvent(searchBar, "popupshowing", true);
// drop on the search button so that we don't need to worry about the
// default handlers for textboxes.
ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
yield promisePreventPopup;
let searchButton = document.getAnonymousElementByAttribute(searchBar, "anonid", "searchbar-search-button");
ChromeUtils.synthesizeDrop(searchButton, searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
let event = yield promiseOnLoad();
is(event.originalTarget.URL, expectedURL(searchBar.value), "testDropText opened correct search page");
is(searchBar.value, "Some Text", "drop text/plain on searchbar");
@ -240,9 +240,8 @@ add_task(function testDropText() {
add_task(function testDropInternalText() {
yield prepareTest();
let promisePreventPopup = promiseEvent(searchBar, "popupshowing", true);
ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
yield promisePreventPopup;
let searchButton = document.getAnonymousElementByAttribute(searchBar, "anonid", "searchbar-search-button");
ChromeUtils.synthesizeDrop(searchButton, searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
let event = yield promiseOnLoad();
is(event.originalTarget.URL, expectedURL(searchBar.value), "testDropInternalText opened correct search page");
is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar");
@ -251,9 +250,7 @@ add_task(function testDropInternalText() {
// were merged so that if testDropInternalText failed it wouldn't cause testDropLink
// to fail unexplainably.
yield prepareTest();
promisePreventPopup = promiseEvent(searchBar, "popupshowing", true);
ChromeUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
yield promisePreventPopup;
is(searchBar.value, "More Text", "drop text/uri-list on searchbar shouldn't change anything");
});
@ -268,6 +265,9 @@ add_task(function testRightClick() {
deferred.resolve();
}, 5000);
yield deferred.promise;
// The click in the searchbox focuses it, which opens the suggestion
// panel. Clean up after ourselves.
searchBar.textbox.popup.hidePopup();
});
add_task(function testSearchHistory() {
@ -302,4 +302,3 @@ add_task(function asyncCleanup() {
content.location.href = "about:blank";
yield promiseRemoveEngine();
});

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

@ -415,6 +415,13 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY searchFocus.commandkey2 "e">
<!ENTITY searchFocusUnix.commandkey "j">
<!-- LOCALIZATION NOTE (searchFor.label, searchWith.label):
These two strings are used to build the header above the list of one-click
search providers: "Search for <used typed keywords> with:" -->
<!ENTITY searchFor.label "Search for ">
<!ENTITY searchWith.label " with:">
<!ENTITY changeSearchSettings.button "Change Search Settings">
<!ENTITY tabView.commandkey "e">
<!ENTITY openLinkCmdInTab.label "Open Link in New Tab">

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

@ -306,7 +306,7 @@ rooms_list_delete_tooltip=Delete conversation
rooms_list_deleteConfirmation_label=Are you sure?
rooms_list_no_current_conversations=No current conversations
rooms_name_this_room_label=Name this conversation
rooms_name_this_room_tooltip=Click to edit the room name
rooms_name_this_room_tooltip2=Click to edit the conversation name
rooms_name_change_failed_label=Conversation cannot be renamed
rooms_new_room_button_label=Start a conversation
rooms_only_occupant_label=You're the first one here.

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

@ -15,6 +15,7 @@
<!ENTITY paneGeneral.title "General">
<!ENTITY paneTabs.title "Tabs">
<!ENTITY paneSearch.title "Search">
<!ENTITY paneContent.title "Content">
<!ENTITY paneApplications.title "Applications">
<!ENTITY panePrivacy.title "Privacy">

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

@ -0,0 +1,17 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY defaultSearchEngine.label "Default Search Engine">
<!ENTITY chooseYourDefaultSearchEngine.label "Choose your default search engine. &brandShortName; uses it in the location bar, search bar, and start page.">
<!ENTITY provideSearchSuggestions.label "Provide search suggestions">
<!ENTITY provideSearchSuggestions.accesskey "s">
<!ENTITY oneClickSearchEngines.label "One-click search engines">
<!ENTITY chooseWhichOneToDisplay.label "The search bar lets you search alternate engines directly. Choose which ones to display.">
<!ENTITY addMoreSearchEngines.label "Add more search engines…">

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

@ -4,6 +4,15 @@
searchtip=Search using %S
# LOCALIZATION NOTE (searchPlaceholder): this is shown in the searchbox when
# the user hasn't typed anything yet.
searchPlaceholder=Search
# LOCALIZATION NOTE (searchHeader): this is displayed at the top of the panel
# showing search suggestions.
# %S is replaced with the name of the current default search engine.
searchHeader=%S Search
# LOCALIZATION NOTE (cmd_pasteAndSearch): "Search" is a verb, this is the
# search bar equivalent to the url bar's "Paste & Go"
cmd_pasteAndSearch=Paste & Search

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

@ -131,6 +131,7 @@
locale/browser/preferences/sync.dtd (%chrome/browser/preferences/sync.dtd)
#endif
locale/browser/preferences/tabs.dtd (%chrome/browser/preferences/tabs.dtd)
locale/browser/preferences/search.dtd (%chrome/browser/preferences/search.dtd)
locale/browser/preferences/translation.dtd (%chrome/browser/preferences/translation.dtd)
#ifdef MOZ_SERVICES_SYNC
locale/browser/syncBrand.dtd (%chrome/browser/syncBrand.dtd)

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

@ -128,12 +128,49 @@ this.UITour = {
["searchProvider", {
query: (aDocument) => {
let searchbar = aDocument.getElementById("searchbar");
if (searchbar.hasAttribute("oneoffui")) {
return null;
}
return aDocument.getAnonymousElementByAttribute(searchbar,
"anonid",
"searchbar-engine-button");
},
widgetName: "search-container",
}],
["searchIcon", {
query: (aDocument) => {
let searchbar = aDocument.getElementById("searchbar");
if (!searchbar.hasAttribute("oneoffui")) {
return null;
}
return aDocument.getAnonymousElementByAttribute(searchbar,
"anonid",
"searchbar-search-button");
},
widgetName: "search-container",
}],
["searchPrefsLink", {
query: (aDocument) => {
let element = null;
let searchbar = aDocument.getElementById("searchbar");
if (searchbar.hasAttribute("oneoffui")) {
let popup = aDocument.getElementById("PopupSearchAutoComplete");
if (popup.state != "open")
return null;
element = aDocument.getAnonymousElementByAttribute(popup,
"anonid",
"search-settings");
} else {
element = aDocument.getAnonymousElementByAttribute(searchbar,
"anonid",
"open-engine-manager");
}
if (!element || !UITour.isElementVisible(element)) {
return null;
}
return element;
},
}],
["selectedTabIcon", {
query: (aDocument) => {
let selectedtab = aDocument.defaultView.gBrowser.selectedTab;

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

@ -221,8 +221,13 @@ let tests = [
gContentAPI.showHighlight("urlbar");
waitForElementToBeVisible(highlight, () => {
let searchbar = document.getElementById("searchbar");
if (searchbar.getAttribute("oneoffui")) {
done();
return; // The oneoffui removes the menu that's being tested here.
}
gContentAPI.showMenu("searchEngines", function() {
let searchbar = document.getElementById("searchbar");
isnot(searchbar, null, "Should have found searchbar");
let searchPopup = document.getAnonymousElementByAttribute(searchbar,
"anonid",

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

@ -41,7 +41,7 @@ let tests = [
"privateWindow",
"quit",
"search",
"searchProvider",
"searchIcon",
"urlbar",
...searchEngineTargets(),
...(hasWebIDE ? ["webide"] : [])
@ -72,7 +72,7 @@ let tests = [
"privateWindow",
"quit",
"search",
"searchProvider",
"searchIcon",
"urlbar",
...searchEngineTargets(),
...(hasWebIDE ? ["webide"] : [])
@ -92,7 +92,7 @@ let tests = [
// Make sure the callback still fires with the other available targets.
CustomizableUI.removeWidgetFromArea("search-container");
gContentAPI.getConfiguration("availableTargets", (data) => {
// Default minus "search" and "searchProvider"
// Default minus "search" and "searchProvider" and "searchIcon"
ok_targets(data, [
"accountStatus",
"addons",

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

@ -60,7 +60,7 @@ let tests = [
function test_highlight_panel_click_find(done) {
gContentAPI.showHighlight("help");
gContentAPI.showInfo("searchProvider", "test title", "test text");
gContentAPI.showInfo("searchIcon", "test title", "test text");
waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
isnot(PanelUI.panel.state, "closed", "Panel should have opened");

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

@ -62,6 +62,11 @@ browser.jar:
skin/classic/browser/privatebrowsing-mask.png
skin/classic/browser/reload-stop-go.png
skin/classic/browser/searchbar.css
skin/classic/browser/search-pref.png (../shared/search/search-pref.png)
skin/classic/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/Secure.png
skin/classic/browser/Security-broken.png
skin/classic/browser/setDesktopBackground.css

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

@ -20,6 +20,14 @@ radio[pane=paneTabs] {
-moz-image-region: rect(0px, 64px, 32px, 32px)
}
#BrowserPreferences radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
.checkbox-check {
-moz-appearance: checkbox;
}
radio[pane=paneContent] {
-moz-image-region: rect(0px, 96px, 32px, 64px)
}

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

@ -67,3 +67,178 @@ menuitem[cmd="cmd_clearhistory"][disabled] {
list-style-image: url("moz-icon://stock/gtk-clear?size=menu&state=disabled");
}
.searchbar-search-button-container {
-moz-box-align: center;
padding: 2px 3px;
-moz-padding-end: 2px;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin: -2px -2px;
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
searchbar[oneoffui] .search-go-button {
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
-moz-image-region: rect(0, 42px, 14px, 28px);
}
searchbar[oneoffui] .search-go-button:hover {
-moz-image-region: rect(14px, 42px, 28px, 28px);
}
searchbar[oneoffui] .search-go-button:hover:active {
-moz-image-region: rect(28px, 42px, 42px, 28px);
}
searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
transform: scaleX(-1);
}
.search-panel-current-engine {
border-top: none !important;
border-bottom: 1px solid #ccc;
-moz-box-align: center;
}
.search-panel-header {
font-weight: normal;
background-color: rgb(245, 245, 245);
border-top: 1px solid #ccc;
margin: 0 1px;
padding: 3px 5px;
color: #666;
}
.search-panel-current-input > label {
margin: 0 0 !important;
}
.search-panel-input-value {
color: black;
}
.search-panel-one-offs {
margin: 0 0 !important;
border-top: 1px solid #ccc;
}
.searchbar-engine-one-off-item {
-moz-appearance: none;
display: inline-block;
border: none;
min-width: 48px;
height: 32px;
margin: 0 0;
padding: 0 0;
background: none;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAWCAYAAAABxvaqAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gofECQNNVW2/AAAABBJREFUGFdjOHPmzH8GehEA/KpKg9YTf4AAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-position: right center;
}
.searchbar-engine-one-off-item:not(.last-row) {
box-sizing: padding-box;
border-bottom: 1px solid #ccc;
}
.searchbar-engine-one-off-item.last-of-row {
background-image: none;
}
.searchbar-engine-one-off-item:hover:not(.dummy),
.searchbar-engine-one-off-item[selected] {
background-color: Highlight;
background-image: none;
}
.searchbar-engine-one-off-item > .button-box {
border: none;
padding: 0 0;
}
.searchbar-engine-one-off-item > .button-box > .button-text {
display: none;
}
.searchbar-engine-one-off-item > .button-box > .button-icon {
display: -moz-box;
-moz-margin-end: 0;
width: 16px;
height: 16px;
}
.addengine-item {
-moz-appearance: none;
border: none;
height: 32px;
margin: 0 0;
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid #ccc;
}
.addengine-item:hover {
background-color: Highlight;
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
width: 16px;
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;
-moz-padding-start: 10px;
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder.png");
}
searchbar[oneoffui] .searchbar-engine-button {
display: none;
}
.search-panel-tree > .autocomplete-treebody::-moz-tree-cell {
-moz-padding-start: 16px;
border-top: none !important;
}
searchbar[oneoffui] .searchbar-engine-image {
-moz-margin-start: -1px;
}
.search-setting-button {
-moz-appearance: none;
border-bottom: none;
border-left: none;
border-right: none;
-moz-border-top-colors: none;
min-height: 32px;
}
.search-setting-button:hover {
background-color: #d3d3d3;
border-top-color: #bdbebe;
}

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

@ -100,6 +100,15 @@ browser.jar:
skin/classic/browser/searchbar.css
skin/classic/browser/Search.png
skin/classic/browser/Search@2x.png
skin/classic/browser/search-pref.png (../shared/search/search-pref.png)
skin/classic/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/browser/search-indicator@2x.png (../shared/search/search-indicator@2x.png)
skin/classic/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/browser/search-indicator-add-engine@2x.png (../shared/search/search-indicator-add-engine@2x.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/search-engine-placeholder@2x.png (../shared/search/search-engine-placeholder@2x.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/badge-add-engine@2x.png (../shared/search/badge-add-engine@2x.png)
skin/classic/browser/Secure-Glyph.png
skin/classic/browser/Secure-Glyph@2x.png
skin/classic/browser/slowStartup-16.png

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

@ -32,6 +32,12 @@ radio[pane=paneTabs] {
-moz-image-region: rect(0px, 64px, 32px, 32px);
}
/* ----- SEARCH BUTTON ----- */
radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
/* ----- CONTENT BUTTON ----- */
radio[pane=paneContent] {

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

@ -47,10 +47,43 @@
-moz-padding-end: 6px;
}
.searchbar-search-button-container {
-moz-box-align: center;
-moz-padding-start: 6px;
-moz-padding-end: 4px;
}
.search-go-button {
list-style-image: url("chrome://browser/skin/Search.png");
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin: 0 -3px;
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
searchbar[oneoffui] .search-go-button {
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
-moz-image-region: rect(0, 42px, 14px, 28px);
}
searchbar[oneoffui] .search-go-button:hover:active {
-moz-image-region: rect(14px, 42px, 28px, 28px);
}
searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
transform: scaleX(-1);
}
@media (min-resolution: 2dppx) {
.searchbar-engine-image {
list-style-image: url("chrome://mozapps/skin/places/defaultFavicon@2x.png");
@ -65,4 +98,165 @@
list-style-image: url("chrome://browser/skin/Search@2x.png");
width: 14px;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator@2x.png");
width: 20px;
-moz-image-region: rect(0, 40px, 40px, 0);
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 80px, 40px, 40px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 120px, 40px, 80px);
}
searchbar[oneoffui] .search-go-button {
list-style-image: url("chrome://browser/skin/reload-stop-go@2x.png");
-moz-image-region: rect(0, 84px, 28px, 56px);
width: 14px;
}
searchbar[oneoffui] .search-go-button:hover:active {
list-style-image: url("chrome://browser/skin/reload-stop-go@2x.png");
-moz-image-region: rect(28px, 84px, 56px, 56px);
width: 14px;
}
}
.search-panel-current-engine {
border-top: none !important;
border-bottom: 1px solid #ccc;
border-radius: 4px 4px 0 0;
}
.search-panel-header {
font-size: 10px;
font-weight: normal;
background-color: rgb(245, 245, 245);
border-top: 1px solid #ccc;
margin: 0;
padding: 3px 6px;
color: #666;
}
.search-panel-current-input > label {
margin: 0 0 !important;
}
.search-panel-input-value {
color: black;
}
.search-panel-one-offs {
border-top: 1px solid #ccc;
margin-bottom: 0 !important;
}
.searchbar-engine-one-off-item {
-moz-appearance: none;
display: inline-block;
min-width: 48px;
height: 32px;
margin: 0 0;
padding: 0 0;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAWCAYAAAABxvaqAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gofECQNNVW2/AAAABBJREFUGFdjOHPmzH8GehEA/KpKg9YTf4AAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-position: right center;
}
.searchbar-engine-one-off-item:not(.last-row) {
box-sizing: padding-box;
border-bottom: 1px solid #ccc;
}
.searchbar-engine-one-off-item.last-of-row {
background-image: none;
}
.searchbar-engine-one-off-item:hover:not(.dummy),
.searchbar-engine-one-off-item[selected] {
background-color: Highlight;
background-image: none;
}
.searchbar-engine-one-off-item > .button-box > .button-text {
display: none;
}
.searchbar-engine-one-off-item > .button-box > .button-icon {
-moz-margin-start: 0;
width: 16px;
height: 16px;
}
.addengine-item {
-moz-appearance: none;
font-size: 10px;
height: 32px;
margin: 0 0;
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid #ccc;
}
.addengine-item:hover {
background-color: Highlight;
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
width: 16px;
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;
-moz-padding-start: 10px;
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder.png");
}
@media (min-resolution: 2dppx) {
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder@2x.png");
}
}
searchbar[oneoffui] .searchbar-engine-button {
display: none;
}
.search-panel-tree > .autocomplete-treebody::-moz-tree-cell {
-moz-padding-start: 22px;
border-top: none !important;
}
#PopupSearchAutoComplete {
border-radius: 4px;
}
.search-setting-button {
-moz-appearance: none;
border-radius: 0 0 4px 4px;
min-height: 32px;
}
.search-setting-button[showonlysettings] {
border-radius: 4px;
}
.search-setting-button:hover {
background-color: #d3d3d3;
border-top-color: #bdbebe;
}

Двоичные данные
browser/themes/shared/incontentprefs/icons.png

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

До

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

После

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

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

До

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

После

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

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

@ -33,6 +33,10 @@ treecol {
-moz-image-region: rect(0, 24px, 24px, 0);
}
#category-search > .category-icon {
-moz-image-region: rect(0, 194px, 24px, 168px);
}
#category-content > .category-icon {
-moz-image-region: rect(0, 48px, 24px, 24px);
}
@ -66,6 +70,10 @@ treecol {
-moz-image-region: rect(0, 48px, 48px, 0);
}
#category-search > .category-icon {
-moz-image-region: rect(0, 384px, 48px, 336px);
}
#category-content > .category-icon {
-moz-image-region: rect(0, 96px, 48px, 48px);
}

Двоичные данные
browser/themes/shared/search/badge-add-engine.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/badge-add-engine@2x.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-engine-placeholder.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-engine-placeholder@2x.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-indicator-add-engine.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-indicator-add-engine@2x.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-indicator.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-indicator@2x.png Normal file

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

После

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

Двоичные данные
browser/themes/shared/search/search-pref.png Normal file

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

После

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

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

@ -77,6 +77,11 @@ browser.jar:
skin/classic/browser/reload-stop-go.png
skin/classic/browser/searchbar.css
skin/classic/browser/searchbar-dropdown-arrow.png
skin/classic/browser/search-pref.png (../shared/search/search-pref.png)
skin/classic/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/browser/Secure24.png
skin/classic/browser/setDesktopBackground.css
skin/classic/browser/slowStartup-16.png
@ -511,6 +516,11 @@ browser.jar:
skin/classic/aero/browser/reload-stop-go.png
skin/classic/aero/browser/searchbar.css
skin/classic/aero/browser/searchbar-dropdown-arrow.png (searchbar-dropdown-arrow-aero.png)
skin/classic/aero/browser/search-pref.png (../shared/search/search-pref.png)
skin/classic/aero/browser/search-indicator.png (../shared/search/search-indicator.png)
skin/classic/aero/browser/search-indicator-add-engine.png (../shared/search/search-indicator-add-engine.png)
skin/classic/aero/browser/search-engine-placeholder.png (../shared/search/search-engine-placeholder.png)
skin/classic/aero/browser/badge-add-engine.png (../shared/search/badge-add-engine.png)
skin/classic/aero/browser/Secure24.png (Secure24-aero.png)
skin/classic/aero/browser/setDesktopBackground.css
skin/classic/aero/browser/slowStartup-16.png

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

@ -19,6 +19,10 @@ radio[pane=paneTabs] {
-moz-image-region: rect(0, 64px, 32px, 32px);
}
#BrowserPreferences radio[pane=paneSearch] {
list-style-image: url("chrome://browser/skin/search-pref.png");
}
radio[pane=paneContent] {
-moz-image-region: rect(0, 96px, 32px, 64px);
}

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

@ -78,3 +78,176 @@
.searchbar-engine-menuitem[selected="true"] > .menu-iconic-text {
font-weight: bold;
}
.searchbar-search-button-container {
-moz-box-align: center;
padding: 3px 4px;
-moz-padding-end: 2px;
}
.searchbar-search-button {
list-style-image: url("chrome://browser/skin/search-indicator.png");
-moz-image-region: rect(0, 20px, 20px, 0);
margin: -2px -2px;
}
.searchbar-search-button:hover {
-moz-image-region: rect(0, 40px, 20px, 20px);
}
.searchbar-search-button:hover:active {
-moz-image-region: rect(0, 60px, 20px, 40px);
}
searchbar[oneoffui] .search-go-button {
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
-moz-image-region: rect(0, 42px, 14px, 28px);
}
searchbar[oneoffui] .search-go-button:hover {
-moz-image-region: rect(14px, 42px, 28px, 28px);
}
searchbar[oneoffui] .search-go-button:hover:active {
-moz-image-region: rect(28px, 42px, 42px, 28px);
}
searchbar[oneoffui] .search-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
transform: scaleX(-1);
}
.search-panel-current-engine {
border-top: none !important;
border-bottom: 1px solid #ccc;
-moz-box-align: center;
}
.search-panel-header {
font-weight: normal;
background-color: rgb(245, 245, 245);
border-top: 1px solid #ccc;
margin: 0;
padding: 3px 6px;
color: #666;
}
.search-panel-current-input > label {
margin: 0 0 !important;
}
.search-panel-input-value {
color: black;
}
.search-panel-one-offs {
margin: 0 0 !important;
border-top: 1px solid #ccc;
}
.searchbar-engine-one-off-item {
-moz-appearance: none;
display: inline-block;
border: none;
min-width: 48px;
height: 32px;
margin: 0 0;
padding: 0 0;
background: none;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAWCAYAAAABxvaqAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gofECQNNVW2/AAAABBJREFUGFdjOHPmzH8GehEA/KpKg9YTf4AAAAAASUVORK5CYII=');
background-repeat: no-repeat;
background-position: right center;
}
.searchbar-engine-one-off-item:not(.last-row) {
box-sizing: padding-box;
border-bottom: 1px solid #ccc;
}
.searchbar-engine-one-off-item.last-of-row {
background-image: none;
}
.searchbar-engine-one-off-item:hover:not(.dummy),
.searchbar-engine-one-off-item[selected] {
background-color: Highlight;
background-image: none;
}
.searchbar-engine-one-off-item > .button-box {
border: none;
padding: 0 0;
}
.searchbar-engine-one-off-item > .button-box > .button-text {
display: none;
}
.searchbar-engine-one-off-item > .button-box > .button-icon {
width: 16px;
height: 16px;
}
.addengine-item {
-moz-appearance: none;
border: none;
height: 32px;
margin: 0 0;
padding: 0 10px;
}
.addengine-item > .button-box {
-moz-box-pack: start;
}
.addengine-item:first-of-type {
border-top: 1px solid #ccc;
}
.addengine-item:hover {
background-color: Highlight;
color: HighlightText;
}
.addengine-item > .button-box > .button-icon {
width: 16px;
}
.addengine-item > .button-box > .button-text {
-moz-box-flex: 1;
text-align: start;
-moz-padding-start: 10px;
}
.addengine-item:not([image]) {
list-style-image: url("chrome://browser/skin/search-engine-placeholder.png");
}
searchbar[oneoffui] .searchbar-engine-button {
display: none;
}
.search-panel-tree > .autocomplete-treebody::-moz-tree-cell {
-moz-padding-start: 15px;
border-top: none !important;
}
searchbar[oneoffui] .searchbar-engine-image {
-moz-margin-start: -1px;
}
.search-setting-button {
-moz-appearance: none;
border-bottom: none;
border-left: none;
border-right: none;
-moz-border-top-colors: none;
min-height: 32px;
}
.search-setting-button:hover {
background-color: #d3d3d3;
border-top-color: #bdbebe;
}

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

@ -187,20 +187,23 @@ nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsMappedAttributes::List(FILE* out, int32_t aIndent) const
{
nsAutoString buffer;
nsAutoCString str;
nsAutoString tmp;
uint32_t i;
for (i = 0; i < mAttrCount; ++i) {
int32_t indent;
for (indent = aIndent; indent > 0; --indent)
fputs(" ", out);
for (indent = aIndent; indent > 0; --indent) {
str.AppendLiteral(" ");
}
Attrs()[i].mName.GetQualifiedName(buffer);
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
Attrs()[i].mName.GetQualifiedName(tmp);
LossyAppendUTF16toASCII(tmp, str);
Attrs()[i].mValue.ToString(buffer);
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
fputs("\n", out);
Attrs()[i].mValue.ToString(tmp);
LossyAppendUTF16toASCII(tmp, str);
str.Append('\n');
fprintf_stderr(out, "%s", str.get());
}
}
#endif

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

@ -171,8 +171,11 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
/* virtual */ void
BodyRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[body rule] {}\n", out);
nsAutoCString indent;
for (int32_t index = aIndent; --index >= 0; ) {
indent.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[body rule] {}\n", indent.get());
}
#endif

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

@ -22,6 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=548523
/** Test for Bug 548523 **/
SimpleTest.requestCompleteLog();
var manager = new MediaTestManager;
manager.onFinished = function() {
@ -472,6 +473,18 @@ var tests = [
v.addEventListener("ended", this.ended, false);
v.src = test.name; // Causes implicit load.
document.body.appendChild(v);
// Log events for debugging.
var events = ["suspend", "play", "canplay", "canplaythrough", "loadstart", "loadedmetadata",
"loadeddata", "playing", "ended", "error", "stalled", "emptied", "abort",
"waiting", "pause"];
function logEvent(e) {
var v = e.target;
info(e.target.token + ": got " + e.type);
}
events.forEach(function(e) {
v.addEventListener(e, logEvent, false);
});
},
name: "test15",

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

@ -300,7 +300,7 @@ PluginHangUIParent::UnwatchHangUIChildProcess(bool aWait)
// it is okay to clear mRegWait; Windows is telling us that the wait's
// callback is running but will be cleaned up once the callback returns.
if (::UnregisterWaitEx(mRegWait, completionEvent) ||
!aWait && ::GetLastError() == ERROR_IO_PENDING) {
(!aWait && ::GetLastError() == ERROR_IO_PENDING)) {
mRegWait = nullptr;
if (aWait) {
// We must temporarily unlock mMutex while waiting for the registered

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

@ -812,7 +812,7 @@ PluginModuleChromeParent::FinishHangUI()
/* If we cancelled the UI or if the user issued a response,
we need to reset the child process timeout. */
if (needsCancel ||
!mIsTimerReset && mHangUIParent->WasShown()) {
(!mIsTimerReset && mHangUIParent->WasShown())) {
/* We changed the timeout to kChildTimeoutPref when the plugin hang
UI was displayed. Now that we're finishing the UI, we need to
switch it back to kHangUITimeoutPref. */

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

@ -876,10 +876,6 @@ nsEditorEventListener::CleanupDragDropCaret()
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (presShell) {
nsCOMPtr<nsISelectionController> selCon(do_QueryInterface(presShell));
if (selCon) {
selCon->SetCaretEnabled(false);
}
presShell->RestoreCaret();
}

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

@ -19,6 +19,7 @@ skip-if = buildapp == 'mulet'
[test_bug780908.xul]
[test_bug830600.html]
[test_bug1053048.html]
[test_bug1102906.html]
[test_composition_event_created_in_chrome.html]
[test_contenteditable_text_input_handling.html]
[test_dragdrop.html]

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

@ -0,0 +1,57 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1102906
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1102906</title>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript;version=1.8"">
"use strict";
/* Test for Bug 1102906 */
/* The caret should be movable by using keyboard after drag-and-drop. */
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus( () => {
let content = document.getElementById("content");
let drag = document.getElementById("drag")
let selection = window.getSelection();
/* Perform drag-and-drop for an arbitrary content. The caret should be at
the end of the contenteditable. */
selection.selectAllChildren(drag);
synthesizeDrop(drag, content, {}, "copy");
let textContentAfterDrop = content.textContent;
/* Move the caret to the front of the contenteditable by using keyboard. */
for (let i = 0; i < content.textContent.length; ++i) {
sendKey("LEFT");
}
sendChar("!");
is(content.textContent, "!" + textContentAfterDrop,
"The exclamation mark should be inserted at the front.");
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1102906">Mozilla Bug 1102906</a>
<div id="content" contenteditable="true"><span id="drag">Drag</span></div>
</body>
</html>

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

@ -726,7 +726,7 @@ gfxDWriteFontList::GetDefaultFont(const gfxFontStyle *aStyle)
// try Arial first
gfxFontFamily *ff;
if (ff = FindFamily(NS_LITERAL_STRING("Arial"))) {
if ((ff = FindFamily(NS_LITERAL_STRING("Arial")))) {
return ff;
}

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

@ -3372,11 +3372,18 @@ gfxFont::CreateVerticalMetrics()
const float UNINITIALIZED_LEADING = -10000.0f;
metrics->externalLeading = UNINITIALIZED_LEADING;
if (mFUnitsConvFactor == 0.0) {
uint16_t upem = GetFontEntry()->UnitsPerEm();
if (upem != gfxFontEntry::kInvalidUPEM) {
mFUnitsConvFactor = GetAdjustedSize() / upem;
}
}
#define SET_UNSIGNED(field,src) metrics->field = uint16_t(src) * mFUnitsConvFactor
#define SET_SIGNED(field,src) metrics->field = int16_t(src) * mFUnitsConvFactor
gfxFontEntry::AutoTable os2Table(mFontEntry, kOS_2TableTag);
if (os2Table) {
if (os2Table && mFUnitsConvFactor > 0.0) {
const OS2Table *os2 =
reinterpret_cast<const OS2Table*>(hb_blob_get_data(os2Table, &len));
// These fields should always be present in any valid OS/2 table
@ -3397,7 +3404,7 @@ gfxFont::CreateVerticalMetrics()
// and use the line height from its ascent/descent.
if (!metrics->aveCharWidth) {
gfxFontEntry::AutoTable hheaTable(mFontEntry, kHheaTableTag);
if (hheaTable) {
if (hheaTable && mFUnitsConvFactor > 0.0) {
const MetricsHeader* hhea =
reinterpret_cast<const MetricsHeader*>
(hb_blob_get_data(hheaTable, &len));
@ -3413,7 +3420,7 @@ gfxFont::CreateVerticalMetrics()
// Read real vertical metrics if available.
gfxFontEntry::AutoTable vheaTable(mFontEntry, kVheaTableTag);
if (vheaTable) {
if (vheaTable && mFUnitsConvFactor > 0.0) {
const MetricsHeader* vhea =
reinterpret_cast<const MetricsHeader*>
(hb_blob_get_data(vheaTable, &len));

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

@ -199,7 +199,7 @@ class GPUAdapterReporter : public nsIMemoryReporter
IDXGIDevice *DXGIDevice;
bool result = false;
if (D2D10Device = mozilla::gfx::Factory::GetDirect3D10Device()) {
if ((D2D10Device = mozilla::gfx::Factory::GetDirect3D10Device())) {
if (D2D10Device->QueryInterface(__uuidof(IDXGIDevice), (void **)&DXGIDevice) == S_OK) {
result = (DXGIDevice->GetAdapter(DXGIAdapter) == S_OK);
DXGIDevice->Release();
@ -232,7 +232,7 @@ public:
if (!IsWin7OrLater())
return NS_OK;
if (gdi32Handle = LoadLibrary(TEXT("gdi32.dll")))
if ((gdi32Handle = LoadLibrary(TEXT("gdi32.dll"))))
queryD3DKMTStatistics = (PFND3DKMTQS)GetProcAddress(gdi32Handle, "D3DKMTQueryStatistics");
if (queryD3DKMTStatistics && GetDXGIAdapter(&DXGIAdapter)) {
@ -619,12 +619,14 @@ gfxWindowsPlatform::VerifyD2DDevice(bool aAttemptForce)
mozilla::gfx::Factory::SetDirect3D10Device(cairo_d2d_device_get_device(mD2DDevice));
}
#ifdef USE_D2D1_1
ScopedGfxFeatureReporter reporter1_1("D2D1.1");
if (Factory::SupportsD2D1()) {
reporter1_1.SetSuccessful();
}
#endif
#endif
}
gfxPlatformFontList*
@ -1694,7 +1696,7 @@ gfxWindowsPlatform::InitD3D11Devices()
}
HRESULT hr = E_INVALIDARG;
__try {
MOZ_SEH_TRY {
hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
// Use
// D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS
@ -1704,7 +1706,7 @@ gfxWindowsPlatform::InitD3D11Devices()
featureLevels.Elements(), featureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11Device),
nullptr, nullptr);
} __except (EXCEPTION_EXECUTE_HANDLER) {
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
mD3D11Device = nullptr;
return;
}
@ -1719,13 +1721,13 @@ gfxWindowsPlatform::InitD3D11Devices()
#ifdef USE_D2D1_1
if (Factory::SupportsD2D1()) {
hr = E_INVALIDARG;
__try {
MOZ_SEH_TRY {
hr = d3d11CreateDevice(adapter, D3D_DRIVER_TYPE_UNKNOWN, nullptr,
D3D11_CREATE_DEVICE_BGRA_SUPPORT,
featureLevels.Elements(), featureLevels.Length(),
D3D11_SDK_VERSION, byRef(mD3D11ContentDevice),
nullptr, nullptr);
} __except(EXCEPTION_EXECUTE_HANDLER) {
} MOZ_SEH_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
mD3D11Device = nullptr;
return;
}

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

@ -138,7 +138,8 @@ nsPresContext::IsDOMPaintEventPending()
if (mFireAfterPaintEvents) {
return true;
}
if (GetDisplayRootPresContext()->GetRootPresContext()->mRefreshDriver->ViewManagerFlushIsPending()) {
nsRootPresContext* drpc = GetDisplayRootPresContext();
if (drpc && drpc->mRefreshDriver->ViewManagerFlushIsPending()) {
// Since we're promising that there will be a MozAfterPaint event
// fired, we record an empty invalidation in case display list
// invalidation doesn't invalidate anything further.

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

@ -445,16 +445,22 @@ AnimValuesStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
AnimValuesStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[anim values] { ", out);
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("[anim values] { ");
for (uint32_t i = 0, i_end = mPropertyValuePairs.Length(); i < i_end; ++i) {
const PropertyValuePair &pair = mPropertyValuePairs[i];
str.Append(nsCSSProps::GetStringValue(pair.mProperty));
str.AppendLiteral(": ");
nsAutoString value;
StyleAnimationValue::UncomputeValue(pair.mProperty, pair.mValue, value);
fprintf(out, "%s: %s; ", nsCSSProps::GetStringValue(pair.mProperty).get(),
NS_ConvertUTF16toUTF8(value).get());
AppendUTF16toUTF8(value, str);
str.AppendLiteral("; ");
}
fputs("}\n", out);
str.AppendLiteral("}\n");
fprintf_stderr(out, "%s", str.get());
}
#endif

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

@ -1555,22 +1555,26 @@ CSSStyleSheet::List(FILE* out, int32_t aIndent) const
int32_t index;
// Indent
for (index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoCString str;
for (index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
fputs("CSS Style Sheet: ", out);
str.AppendLiteral("CSS Style Sheet: ");
nsAutoCString urlSpec;
nsresult rv = mInner->mSheetURI->GetSpec(urlSpec);
if (NS_SUCCEEDED(rv) && !urlSpec.IsEmpty()) {
fputs(urlSpec.get(), out);
str.Append(urlSpec);
}
if (mMedia) {
fputs(" media: ", out);
str.AppendLiteral(" media: ");
nsAutoString buffer;
mMedia->GetText(buffer);
fputs(NS_ConvertUTF16toUTF8(buffer).get(), out);
AppendUTF16toUTF8(buffer, str);
}
fputs("\n", out);
str.Append('\n');
fprintf_stderr(out, "%s", str.get());
for (const CSSStyleSheet* child = mInner->mFirstChild;
child;
@ -1578,7 +1582,7 @@ CSSStyleSheet::List(FILE* out, int32_t aIndent) const
child->List(out, aIndent + 1);
}
fputs("Rules in source order:\n", out);
fprintf_stderr(out, "%s", "Rules in source order:\n");
ListRules(mInner->mOrderedRules, out, aIndent);
}
#endif

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

@ -1357,13 +1357,17 @@ Declaration::ToString(nsAString& aString) const
void
Declaration::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
fputs("{ ", out);
str.AppendLiteral("{ ");
nsAutoString s;
ToString(s);
fputs(NS_ConvertUTF16toUTF8(s).get(), out);
fputs("}", out);
AppendUTF16toUTF8(s, str);
str.AppendLiteral("}\n");
fprintf_stderr(out, "%s", str.get());
}
#endif

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

@ -978,10 +978,13 @@ ImportantRule::MapRuleInfoInto(nsRuleData* aRuleData)
ImportantRule::List(FILE* out, int32_t aIndent) const
{
// Indent
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
fprintf(out, "! Important declaration=%p\n",
static_cast<void*>(mDeclaration));
str.AppendLiteral("! important rule\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -1471,22 +1474,30 @@ StyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
StyleRule::List(FILE* out, int32_t aIndent) const
{
nsAutoCString str;
// Indent
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
nsAutoString buffer;
if (mSelector)
if (mSelector) {
mSelector->ToString(buffer, GetStyleSheet());
AppendUTF16toUTF8(buffer, str);
str.Append(' ');
}
buffer.Append(' ');
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
if (nullptr != mDeclaration) {
mDeclaration->List(out);
str.AppendLiteral("{ ");
mDeclaration->ToString(buffer);
AppendUTF16toUTF8(buffer, str);
str.Append('}');
}
else {
fputs("{ null declaration }", out);
str.AppendLiteral("{ null declaration }");
}
fputs("\n", out);
str.Append('\n');
fprintf_stderr(out, "%s", str.get());
}
#endif

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

@ -5707,15 +5707,12 @@ CSSParserImpl::ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector,
return eSelectorParsingStatus_Error; // our caller calls SkipUntil(')')
}
// -moz-locale-dir and -moz-dir can only have values of 'ltr' or 'rtl'.
// -moz-locale-dir and -moz-dir take an identifier argument. While
// only 'ltr' and 'rtl' (case-insensitively) will match anything, any
// other identifier is still valid.
if (aType == nsCSSPseudoClasses::ePseudoClass_mozLocaleDir ||
aType == nsCSSPseudoClasses::ePseudoClass_dir) {
nsContentUtils::ASCIIToLower(mToken.mIdent); // case insensitive
if (!mToken.mIdent.EqualsLiteral("ltr") &&
!mToken.mIdent.EqualsLiteral("rtl")) {
REPORT_UNEXPECTED_TOKEN(PEBadDirValue);
return eSelectorParsingStatus_Error; // our caller calls SkipUntil(')')
}
}
// Add the pseudo with the language parameter

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

@ -2142,11 +2142,17 @@ static bool SelectorMatches(Element* aElement,
HasState(NS_DOCUMENT_STATE_RTL_LOCALE);
nsDependentString dirString(pseudoClass->u.mString);
NS_ASSERTION(dirString.EqualsLiteral("ltr") ||
dirString.EqualsLiteral("rtl"),
"invalid value for -moz-locale-dir");
if (dirString.EqualsLiteral("rtl") != docIsRTL) {
if (dirString.EqualsLiteral("rtl")) {
if (!docIsRTL) {
return false;
}
} else if (dirString.EqualsLiteral("ltr")) {
if (docIsRTL) {
return false;
}
} else {
// Selectors specifying other directions never match.
return false;
}
}
@ -2211,22 +2217,25 @@ static bool SelectorMatches(Element* aElement,
}
}
// if we only had to consider HTML, directionality would be exclusively
// LTR or RTL, and this could be just
//
// if (dirString.EqualsLiteral("rtl") !=
// aElement->StyleState().HasState(NS_EVENT_STATE_RTL)
// If we only had to consider HTML, directionality would be
// exclusively LTR or RTL.
//
// However, in markup languages where there is no direction attribute
// we have to consider the possibility that neither -moz-dir(rtl) nor
// -moz-dir(ltr) matches.
EventStates state = aElement->StyleState();
bool elementIsRTL = state.HasState(NS_EVENT_STATE_RTL);
bool elementIsLTR = state.HasState(NS_EVENT_STATE_LTR);
nsDependentString dirString(pseudoClass->u.mString);
if ((dirString.EqualsLiteral("rtl") && !elementIsRTL) ||
(dirString.EqualsLiteral("ltr") && !elementIsLTR)) {
if (dirString.EqualsLiteral("rtl")) {
if (!state.HasState(NS_EVENT_STATE_RTL)) {
return false;
}
} else if (dirString.EqualsLiteral("ltr")) {
if (!state.HasState(NS_EVENT_STATE_LTR)) {
return false;
}
} else {
// Selectors specifying other directions never match.
return false;
}
}

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

@ -239,12 +239,16 @@ IMPL_STYLE_RULE_INHERIT(CharsetRule, Rule)
/* virtual */ void
CharsetRule::List(FILE* out, int32_t aIndent) const
{
nsAutoCString str;
// Indent
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
for (int32_t indent = aIndent; --indent >= 0; ) {
str.AppendLiteral(" ");
}
fputs("@charset \"", out);
fputs(NS_LossyConvertUTF16toASCII(mEncoding).get(), out);
fputs("\"\n", out);
str.AppendLiteral("@charset \"");
AppendUTF16toUTF8(mEncoding, str);
str.AppendLiteral("\"\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -382,17 +386,21 @@ IMPL_STYLE_RULE_INHERIT(ImportRule, Rule)
/* virtual */ void
ImportRule::List(FILE* out, int32_t aIndent) const
{
nsAutoCString str;
// Indent
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
for (int32_t indent = aIndent; --indent >= 0; ) {
str.AppendLiteral(" ");
}
fputs("@import \"", out);
fputs(NS_LossyConvertUTF16toASCII(mURLSpec).get(), out);
fputs("\" ", out);
str.AppendLiteral("@import \"");
AppendUTF16toUTF8(mURLSpec, str);
str.AppendLiteral("\" ");
nsAutoString mediaText;
mMedia->GetText(mediaText);
fputs(NS_LossyConvertUTF16toASCII(mediaText).get(), out);
fputs("\n", out);
AppendUTF16toUTF8(mediaText, str);
str.AppendLiteral("\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -602,14 +610,9 @@ GroupRule::SetStyleSheet(CSSStyleSheet* aSheet)
/* virtual */ void
GroupRule::List(FILE* out, int32_t aIndent) const
{
fputs(" {\n", out);
for (int32_t index = 0, count = mRules.Count(); index < count; ++index) {
mRules.ObjectAt(index)->List(out, aIndent + 1);
}
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
fputs("}\n", out);
}
#endif
@ -809,19 +812,26 @@ MediaRule::SetStyleSheet(CSSStyleSheet* aSheet)
/* virtual */ void
MediaRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString indentStr;
for (int32_t indent = aIndent; --indent >= 0; ) {
indentStr.AppendLiteral(" ");
}
nsAutoString buffer;
fputs("@media ", out);
nsAutoCString str(indentStr);
str.AppendLiteral("@media ");
if (mMedia) {
nsAutoString mediaText;
mMedia->GetText(mediaText);
fputs(NS_LossyConvertUTF16toASCII(mediaText).get(), out);
AppendUTF16toUTF8(mediaText, str);
}
str.AppendLiteral(" {\n");
fprintf_stderr(out, "%s", str.get());
GroupRule::List(out, aIndent);
fprintf_stderr(out, "%s}\n", indentStr.get());
}
#endif
@ -1008,10 +1018,13 @@ NS_INTERFACE_MAP_END_INHERITING(GroupRule)
/* virtual */ void
DocumentRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString indentStr;
for (int32_t indent = aIndent; --indent >= 0; ) {
indentStr.AppendLiteral(" ");
}
nsAutoCString str;
str.AssignLiteral("@-moz-document ");
str.AppendLiteral("@-moz-document ");
for (URL *url = mURLs; url; url = url->next) {
switch (url->func) {
case eURL:
@ -1033,9 +1046,11 @@ DocumentRule::List(FILE* out, int32_t aIndent) const
str.AppendLiteral("\"), ");
}
str.Cut(str.Length() - 2, 1); // remove last ,
fputs(str.get(), out);
fprintf_stderr(out, "%s%s {\n", indentStr.get(), str.get());
GroupRule::List(out, aIndent);
fprintf_stderr(out, "%s}\n", indentStr.get());
}
#endif
@ -1265,21 +1280,25 @@ IMPL_STYLE_RULE_INHERIT(NameSpaceRule, Rule)
/* virtual */ void
NameSpaceRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString str;
for (int32_t indent = aIndent; --indent >= 0; ) {
str.AppendLiteral(" ");
}
nsAutoString buffer;
fputs("@namespace ", out);
str.AppendLiteral("@namespace ");
if (mPrefix) {
mPrefix->ToString(buffer);
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
fputs(" ", out);
AppendUTF16toUTF8(buffer, str);
str.Append(' ');
}
fputs("url(", out);
fputs(NS_LossyConvertUTF16toASCII(mURLSpec).get(), out);
fputs(")\n", out);
str.AppendLiteral("url(\"");
AppendUTF16toUTF8(mURLSpec, str);
str.AppendLiteral("\")\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -1713,7 +1732,7 @@ nsCSSFontFaceRule::List(FILE* out, int32_t aIndent) const
nsString descStr;
fprintf(out, "%s@font-face {\n", baseInd.get());
fprintf_stderr(out, "%s@font-face {\n", baseInd.get());
for (nsCSSFontDesc id = nsCSSFontDesc(eCSSFontDesc_UNKNOWN + 1);
id < eCSSFontDesc_COUNT;
id = nsCSSFontDesc(id + 1))
@ -1722,11 +1741,11 @@ nsCSSFontFaceRule::List(FILE* out, int32_t aIndent) const
descStr.AssignLiteral("#<serialization error>");
else if (descStr.Length() == 0)
descStr.AssignLiteral("#<serialization missing>");
fprintf(out, "%s%s: %s\n",
descInd.get(), nsCSSProps::GetStringValue(id).get(),
NS_ConvertUTF16toUTF8(descStr).get());
fprintf_stderr(out, "%s%s: %s\n",
descInd.get(), nsCSSProps::GetStringValue(id).get(),
NS_ConvertUTF16toUTF8(descStr).get());
}
fprintf(out, "%s}\n", baseInd.get());
fprintf_stderr(out, "%s}\n", baseInd.get());
}
#endif
@ -1919,8 +1938,11 @@ nsCSSFontFeatureValuesRule::List(FILE* out, int32_t aIndent) const
utf8.ReplaceSubstring("\n", indent);
delete [] indent;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
fprintf(out, "%s\n", utf8.get());
nsAutoCString indentStr;
for (i = aIndent; --i >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s%s\n", indentStr.get(), utf8.get());
}
#endif
@ -2195,14 +2217,19 @@ nsCSSKeyframeRule::MapRuleInfoInto(nsRuleData* aRuleData)
void
nsCSSKeyframeRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
nsAutoString tmp;
DoGetKeyText(tmp);
fputs(NS_ConvertUTF16toUTF8(tmp).get(), out);
fputs(" ", out);
mDeclaration->List(out, aIndent);
fputs("\n", out);
AppendUTF16toUTF8(tmp, str);
str.AppendLiteral(" { ");
mDeclaration->ToString(tmp);
AppendUTF16toUTF8(tmp, str);
str.AppendLiteral("}\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -2396,10 +2423,17 @@ NS_INTERFACE_MAP_END_INHERITING(GroupRule)
void
nsCSSKeyframesRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString indentStr;
for (int32_t indent = aIndent; --indent >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s@keyframes %s {\n",
indentStr.get(), NS_ConvertUTF16toUTF8(mName).get());
fprintf(out, "@keyframes %s", NS_ConvertUTF16toUTF8(mName).get());
GroupRule::List(out, aIndent);
fprintf_stderr(out, "%s}\n", indentStr.get());
}
#endif
@ -2729,11 +2763,17 @@ IMPL_STYLE_RULE_INHERIT_GET_DOM_RULE_WEAK(nsCSSPageRule, Rule)
void
nsCSSPageRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString str;
for (int32_t indent = aIndent; --indent >= 0; ) {
str.AppendLiteral(" ");
}
fputs("@page ", out);
mDeclaration->List(out, aIndent);
fputs("\n", out);
str.AppendLiteral("@page { ");
nsAutoString tmp;
mDeclaration->ToString(tmp);
AppendUTF16toUTF8(tmp, str);
str.AppendLiteral("}\n");
fprintf_stderr(out, "%s", str.get());
}
#endif
@ -2862,11 +2902,17 @@ CSSSupportsRule::CSSSupportsRule(const CSSSupportsRule& aCopy)
/* virtual */ void
CSSSupportsRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t indent = aIndent; --indent >= 0; ) fputs(" ", out);
nsAutoCString indentStr;
for (int32_t indent = aIndent; --indent >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s@supports %s {\n",
indentStr.get(), NS_ConvertUTF16toUTF8(mCondition).get());
fputs("@supports ", out);
fputs(NS_ConvertUTF16toUTF8(mCondition).get(), out);
css::GroupRule::List(out, aIndent);
fprintf_stderr(out, "%s}\n", indentStr.get());
}
#endif
@ -3046,10 +3092,11 @@ nsCSSCounterStyleRule::List(FILE* out, int32_t aIndent) const
descInd = baseInd;
descInd.AppendLiteral(" ");
fprintf(out, "%s@counter-style %s (rev.%u) {\n",
baseInd.get(), NS_ConvertUTF16toUTF8(mName).get(), mGeneration);
fprintf_stderr(out, "%s@counter-style %s (rev.%u) {\n",
baseInd.get(), NS_ConvertUTF16toUTF8(mName).get(),
mGeneration);
// TODO
fprintf(out, "%s}\n", baseInd.get());
fprintf_stderr(out, "%s}\n", baseInd.get());
}
#endif

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

@ -55,8 +55,11 @@ nsHTMLStyleSheet::HTMLColorRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsHTMLStyleSheet::HTMLColorRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[html color rule] {}\n", out);
nsAutoCString indentStr;
for (int32_t index = aIndent; --index >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[html color rule] {}\n", indentStr.get());
}
#endif
@ -67,8 +70,11 @@ NS_IMPL_ISUPPORTS(nsHTMLStyleSheet::GenericTableRule, nsIStyleRule)
/* virtual */ void
nsHTMLStyleSheet::GenericTableRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[generic table rule] {}\n", out);
nsAutoCString indentStr;
for (int32_t index = aIndent; --index >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[generic table rule] {}\n", indentStr.get());
}
#endif
@ -115,10 +121,14 @@ nsHTMLStyleSheet::LangRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsHTMLStyleSheet::LangRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[lang rule] { language: \"", out);
fputs(NS_ConvertUTF16toUTF8(mLang).get(), out);
fputs("\" }\n", out);
nsAutoCString str;
for (int32_t index = aIndent; --index >= 0; ) {
str.AppendLiteral(" ");
}
str.AppendLiteral("[lang rule] { language: \"");
AppendUTF16toUTF8(mLang, str);
str.AppendLiteral("\" }\n");
fprintf_stderr(out, "%s", str.get());
}
#endif

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

@ -22,6 +22,7 @@
#include "mozilla/StyleAnimationValue.h"
#include "GeckoProfiler.h"
#include "nsIDocument.h"
#include "nsPrintfCString.h"
#ifdef DEBUG
// #define NOISY_DEBUG
@ -858,22 +859,26 @@ nsStyleContext::Mark()
}
#ifdef DEBUG
void nsStyleContext::List(FILE* out, int32_t aIndent)
void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
{
nsAutoCString str;
// Indent
int32_t ix;
for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fprintf(out, "%p(%d) parent=%p ",
(void*)this, mRefCnt, (void *)mParent);
for (ix = aIndent; --ix >= 0; ) {
str.AppendLiteral(" ");
}
str.Append(nsPrintfCString("%p(%d) parent=%p ",
(void*)this, mRefCnt, (void *)mParent));
if (mPseudoTag) {
nsAutoString buffer;
mPseudoTag->ToString(buffer);
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
fputs(" ", out);
AppendUTF16toUTF8(buffer, str);
str.Append(' ');
}
if (mRuleNode) {
fputs("{\n", out);
fprintf_stderr(out, "%s{\n", str.get());
str.Truncate();
nsRuleNode* ruleNode = mRuleNode;
while (ruleNode) {
nsIStyleRule *styleRule = ruleNode->GetRule();
@ -882,26 +887,30 @@ void nsStyleContext::List(FILE* out, int32_t aIndent)
}
ruleNode = ruleNode->GetParent();
}
for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out);
for (ix = aIndent; --ix >= 0; ) {
str.AppendLiteral(" ");
}
fprintf_stderr(out, "%s}\n", str.get());
}
else {
fputs("{}\n", out);
fprintf_stderr(out, "%s{}\n", str.get());
}
if (nullptr != mChild) {
nsStyleContext* child = mChild;
do {
child->List(out, aIndent + 1);
child = child->mNextSibling;
} while (mChild != child);
}
if (nullptr != mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->List(out, aIndent + 1);
child = child->mNextSibling;
} while (mEmptyChild != child);
if (aListDescendants) {
if (nullptr != mChild) {
nsStyleContext* child = mChild;
do {
child->List(out, aIndent + 1, aListDescendants);
child = child->mNextSibling;
} while (mChild != child);
}
if (nullptr != mEmptyChild) {
nsStyleContext* child = mEmptyChild;
do {
child->List(out, aIndent + 1, aListDescendants);
child = child->mNextSibling;
} while (mEmptyChild != child);
}
}
}
#endif

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

@ -395,7 +395,7 @@ public:
void ClearCachedInheritedStyleDataOnDescendants(uint32_t aStructs);
#ifdef DEBUG
void List(FILE* out, int32_t aIndent);
void List(FILE* out, int32_t aIndent, bool aListDescendants = true);
static void AssertStyleStructMaxDifferenceValid();
static const char* StructName(nsStyleStructID aSID);
static bool LookupStruct(const nsACString& aName, nsStyleStructID& aResult);

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

@ -53,8 +53,11 @@ nsEmptyStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsEmptyStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[empty style rule] {}\n", out);
nsAutoCString indentStr;
for (int32_t index = aIndent; --index >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[empty style rule] {}\n", indentStr.get());
}
#endif
@ -103,8 +106,11 @@ nsInitialStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsInitialStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[initial style rule] {}\n", out);
nsAutoCString indentStr;
for (int32_t index = aIndent; --index >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[initial style rule] {}\n", indentStr.get());
}
#endif
@ -125,8 +131,11 @@ nsDisableTextZoomStyleRule::MapRuleInfoInto(nsRuleData* aRuleData)
/* virtual */ void
nsDisableTextZoomStyleRule::List(FILE* out, int32_t aIndent) const
{
for (int32_t index = aIndent; --index >= 0; ) fputs(" ", out);
fputs("[disable text zoom style rule] {}\n", out);
nsAutoCString indentStr;
for (int32_t index = aIndent; --index >= 0; ) {
indentStr.AppendLiteral(" ");
}
fprintf_stderr(out, "%s[disable text zoom style rule] {}\n", indentStr.get());
}
#endif

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

@ -928,6 +928,7 @@ function run() {
test_parseable(":-moz-locale-dir(rtl)");
test_parseable(":-moz-locale-dir(rTl)");
test_parseable(":-moz-locale-dir(LTR)");
test_parseable(":-moz-locale-dir(other)");
if (document.body.matches(":-moz-locale-dir(ltr)")) {
test_selector_in_html("a:-moz-locale-dir(LTr)", single_a,
set_single, empty_set);
@ -947,14 +948,16 @@ function run() {
test_selector_in_html("a:-moz-locale-dir(LTr)", single_a,
empty_set, set_single);
}
test_selector_in_html("a:-moz-locale-dir(other)", single_a,
empty_set, set_single);
test_balanced_unparseable(":-moz-locale-dir(other)");
test_balanced_unparseable(":-moz-locale-dir()");
test_balanced_unparseable(":-moz-locale-dir(())");
test_balanced_unparseable(":-moz-locale-dir(3())");
test_balanced_unparseable(":-moz-locale-dir(f{})");
test_balanced_unparseable(":-moz-locale-dir('ltr')");
test_balanced_unparseable(":-moz-locale-dir(ltr, other)");
test_balanced_unparseable(":-moz-locale-dir(ltr other)");
test_balanced_unparseable(":-moz-locale-dir");
// Test :-moz-dir()
@ -962,6 +965,7 @@ function run() {
test_parseable(":-moz-dir(rtl)");
test_parseable(":-moz-dir(rTl)");
test_parseable(":-moz-dir(LTR)");
test_parseable(":-moz-dir(other)");
if (document.body.matches(":-moz-dir(ltr)")) {
test_selector_in_html("a:-moz-dir(LTr)", single_a,
set_single, empty_set);
@ -981,14 +985,16 @@ function run() {
test_selector_in_html("a:-moz-dir(LTr)", single_a,
empty_set, set_single);
}
test_selector_in_html("a:-moz-dir(other)", single_a,
empty_set, set_single);
test_balanced_unparseable(":-moz-dir(other)");
test_balanced_unparseable(":-moz-dir()");
test_balanced_unparseable(":-moz-dir(())");
test_balanced_unparseable(":-moz-dir(3())");
test_balanced_unparseable(":-moz-dir(f{})");
test_balanced_unparseable(":-moz-dir('ltr')");
test_balanced_unparseable(":-moz-dir(ltr, other)");
test_balanced_unparseable(":-moz-dir(ltr other)");
test_balanced_unparseable(":-moz-dir");
// Test -moz-lwtheme and -moz-lwtheme-[darktext|brighttext]

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

@ -5033,6 +5033,71 @@ Version 1.6.14rc02 [October 17, 2014]
Version 1.6.14 [October 23, 2014]
No changes.
Version 1.6.15beta01 [October 29, 2014]
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
Simplified png_free_data().
Added missing "ptr = NULL" after some instances of png_free().
Version 1.6.15beta02 [November 1, 2014]
Changed remaining "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
Version 1.6.15beta03 [November 3, 2014]
Added PNG_USE_ARM_NEON configuration flag (Marcin Juszkiewicz).
Version 1.6.15beta04 [November 4, 2014]
Removed new PNG_USE_ARM_NEON configuration flag and made a one-line
revision to configure.ac to support ARM on aarch64 instead (John Bowler).
Version 1.6.15beta05 [November 5, 2014]
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
example.c, pngtest.c, and applications in the contrib directory.
Avoid out-of-bounds memory access in png_user_version_check().
Simplified and future-proofed png_user_version_check().
Fixed GCC unsigned int->float warnings. Various versions of GCC
seem to generate warnings when an unsigned value is implicitly
converted to double. This is probably a GCC bug but this change
avoids the issue by explicitly converting to (int) where safe.
Free all allocated memory in pngimage. The file buffer cache was left
allocated at the end of the program, harmless but it causes memory
leak reports from clang.
Fixed array size calculations to avoid warnings. At various points
in the code the number of elements in an array is calculated using
sizeof. This generates a compile time constant of type (size_t) which
is then typically assigned to an (unsigned int) or (int). Some versions
of GCC on 64-bit systems warn about the apparent narrowing, even though
the same compiler does apparently generate the correct, in-range,
numeric constant. This adds appropriate, safe, casts to make the
warnings go away.
Version 1.6.15beta06 [November 6, 2014]
Reverted use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING
in the manual, example.c, pngtest.c, and applications in the contrib
directory. It was incorrect advice.
Version 1.6.15beta07 [November 7, 2014]
Removed #ifdef PNG_16BIT_SUPPORTED/#endif around png_product2(); it is
needed by png_reciprocal2().
Added #ifdef PNG_16BIT_SUPPORTED/#endif around png_log16bit() and
png_do_swap().
Changed all "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */"
Version 1.6.15beta08 [November 8, 2014]
More housecleaning in *.h
Version 1.6.15rc01 [November 13, 2014]
Version 1.6.15rc02 [November 14, 2014]
The macros passed in the command line to Borland make were ignored if
similarly-named macros were already defined in makefiles. This behavior
is different from POSIX make and other make programs. Surround the
macro definitions with ifndef guards (Cosmin).
Version 1.6.15rc03 [November 16, 2014]
Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in scripts/makefile.vcwin32.
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
Version 1.6.15 [November 20, 2014]
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

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

@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.14, October 23, 2014, are
libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
October 23, 2014
November 20, 2014

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

@ -1,7 +1,9 @@
Changes made to pristine libpng source by mozilla.org developers.
2014/10/23 -- Synced with libpng-1.6.14 (bug #10xxxxx).
2014/11/20 -- Synced with libpng-1.6.15 (bug #1102523).
2014/10/23 -- Synced with libpng-1.6.14 (bug #1087841).
2014/08/21 -- Synced with libpng-1.6.13 (bug #1021713).
Renamed mozpngconf.h to pnglibconf.h.

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

@ -1,4 +1,4 @@
README for libpng version 1.6.14 - October 23, 2014 (shared library 16.0)
README for libpng version 1.6.15 - November 20, 2014 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.

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

@ -32,7 +32,7 @@ Index: pngread.c
PNG_HANDLE_CHUNK_AS_DEFAULT);
@@ -254,6 +268,72 @@
}
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#endif /* SEQUENTIAL_READ */
+#ifdef PNG_READ_APNG_SUPPORTED
+void PNGAPI
@ -42,7 +42,7 @@ Index: pngread.c
+
+ png_debug(0, "Reading frame head");
+
+ if (!(png_ptr->mode & PNG_HAVE_acTL))
+ if ((png_ptr->mode & PNG_HAVE_acTL) == 0)
+ png_error(png_ptr, "attempt to png_read_frame_head() but "
+ "no acTL present");
+
@ -62,7 +62,7 @@ Index: pngread.c
+ if (png_ptr->chunk_name == png_IDAT)
+ {
+ /* discard trailing IDATs for the first frame */
+ if (have_chunk_after_DAT || png_ptr->num_frames_read > 1)
+ if (have_chunk_after_DAT != 0 || png_ptr->num_frames_read > 1)
+ png_error(png_ptr, "png_read_frame_head(): out of place IDAT");
+ png_crc_finish(png_ptr, length);
+ }
@ -78,7 +78,7 @@ Index: pngread.c
+ png_ensure_sequence_number(png_ptr, length);
+
+ /* discard trailing fdATs for frames other than the first */
+ if (!have_chunk_after_DAT && png_ptr->num_frames_read > 1)
+ if (have_chunk_after_DAT == 0 && png_ptr->num_frames_read > 1)
+ png_crc_finish(png_ptr, length - 4);
+ else if(png_ptr->mode & PNG_HAVE_fcTL)
+ {
@ -98,7 +98,7 @@ Index: pngread.c
+ }
+ }
+}
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* READ_APNG */
+
/* Optional call to update the users info_ptr structure */
void PNGAPI
@ -107,7 +107,7 @@ Index: pngget.c
===================================================================
--- pngget.c
+++ pngget.c
@@ -1195,4 +1195,166 @@
@@ -1210,4 +1210,166 @@
# endif
#endif
@ -119,7 +119,7 @@ Index: pngget.c
+ png_debug1(1, "in %s retrieval function", "acTL");
+
+ if (png_ptr != NULL && info_ptr != NULL &&
+ (info_ptr->valid & PNG_INFO_acTL) &&
+ (info_ptr->valid & PNG_INFO_acTL) != 0 &&
+ num_frames != NULL && num_plays != NULL)
+ {
+ *num_frames = info_ptr->num_frames;
@ -160,7 +160,7 @@ Index: pngget.c
+ png_debug1(1, "in %s retrieval function", "fcTL");
+
+ if (png_ptr != NULL && info_ptr != NULL &&
+ (info_ptr->valid & PNG_INFO_fcTL) &&
+ (info_ptr->valid & PNG_INFO_fcTL) != 0 &&
+ width != NULL && height != NULL &&
+ x_offset != NULL && y_offset != NULL &&
+ delay_num != NULL && delay_den != NULL &&
@ -272,13 +272,13 @@ Index: pngget.c
+
+ return 0;
+}
+#endif /* PNG_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
+#endif /* APNG */
#endif /* READ || WRITE */
Index: png.h
===================================================================
--- png.h
+++ png.h
@@ -470,6 +470,10 @@
@@ -473,6 +473,10 @@
# include "pnglibconf.h"
#endif
@ -289,7 +289,7 @@ Index: png.h
#ifndef PNG_VERSION_INFO_ONLY
/* Machine specific configuration. */
# include "pngconf.h"
@@ -560,6 +564,17 @@
@@ -563,6 +567,17 @@
* See pngconf.h for base types that vary by machine/system
*/
@ -302,12 +302,12 @@ Index: png.h
+/* blend_op flags from inside fcTL */
+#define PNG_BLEND_OP_SOURCE 0x00
+#define PNG_BLEND_OP_OVER 0x01
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* APNG */
+
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
@@ -880,6 +895,10 @@
@@ -883,6 +898,10 @@
#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
@ -318,7 +318,7 @@ Index: png.h
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -917,6 +936,10 @@
@@ -920,6 +939,10 @@
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop));
typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop));
@ -329,7 +329,7 @@ Index: png.h
/* The following callback receives png_uint_32 row_number, int pass for the
* png_bytep data of the row. When transforming an interlaced image the
@@ -3256,6 +3279,75 @@
@@ -3259,6 +3282,75 @@
* END OF HARDWARE AND SOFTWARE OPTIONS
******************************************************************************/
@ -386,8 +386,8 @@ Index: png.h
+PNG_EXPORT(262, void, png_set_progressive_frame_fn, (png_structp png_ptr,
+ png_progressive_frame_ptr frame_info_fn,
+ png_progressive_frame_ptr frame_end_fn));
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* PROGRESSIVE_READ */
+#endif /* READ_APNG */
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
+PNG_EXPORT(263, void, png_write_frame_head, (png_structp png_ptr,
@ -399,13 +399,13 @@ Index: png.h
+
+PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr,
+ png_infop info_ptr));
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* WRITE_APNG */
+#endif /* APNG */
+
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
* defs, and in scripts/symbols.def.
*/
@@ -3264,7 +3356,11 @@
@@ -3267,7 +3359,11 @@
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
@ -413,7 +413,7 @@ Index: png.h
+ PNG_EXPORT_LAST_ORDINAL(264);
+#else
PNG_EXPORT_LAST_ORDINAL(244);
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* APNG */
#endif
#ifdef __cplusplus
@ -451,7 +451,7 @@ Index: pngpriv.h
*/
@@ -1456,6 +1470,49 @@
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PROGRESSIVE_READ */
+#ifdef PNG_APNG_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
@ -477,8 +477,8 @@ Index: pngpriv.h
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),
+ PNG_EMPTY);
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* PROGRESSIVE_READ */
+#endif /* READ_APNG */
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
@ -493,8 +493,8 @@ Index: pngpriv.h
+PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
+ png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* WRITE_APNG */
+#endif /* APNG */
+
/* Added at libpng version 1.6.0 */
#ifdef PNG_GAMMA_SUPPORTED
@ -549,7 +549,7 @@ Index: pngstruct.h
+ png_uint_32 num_frames_to_write;
+ png_uint_32 num_frames_written;
+#endif
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* APNG */
+
/* New members added in libpng-1.2.0 */
@ -563,14 +563,14 @@ Index: pngwrite.c
* too.
*/
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ if (info_ptr->valid & PNG_INFO_acTL)
+ if ((info_ptr->valid & PNG_INFO_acTL) != 0)
+ png_write_acTL(png_ptr, info_ptr->num_frames, info_ptr->num_plays);
+#endif
#ifdef PNG_GAMMA_SUPPORTED
# ifdef PNG_WRITE_gAMA_SUPPORTED
if (!(info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) &&
if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) == 0 &&
@@ -354,6 +358,11 @@
if (!(png_ptr->mode & PNG_HAVE_IDAT))
if ((png_ptr->mode & PNG_HAVE_IDAT) == 0)
png_error(png_ptr, "No IDATs written into file");
+#ifdef PNG_WRITE_APNG_SUPPORTED
@ -581,9 +581,9 @@ Index: pngwrite.c
#ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
if (png_ptr->num_palette_max > png_ptr->num_palette)
png_benign_error(png_ptr, "Wrote palette index exceeding num_palette");
@@ -2437,4 +2446,42 @@
@@ -2452,4 +2461,42 @@
}
#endif /* PNG_STDIO_SUPPORTED */
#endif /* STDIO */
#endif /* SIMPLIFIED_WRITE */
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
@ -598,15 +598,15 @@ Index: pngwrite.c
+
+ /* there is a chance this has been set after png_write_info was called,
+ * so it would be set but not written. is there a way to be sure? */
+ if (!(info_ptr->valid & PNG_INFO_acTL))
+ if ((info_ptr->valid & PNG_INFO_acTL) == 0)
+ png_error(png_ptr, "png_write_frame_head(): acTL not set");
+
+ png_write_reset(png_ptr);
+
+ png_write_reinit(png_ptr, info_ptr, width, height);
+
+ if ( !(png_ptr->num_frames_written == 0 &&
+ (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) ) )
+ if ((png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) == 0 ||
+ png_ptr->num_frames_written != 0)
+ png_write_fcTL(png_ptr, width, height, x_offset, y_offset,
+ delay_num, delay_den, dispose_op, blend_op);
+
@ -622,13 +622,13 @@ Index: pngwrite.c
+
+ PNG_UNUSED(info_ptr)
+}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
+#endif /* WRITE_APNG */
#endif /* WRITE */
Index: pngpread.c
===================================================================
--- pngpread.c
+++ pngpread.c
@@ -219,6 +219,85 @@
@@ -219,6 +219,86 @@
chunk_name = png_ptr->chunk_name;
@ -639,7 +639,8 @@ Index: pngpread.c
+ if (chunk_name == png_IDAT)
+ {
+ /* Discard trailing IDATs for the first frame */
+ if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
+ if ((png_ptr->mode & PNG_HAVE_fcTL) != 0 ||
+ png_ptr->num_frames_read > 1)
+ png_error(png_ptr, "out of place IDAT");
+
+ PNG_PUSH_SAVE_BUFFER_IF_FULL
@ -652,7 +653,7 @@ Index: pngpread.c
+ PNG_PUSH_SAVE_BUFFER_IF_LT(4)
+ png_ensure_sequence_number(png_ptr, 4);
+
+ if (!(png_ptr->mode & PNG_HAVE_fcTL))
+ if ((png_ptr->mode & PNG_HAVE_fcTL) == 0)
+ {
+ /* Discard trailing fdATs for frames other than the first */
+ if (png_ptr->num_frames_read < 2)
@ -683,7 +684,7 @@ Index: pngpread.c
+
+ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
+
+ if (!(png_ptr->mode & PNG_HAVE_fcTL))
+ if ((png_ptr->mode & PNG_HAVE_fcTL) == 0)
+ png_error(png_ptr, "missing required fcTL chunk");
+
+ png_read_reinit(png_ptr, info_ptr);
@ -709,12 +710,12 @@ Index: pngpread.c
+
+ return;
+ }
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* READ_APNG */
+
if (chunk_name == png_IDAT)
{
if (png_ptr->mode & PNG_AFTER_IDAT)
@@ -283,6 +362,9 @@
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
@@ -283,6 +363,9 @@
else if (chunk_name == png_IDAT)
{
@ -724,7 +725,7 @@ Index: pngpread.c
png_ptr->idat_size = png_ptr->push_length;
png_ptr->process_mode = PNG_READ_IDAT_MODE;
png_push_have_info(png_ptr, info_ptr);
@@ -429,6 +511,20 @@
@@ -429,6 +512,20 @@
}
#endif
@ -741,11 +742,11 @@ Index: pngpread.c
+ png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
+ }
+
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* READ_APNG */
else
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
@@ -621,7 +717,11 @@
@@ -623,7 +720,11 @@
png_byte chunk_tag[4];
/* TODO: this code can be commoned up with the same code in push_read */
@ -757,14 +758,14 @@ Index: pngpread.c
png_push_fill_buffer(png_ptr, chunk_length, 4);
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
png_reset_crc(png_ptr);
@@ -629,17 +729,60 @@
@@ -631,17 +732,60 @@
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
+#ifdef PNG_READ_APNG_SUPPORTED
+ if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
+ {
+ if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
+ if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) != 0)
+ {
+ png_ptr->process_mode = PNG_READ_CHUNK_MODE;
+ if (png_ptr->frame_end_fn != NULL)
@ -794,7 +795,7 @@ Index: pngpread.c
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
png_error(png_ptr, "Not enough compressed data");
+#ifdef PNG_READ_APNG_SUPPORTED
@ -817,24 +818,25 @@ Index: pngpread.c
+#endif
}
if (png_ptr->idat_size && png_ptr->save_buffer_size)
@@ -712,6 +855,15 @@
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
@@ -714,6 +858,16 @@
if (!(buffer_length > 0) || buffer == NULL)
png_error(png_ptr, "No IDAT data (internal error)");
+#ifdef PNG_READ_APNG_SUPPORTED
+ /* If the app is not APNG-aware, decode only the first frame */
+ if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
+ if ((png_ptr->apng_flags & PNG_APNG_APP) == 0 &&
+ png_ptr->num_frames_read > 0)
+ {
+ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
+ return;
+ png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
+ return;
+ }
+#endif
+
/* This routine must process all the data it has been given
* before returning, calling the row callback as required to
* handle the uncompressed results.
@@ -1154,6 +1306,18 @@
@@ -1157,6 +1311,18 @@
png_set_read_fn(png_ptr, progressive_ptr, png_push_fill_buffer);
}
@ -857,7 +859,7 @@ Index: pngset.c
===================================================================
--- pngset.c
+++ pngset.c
@@ -239,6 +239,11 @@
@@ -240,6 +240,11 @@
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
@ -869,9 +871,9 @@ Index: pngset.c
}
#ifdef PNG_oFFs_SUPPORTED
@@ -1065,6 +1070,147 @@
@@ -1071,6 +1076,147 @@
}
#endif /* PNG_sPLT_SUPPORTED */
#endif /* sPLT */
+#ifdef PNG_APNG_SUPPORTED
+png_uint_32 PNGAPI
@ -938,8 +940,8 @@ Index: pngset.c
+
+ if (blend_op == PNG_BLEND_OP_OVER)
+ {
+ if (!(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) &&
+ !(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
+ if ((png_ptr->color_type & PNG_COLOR_MASK_ALPHA) == 0 &&
+ png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) == 0)
+ {
+ png_warning(png_ptr, "PNG_BLEND_OP_OVER is meaningless "
+ "and wasteful for opaque images, ignored");
@ -1003,7 +1005,7 @@ Index: pngset.c
+ if (png_ptr == NULL)
+ return 0;
+
+ if (is_hidden)
+ if (is_hidden != 0)
+ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
+ else
+ png_ptr->apng_flags &= ~PNG_FIRST_FRAME_HIDDEN;
@ -1012,7 +1014,7 @@ Index: pngset.c
+
+ return 1;
+}
+#endif /* PNG_APNG_SUPPORTED */
+#endif /* APNG */
+
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
static png_byte
@ -1021,7 +1023,7 @@ Index: pngrutil.c
===================================================================
--- pngrutil.c
+++ pngrutil.c
@@ -817,6 +817,11 @@
@@ -818,6 +818,11 @@
filter_type = buf[11];
interlace_type = buf[12];
@ -1033,7 +1035,7 @@ Index: pngrutil.c
/* Set internal variables */
png_ptr->width = width;
png_ptr->height = height;
@@ -2697,6 +2702,179 @@
@@ -2700,6 +2705,180 @@
}
#endif
@ -1048,17 +1050,17 @@ Index: pngrutil.c
+
+ png_debug(1, "in png_handle_acTL");
+
+ if (!(png_ptr->mode & PNG_HAVE_IHDR))
+ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
+ {
+ png_error(png_ptr, "Missing IHDR before acTL");
+ }
+ else if (png_ptr->mode & PNG_HAVE_IDAT)
+ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+ png_warning(png_ptr, "Invalid acTL after IDAT skipped");
+ png_crc_finish(png_ptr, length);
+ return;
+ }
+ else if (png_ptr->mode & PNG_HAVE_acTL)
+ else if ((png_ptr->mode & PNG_HAVE_acTL) != 0)
+ {
+ png_warning(png_ptr, "Duplicate acTL skipped");
+ png_crc_finish(png_ptr, length);
@ -1079,7 +1081,7 @@ Index: pngrutil.c
+
+ /* the set function will do error checking on num_frames */
+ didSet = png_set_acTL(png_ptr, info_ptr, num_frames, num_plays);
+ if(didSet)
+ if (didSet != 0)
+ png_ptr->mode |= PNG_HAVE_acTL;
+}
+
@ -1100,11 +1102,11 @@ Index: pngrutil.c
+
+ png_ensure_sequence_number(png_ptr, length);
+
+ if (!(png_ptr->mode & PNG_HAVE_IHDR))
+ if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
+ {
+ png_error(png_ptr, "Missing IHDR before fcTL");
+ }
+ else if (png_ptr->mode & PNG_HAVE_IDAT)
+ else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
+ {
+ /* for any frames other then the first this message may be misleading,
+ * but correct. PNG_HAVE_IDAT is unset before the frame head is read
@ -1113,7 +1115,7 @@ Index: pngrutil.c
+ png_crc_finish(png_ptr, length-4);
+ return;
+ }
+ else if (png_ptr->mode & PNG_HAVE_fcTL)
+ else if ((png_ptr->mode & PNG_HAVE_fcTL) != 0)
+ {
+ png_warning(png_ptr, "Duplicate fcTL within one frame skipped");
+ png_crc_finish(png_ptr, length-4);
@ -1168,7 +1170,8 @@ Index: pngrutil.c
+void /* PRIVATE */
+png_have_info(png_structp png_ptr, png_infop info_ptr)
+{
+ if((info_ptr->valid & PNG_INFO_acTL) && !(info_ptr->valid & PNG_INFO_fcTL))
+ if ((info_ptr->valid & PNG_INFO_acTL) != 0 &&
+ (info_ptr->valid & PNG_INFO_fcTL) == 0)
+ {
+ png_ptr->apng_flags |= PNG_FIRST_FRAME_HIDDEN;
+ info_ptr->num_frames++;
@ -1208,12 +1211,12 @@ Index: pngrutil.c
+
+ png_ptr->next_seq_num++;
+}
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* READ_APNG */
+
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
/* Utility function for png_handle_unknown; set up png_ptr::unknown_chunk */
static int
@@ -3954,6 +4132,38 @@
@@ -3959,6 +4138,38 @@
uInt avail_in;
png_bytep buffer;
@ -1252,15 +1255,15 @@ Index: pngrutil.c
while (png_ptr->idat_size == 0)
{
png_crc_finish(png_ptr, 0);
@@ -3965,6 +4175,7 @@
@@ -3970,6 +4181,7 @@
if (png_ptr->chunk_name != png_IDAT)
png_error(png_ptr, "Not enough image data");
}
+#endif /* PNG_READ_APNG_SUPPORTED */
+#endif /* READ_APNG */
avail_in = png_ptr->IDAT_read_size;
@@ -4028,6 +4239,9 @@
@@ -4033,6 +4245,9 @@
png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
@ -1270,7 +1273,7 @@ Index: pngrutil.c
if (png_ptr->zstream.avail_in > 0 || png_ptr->idat_size > 0)
png_chunk_benign_error(png_ptr, "Extra compressed data");
@@ -4465,4 +4679,80 @@
@@ -4471,4 +4686,80 @@
png_ptr->flags |= PNG_FLAG_ROW_INIT;
}
@ -1296,7 +1299,7 @@ Index: pngrutil.c
+ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,png_ptr->width);
+ png_ptr->info_rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,
+ png_ptr->width);
+ if (png_ptr->prev_row)
+ if (png_ptr->prev_row != NULL)
+ memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
+}
+
@ -1320,9 +1323,9 @@ Index: pngrutil.c
+ /* Offset to next interlace block in the y direction */
+ static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
+
+ if (png_ptr->interlaced)
+ if (png_ptr->interlaced != 0)
+ {
+ if (!(png_ptr->transformations & PNG_INTERLACE))
+ if ((png_ptr->transformations & PNG_INTERLACE) == 0)
+ png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
+ png_pass_ystart[0]) / png_pass_yinc[0];
+ else
@ -1334,7 +1337,7 @@ Index: pngrutil.c
+ png_pass_inc[png_ptr->pass];
+ }
+ else
+#endif /* PNG_READ_INTERLACING_SUPPORTED */
+#endif /* READ_INTERLACING */
+ {
+ png_ptr->num_rows = png_ptr->height;
+ png_ptr->iwidth = png_ptr->width;
@ -1348,14 +1351,14 @@ Index: pngrutil.c
+ png_ptr->zstream.avail_out = (uInt)PNG_ROWBYTES(png_ptr->pixel_depth,
+ png_ptr->iwidth) + 1;
+}
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */
+#endif /* PROGRESSIVE_READ */
+#endif /* READ_APNG */
#endif /* READ */
Index: pngwutil.c
===================================================================
--- pngwutil.c
+++ pngwutil.c
@@ -902,6 +902,11 @@
@@ -901,6 +901,11 @@
/* Write the chunk */
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
@ -1367,39 +1370,39 @@ Index: pngwutil.c
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
@@ -1080,7 +1085,15 @@
@@ -1079,7 +1084,15 @@
optimize_cmf(data, png_image_size(png_ptr));
# endif
#endif
+# ifdef PNG_WRITE_APNG_SUPPORTED
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ if (png_ptr->num_frames_written == 0)
+# endif
+#endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+# ifdef PNG_WRITE_APNG_SUPPORTED
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ else
+ png_write_fdAT(png_ptr, data, size);
+# endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* WRITE_APNG */
+
png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->zstream.next_out = data;
@@ -1126,7 +1139,15 @@
optimize_cmf(data, png_image_size(png_ptr));
# endif
@@ -1125,7 +1138,15 @@
optimize_cmf(data, png_image_size(png_ptr));
#endif
+# ifdef PNG_WRITE_APNG_SUPPORTED
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ if (png_ptr->num_frames_written == 0)
+# endif
+#endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
+# ifdef PNG_WRITE_APNG_SUPPORTED
+#ifdef PNG_WRITE_APNG_SUPPORTED
+ else
+ png_write_fdAT(png_ptr, data, size);
+# endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* WRITE_APNG */
+
png_ptr->zstream.avail_out = 0;
png_ptr->zstream.next_out = NULL;
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
@@ -1939,6 +1960,82 @@
@@ -1938,6 +1959,82 @@
}
#endif
@ -1414,7 +1417,7 @@ Index: pngwutil.c
+
+ png_ptr->num_frames_to_write = num_frames;
+
+ if (png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN)
+ if ((png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN) != 0)
+ num_frames--;
+
+ png_save_uint_32(buf, num_frames);
@ -1477,14 +1480,14 @@ Index: pngwutil.c
+
+ png_ptr->next_seq_num++;
+}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
+#endif /* WRITE_APNG */
+
/* Initializes the row writing capability of libpng */
void /* PRIVATE */
png_write_start_row(png_structrp png_ptr)
@@ -3026,4 +3123,39 @@
}
#endif
#endif /* WRITE_FLUSH */
}
+
+#ifdef PNG_WRITE_APNG_SUPPORTED
@ -1520,8 +1523,8 @@ Index: pngwutil.c
+ png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, width);
+ png_ptr->usr_width = png_ptr->width;
+}
+#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_WRITE_SUPPORTED */
+#endif /* WRITE_APNG */
#endif /* WRITE */
Index: scripts/symbols.def
===================================================================
--- scripts/symbols.def

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

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.14 - October 23, 2014
libpng version 1.6.15 - November 20, 2014
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.6.14 - October 23, 2014
libpng versions 0.97, January 1998, through 1.6.15 - November 20, 2014
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2014 Glenn Randers-Pehrson
@ -5277,13 +5277,13 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng
October 23, 2014
November 20, 2014
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.14 are Y2K compliant. It is my belief that earlier
upward through 1.6.15 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer

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

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

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.6.14 - October 23, 2014
* libpng version 1.6.15, November 20, 2014
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.14 - October 23, 2014: Glenn
* libpng versions 0.97, January 1998, through 1.6.15, November 20, 2014: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -206,6 +206,9 @@
* 1.6.14beta01-07 16 10614 16.so.16.14[.0]
* 1.6.14rc01-02 16 10614 16.so.16.14[.0]
* 1.6.14 16 10614 16.so.16.14[.0]
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
* 1.6.15 16 10615 16.so.16.15[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -237,7 +240,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.6.14, October 23, 2014, are
* libpng versions 1.2.6, August 15, 2004, through 1.6.15, November 20, 2014, are
* Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -349,13 +352,13 @@
* Y2K compliance in libpng:
* =========================
*
* October 23, 2014
* November 20, 2014
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.6.14 are Y2K compliant. It is my belief that
* upward through 1.6.15 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@ -417,9 +420,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.14"
#define PNG_LIBPNG_VER_STRING "1.6.15"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.14 - October 23, 2014\n"
" libpng version 1.6.15 - November 20, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@ -427,7 +430,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 14
#define PNG_LIBPNG_VER_RELEASE 15
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -458,7 +461,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
#define PNG_LIBPNG_VER 10614 /* 1.6.14 */
#define PNG_LIBPNG_VER 10615 /* 1.6.15 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@ -573,12 +576,12 @@ extern "C" {
/* blend_op flags from inside fcTL */
#define PNG_BLEND_OP_SOURCE 0x00
#define PNG_BLEND_OP_OVER 0x01
#endif /* PNG_APNG_SUPPORTED */
#endif /* APNG */
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_6_14;
typedef char* png_libpng_version_1_6_15;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@ -1199,7 +1202,7 @@ PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
/* Convert from time_t to png_time. Uses gmtime() */
PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
#endif /* PNG_CONVERT_tIME_SUPPORTED */
#endif /* CONVERT_tIME */
#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
@ -1405,7 +1408,7 @@ PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
png_uint_32 filler, int flags));
#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
#endif /* READ_FILLER || WRITE_FILLER */
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swap bytes in 16-bit depth files. */
@ -1669,7 +1672,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
(png_structrp png_ptr, int heuristic_method, int num_weights,
png_const_fixed_point_p filter_weights,
png_const_fixed_point_p filter_costs))
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
#endif /* WRITE_WEIGHTED_FILTER */
/* Heuristic used for row filter selection. These defines should NOT be
* changed.
@ -1725,7 +1728,7 @@ PNG_EXPORT(225, void, png_set_text_compression_window_bits,
PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
int method));
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
/* These next functions are called for input/output, memory, and error
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
@ -1892,7 +1895,7 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
*/
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
png_bytep old_row, png_const_bytep new_row));
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PROGRESSIVE_READ */
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
png_alloc_size_t size), PNG_ALLOCATED);
@ -2093,7 +2096,7 @@ PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
(png_const_structrp png_ptr, png_const_inforp info_ptr));
#endif /* PNG_EASY_ACCESS_SUPPORTED */
#endif /* EASY_ACCESS */
#ifdef PNG_READ_SUPPORTED
/* Returns pointer to signature string read from PNG header */
@ -2345,7 +2348,7 @@ PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
png_inforp info_ptr, int unit,
png_const_charp swidth, png_const_charp sheight));
#endif /* PNG_sCAL_SUPPORTED */
#endif /* sCAL */
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
/* Provide the default handling for all unknown chunks or, optionally, for
@ -2573,8 +2576,8 @@ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
int *unit_type));
# endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
# endif /* pHYs */
#endif /* INCH_CONVERSIONS */
/* Added in libpng-1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED
@ -2597,7 +2600,7 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
#endif /* ?PNG_IO_STATE_SUPPORTED */
#endif /* IO_STATE */
/* Interlace support. The following macros are always defined so that if
* libpng interlace handling is turned off the macros may be used to handle
@ -2701,7 +2704,7 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
(png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
32767) / 65535)
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
#endif /* READ_COMPOSITE_NODIV */
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
@ -3129,7 +3132,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
FILE* file));
/* The PNG header is read from the stdio FILE object. */
#endif /* PNG_STDIO_SUPPORTED */
#endif /* STDIO */
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
png_const_voidp memory, png_size_t size));
@ -3174,7 +3177,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
/* Free any data allocated by libpng in image->opaque, setting the pointer to
* NULL. May be called at any time after the structure is initialized.
*/
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
#endif /* SIMPLIFIED_READ */
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
@ -3220,12 +3223,12 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
*
* Note that the write API does not support interlacing or sub-8-bit pixels.
*/
#endif /* PNG_STDIO_SUPPORTED */
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
#endif /* STDIO */
#endif /* SIMPLIFIED_WRITE */
/*******************************************************************************
* END OF SIMPLIFIED API
******************************************************************************/
#endif /* PNG_SIMPLIFIED_{READ|WRITE}_SUPPORTED */
#endif /* SIMPLIFIED_{READ|WRITE} */
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
@ -3273,7 +3276,7 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
int onoff));
#endif /* PNG_SET_OPTION_SUPPORTED */
#endif /* SET_OPTION */
/*******************************************************************************
* END OF HARDWARE AND SOFTWARE OPTIONS
@ -3332,8 +3335,8 @@ PNG_EXPORT(261, void, png_read_frame_head, (png_structp png_ptr,
PNG_EXPORT(262, void, png_set_progressive_frame_fn, (png_structp png_ptr,
png_progressive_frame_ptr frame_info_fn,
png_progressive_frame_ptr frame_end_fn));
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* PROGRESSIVE_READ */
#endif /* READ_APNG */
#ifdef PNG_WRITE_APNG_SUPPORTED
PNG_EXPORT(263, void, png_write_frame_head, (png_structp png_ptr,
@ -3345,8 +3348,8 @@ PNG_EXPORT(263, void, png_write_frame_head, (png_structp png_ptr,
PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr,
png_infop info_ptr));
#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_APNG_SUPPORTED */
#endif /* WRITE_APNG */
#endif /* APNG */
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
* defs, and in scripts/symbols.def.
@ -3360,7 +3363,7 @@ PNG_EXPORT(264, void, png_write_frame_tail, (png_structp png_ptr,
PNG_EXPORT_LAST_ORDINAL(264);
#else
PNG_EXPORT_LAST_ORDINAL(244);
#endif /* PNG_APNG_SUPPORTED */
#endif /* APNG */
#endif
#ifdef __cplusplus

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

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.6.14 - October 23, 2014
* libpng version 1.6.15,November 20, 2014
*
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

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

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.6.13 [August 21, 2014]
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -27,7 +27,7 @@ static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
static void /* PRIVATE */
png_default_warning PNGARG((png_const_structrp png_ptr,
png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */
#endif /* WARNINGS */
/* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently,
@ -43,8 +43,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
char msg[16];
if (png_ptr != NULL)
{
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
if ((png_ptr->flags &
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
{
if (*error_message == PNG_LITERAL_SHARP)
{
@ -54,7 +54,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
if (error_message[offset] == ' ')
break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
{
int i;
for (i = 0; i < offset - 1; i++)
@ -69,7 +69,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
else
{
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
{
msg[0] = '0';
msg[1] = '\0';
@ -103,7 +103,7 @@ png_err,(png_const_structrp png_ptr),PNG_NORETURN)
use the default handler, which will not return. */
png_default_error(png_ptr, "");
}
#endif /* PNG_ERROR_TEXT_SUPPORTED */
#endif /* ERROR_TEXT */
/* Utility to safely appends strings to a buffer. This never errors out so
* error checking is not required in the caller.
@ -152,7 +152,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_fixed:
/* Needs five digits (the fraction) */
mincount = 5;
if (output || number % 10 != 0)
if (output != 0 || number % 10 != 0)
{
*--end = digits[number % 10];
output = 1;
@ -189,7 +189,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
++count;
/* Float a fixed number here: */
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
{
/* End of the fraction, but maybe nothing was output? In that case
* drop the decimal point. If the number is a true zero handle that
@ -219,8 +219,8 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
if (png_ptr != NULL)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
if ((png_ptr->flags &
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
#endif
{
if (*warning_message == PNG_LITERAL_SHARP)
@ -355,13 +355,13 @@ png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
*/
png_warning(png_ptr, msg);
}
#endif /* PNG_WARNINGS_SUPPORTED */
#endif /* WARNINGS */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
{
# ifdef PNG_READ_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
@ -391,7 +391,7 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN)
if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
@ -404,7 +404,7 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */
png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN)
if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
@ -442,7 +442,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
int c = (int)(chunk_name >> ishift) & 0xff;
ishift -= 8;
if (isnonalpha(c))
if (isnonalpha(c) != 0)
{
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
@ -473,7 +473,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
buffer[iout] = '\0';
}
}
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#endif /* WARNINGS || ERROR_TEXT */
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI
@ -490,7 +490,7 @@ png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
png_error(png_ptr, msg);
}
}
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
#endif /* READ && ERROR_TEXT */
#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI
@ -506,7 +506,7 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
png_warning(png_ptr, msg);
}
}
#endif /* PNG_WARNINGS_SUPPORTED */
#endif /* WARNINGS */
#ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
@ -514,7 +514,7 @@ void PNGAPI
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
png_chunk_warning(png_ptr, error_message);
else
@ -525,7 +525,7 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
# endif
}
#endif
#endif /* PNG_READ_SUPPORTED */
#endif /* READ */
void /* PRIVATE */
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
@ -538,7 +538,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
* unconditionally does the right thing.
*/
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
# endif
# ifdef PNG_READ_SUPPORTED
@ -552,7 +552,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
# endif
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
# endif
# ifdef PNG_WRITE_SUPPORTED
@ -577,11 +577,12 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
memcpy(msg, fixed_message, fixed_message_ln);
iin = 0;
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
{
msg[fixed_message_ln + iin] = name[iin];
++iin;
}
if (name != NULL)
while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
{
msg[fixed_message_ln + iin] = name[iin];
++iin;
}
msg[fixed_message_ln + iin] = 0;
png_error(png_ptr, msg);
}
@ -757,7 +758,8 @@ PNG_FUNCTION(void,PNGAPI
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
{
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
png_ptr->jmp_buf_ptr != NULL)
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
#else
PNG_UNUSED(png_ptr)
@ -822,7 +824,7 @@ png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
#endif
PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */
#endif /* WARNINGS */
/* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT
@ -957,5 +959,5 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
return result;
}
#endif /* SIMPLIFIED READ/WRITE */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
#endif /* READ || WRITE */

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

@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.6.11 [June 5, 2014]
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -116,7 +116,8 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
info_ptr)
{
#ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
png_debug1(1, "in %s retrieval function",
"png_get_x_pixels_per_meter");
@ -137,7 +138,8 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
info_ptr)
{
#ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
png_debug1(1, "in %s retrieval function",
"png_get_y_pixels_per_meter");
@ -157,7 +159,8 @@ png_uint_32 PNGAPI
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
{
#ifdef PNG_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
@ -179,7 +182,8 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
info_ptr)
{
#ifdef PNG_READ_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
@ -202,10 +206,11 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
png_const_inforp info_ptr)
{
#ifdef PNG_READ_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
&& info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0
&& info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX
&& info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
{
png_fixed_point res;
@ -215,7 +220,7 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
* range of 0..2^31-1; otherwise the cast might overflow.
*/
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
(png_int_32)info_ptr->x_pixels_per_unit))
(png_int_32)info_ptr->x_pixels_per_unit) != 0)
return res;
}
#else
@ -231,7 +236,8 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
{
#ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_oFFs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
@ -250,7 +256,8 @@ png_int_32 PNGAPI
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
{
#ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_oFFs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@ -269,7 +276,8 @@ png_int_32 PNGAPI
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
{
#ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_oFFs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
@ -288,7 +296,8 @@ png_int_32 PNGAPI
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
{
#ifdef PNG_oFFs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_oFFs) != 0)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
@ -328,7 +337,7 @@ ppi_from_ppm(png_uint_32 ppm)
*/
png_fixed_point result;
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
5000))
5000) != 0)
return result;
/* Overflow. */
@ -414,7 +423,8 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
{
png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
png_debug1(1, "in %s retrieval function", "pHYs");
@ -445,12 +455,12 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
return (retval);
}
#endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
#endif /* pHYs */
#endif /* INCH_CONVERSIONS */
/* png_get_channels really belongs in here, too, but it's been around longer */
#endif /* PNG_EASY_ACCESS_SUPPORTED */
#endif /* EASY_ACCESS */
png_byte PNGAPI
@ -478,8 +488,9 @@ png_uint_32 PNGAPI
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
png_color_16p *background)
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
&& background != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
background != NULL)
{
png_debug1(1, "in %s retrieval function", "bKGD");
@ -509,7 +520,7 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
* consistent.
*/
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{
png_debug1(1, "in %s retrieval function", "cHRM");
@ -550,7 +561,7 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *blue_Z)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
@ -598,7 +609,7 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_fixed_point *int_blue_Z)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
@ -635,7 +646,7 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "cHRM");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{
if (white_x != NULL)
*white_x = info_ptr->colorspace.end_points_xy.whitex;
@ -670,7 +681,7 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
file_gamma != NULL)
{
*file_gamma = info_ptr->colorspace.gamma;
@ -689,7 +700,7 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "gAMA(float)");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
file_gamma != NULL)
{
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
@ -709,8 +720,8 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "sRGB");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
{
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
return (PNG_INFO_sRGB);
@ -728,9 +739,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && compression_type != NULL && profile != NULL &&
proflen != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_iCCP) != 0 &&
name != NULL && compression_type != NULL && profile != NULL &&
proflen != NULL)
{
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
@ -768,8 +780,8 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "hIST");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
{
*hist = info_ptr->hist;
return (PNG_INFO_hIST);
@ -824,8 +836,9 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_oFFs) != 0 &&
offset_x != NULL && offset_y != NULL && unit_type != NULL)
{
*offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset;
@ -845,8 +858,9 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "pCAL");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pCAL) != 0 &&
purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL)
{
*purpose = info_ptr->pcal_purpose;
@ -872,7 +886,7 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
(info_ptr->valid & PNG_INFO_sCAL) != 0)
{
*unit = info_ptr->scal_unit;
/*TODO: make this work without FP support; the API is currently eliminated
@ -895,7 +909,7 @@ png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, double *width, double *height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
(info_ptr->valid & PNG_INFO_sCAL) != 0)
{
*unit = info_ptr->scal_unit;
*width = atof(info_ptr->scal_s_width);
@ -911,7 +925,7 @@ png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, png_charpp width, png_charpp height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
(info_ptr->valid & PNG_INFO_sCAL) != 0)
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width;
@ -933,7 +947,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "pHYs");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs))
(info_ptr->valid & PNG_INFO_pHYs) != 0)
{
if (res_x != NULL)
{
@ -964,8 +978,8 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "PLTE");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
{
*palette = info_ptr->palette;
*num_palette = info_ptr->num_palette;
@ -983,8 +997,8 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "sBIT");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
{
*sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT);
@ -1027,8 +1041,8 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
{
png_debug1(1, "in %s retrieval function", "tIME");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL)
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
{
*mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME);
@ -1044,7 +1058,8 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
{
png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_tRNS) != 0)
{
png_debug1(1, "in %s retrieval function", "tRNS");
@ -1121,7 +1136,7 @@ png_get_compression_buffer_size(png_const_structrp png_ptr)
return 0;
# ifdef PNG_WRITE_SUPPORTED
if (png_ptr->mode & PNG_IS_READ_STRUCT)
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
# endif
{
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
@ -1165,7 +1180,7 @@ png_get_chunk_malloc_max (png_const_structrp png_ptr)
{
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#endif /* SET_USER_LIMITS */
/* These functions were added to libpng 1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED
@ -1180,7 +1195,7 @@ png_get_io_chunk_type (png_const_structrp png_ptr)
{
return png_ptr->chunk_name;
}
#endif /* ?PNG_IO_STATE_SUPPORTED */
#endif /* IO_STATE */
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
@ -1203,7 +1218,7 @@ png_get_acTL(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "acTL");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_acTL) &&
(info_ptr->valid & PNG_INFO_acTL) != 0 &&
num_frames != NULL && num_plays != NULL)
{
*num_frames = info_ptr->num_frames;
@ -1244,7 +1259,7 @@ png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "fcTL");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_fcTL) &&
(info_ptr->valid & PNG_INFO_fcTL) != 0 &&
width != NULL && height != NULL &&
x_offset != NULL && y_offset != NULL &&
delay_num != NULL && delay_den != NULL &&
@ -1356,5 +1371,5 @@ png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
return 0;
}
#endif /* PNG_APNG_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
#endif /* APNG */
#endif /* READ || WRITE */

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

@ -121,7 +121,7 @@ struct png_info_def
int num_text; /* number of comments read or comments to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read or comments to write */
#endif /* PNG_TEXT_SUPPORTED */
#endif /* TEXT */
#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was

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

@ -1,8 +1,8 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.6.8 [December 19, 2013]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@ -199,7 +199,7 @@ png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
return ret;
}
#endif /* PNG_USER_MEM_SUPPORTED */
#endif /* USER_MEM */
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will issue a png_warning and return NULL instead of issuing a
@ -244,7 +244,7 @@ png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
{
if (png_ptr == NULL || ptr == NULL)
return;
#endif /* PNG_USER_MEM_SUPPORTED */
#endif /* USER_MEM */
free(ptr);
}
@ -277,5 +277,5 @@ png_get_mem_ptr(png_const_structrp png_ptr)
return png_ptr->mem_ptr;
}
#endif /* PNG_USER_MEM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
#endif /* USER_MEM */
#endif /* READ || WRITE */

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

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.6.14 [October 23, 2014]
* Last changed in libpng 1.6.15 [November 20, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -202,7 +202,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
* sure we have enough data in the buffer for the 4-byte CRC at the
* end of every chunk (except IDAT, which is handled separately).
*/
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
{
png_byte chunk_length[4];
png_byte chunk_tag[4];
@ -226,7 +226,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
if (chunk_name == png_IDAT)
{
/* Discard trailing IDATs for the first frame */
if (png_ptr->mode & PNG_HAVE_fcTL || png_ptr->num_frames_read > 1)
if ((png_ptr->mode & PNG_HAVE_fcTL) != 0 ||
png_ptr->num_frames_read > 1)
png_error(png_ptr, "out of place IDAT");
PNG_PUSH_SAVE_BUFFER_IF_FULL
@ -239,7 +240,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
png_ensure_sequence_number(png_ptr, 4);
if (!(png_ptr->mode & PNG_HAVE_fcTL))
if ((png_ptr->mode & PNG_HAVE_fcTL) == 0)
{
/* Discard trailing fdATs for frames other than the first */
if (png_ptr->num_frames_read < 2)
@ -270,7 +271,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
if (!(png_ptr->mode & PNG_HAVE_fcTL))
if ((png_ptr->mode & PNG_HAVE_fcTL) == 0)
png_error(png_ptr, "missing required fcTL chunk");
png_read_reinit(png_ptr, info_ptr);
@ -296,32 +297,32 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
return;
}
#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* READ_APNG */
if (chunk_name == png_IDAT)
{
if (png_ptr->mode & PNG_AFTER_IDAT)
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
/* If we reach an IDAT chunk, this means we have read all of the
* header chunks, and we can start reading the image (or if this
* is called after the image has been read - we have an error).
*/
if (!(png_ptr->mode & PNG_HAVE_IHDR))
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE))
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
png_error(png_ptr, "Missing PLTE before IDAT");
png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE;
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
if (png_ptr->push_length == 0)
return;
if (png_ptr->mode & PNG_AFTER_IDAT)
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
png_benign_error(png_ptr, "Too many IDATs found");
}
@ -524,7 +525,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_handle_fcTL(png_ptr, info_ptr, png_ptr->push_length);
}
#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* READ_APNG */
else
{
PNG_PUSH_SAVE_BUFFER_IF_FULL
@ -545,7 +546,7 @@ png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
void /* PRIVATE */
png_push_crc_finish(png_structrp png_ptr)
{
if (png_ptr->skip_length && png_ptr->save_buffer_size)
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
{
png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
@ -569,7 +570,7 @@ png_push_crc_finish(png_structrp png_ptr)
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->skip_length && png_ptr->current_buffer_size)
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
{
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
@ -590,7 +591,7 @@ png_push_crc_finish(png_structrp png_ptr)
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
}
if (!png_ptr->skip_length)
if (png_ptr->skip_length == 0)
{
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
png_crc_finish(png_ptr, 0);
@ -607,7 +608,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
return;
ptr = buffer;
if (png_ptr->save_buffer_size)
if (png_ptr->save_buffer_size != 0)
{
png_size_t save_size;
@ -624,7 +625,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (length && png_ptr->current_buffer_size)
if (length != 0 && png_ptr->current_buffer_size != 0)
{
png_size_t save_size;
@ -644,7 +645,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
void /* PRIVATE */
png_push_save_buffer(png_structrp png_ptr)
{
if (png_ptr->save_buffer_size)
if (png_ptr->save_buffer_size != 0)
{
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
{
@ -680,11 +681,13 @@ png_push_save_buffer(png_structrp png_ptr)
if (png_ptr->save_buffer == NULL)
{
png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_error(png_ptr, "Insufficient memory for save_buffer");
}
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_ptr->save_buffer_max = new_max;
}
if (png_ptr->current_buffer_size)
@ -711,7 +714,7 @@ png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
void /* PRIVATE */
png_push_read_IDAT(png_structrp png_ptr)
{
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
{
png_byte chunk_length[4];
png_byte chunk_tag[4];
@ -732,7 +735,7 @@ png_push_read_IDAT(png_structrp png_ptr)
#ifdef PNG_READ_APNG_SUPPORTED
if (png_ptr->chunk_name != png_fdAT && png_ptr->num_frames_read > 0)
{
if (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) != 0)
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (png_ptr->frame_end_fn != NULL)
@ -762,7 +765,7 @@ png_push_read_IDAT(png_structrp png_ptr)
{
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
png_error(png_ptr, "Not enough compressed data");
#ifdef PNG_READ_APNG_SUPPORTED
@ -785,7 +788,7 @@ png_push_read_IDAT(png_structrp png_ptr)
#endif
}
if (png_ptr->idat_size && png_ptr->save_buffer_size)
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
{
png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
@ -812,7 +815,7 @@ png_push_read_IDAT(png_structrp png_ptr)
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->idat_size && png_ptr->current_buffer_size)
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
{
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
@ -837,7 +840,7 @@ png_push_read_IDAT(png_structrp png_ptr)
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
}
if (!png_ptr->idat_size)
if (png_ptr->idat_size == 0)
{
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
png_crc_finish(png_ptr, 0);
@ -857,10 +860,11 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
#ifdef PNG_READ_APNG_SUPPORTED
/* If the app is not APNG-aware, decode only the first frame */
if (!(png_ptr->apng_flags & PNG_APNG_APP) && png_ptr->num_frames_read > 0)
if ((png_ptr->apng_flags & PNG_APNG_APP) == 0 &&
png_ptr->num_frames_read > 0)
{
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
return;
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
return;
}
#endif
@ -993,7 +997,7 @@ png_push_process_row(png_structrp png_ptr)
memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
if (png_ptr->transformations)
if (png_ptr->transformations != 0)
png_do_read_transformations(png_ptr, &row_info);
#endif
@ -1011,7 +1015,8 @@ png_push_process_row(png_structrp png_ptr)
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Expand interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
if (png_ptr->interlaced != 0 &&
(png_ptr->transformations & PNG_INTERLACE) != 0)
{
if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
@ -1218,7 +1223,7 @@ png_read_push_finish_row(png_structrp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
if (png_ptr->interlaced)
if (png_ptr->interlaced != 0)
{
png_ptr->row_number = 0;
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
@ -1242,7 +1247,7 @@ png_read_push_finish_row(png_structrp png_ptr)
png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass];
if (png_ptr->transformations & PNG_INTERLACE)
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
break;
png_ptr->num_rows = (png_ptr->height +
@ -1326,4 +1331,4 @@ png_get_progressive_ptr(png_const_structrp png_ptr)
return png_ptr->io_ptr;
}
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PROGRESSIVE_READ */

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

@ -172,7 +172,7 @@
*/
# define PNG_ARM_NEON_IMPLEMENTATION 2
# endif /* __ARM_NEON__ */
# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
# ifndef PNG_ARM_NEON_IMPLEMENTATION
/* Use the intrinsics code by default. */
@ -869,7 +869,7 @@ PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
* encoded value with maximum error 0.646365. Note that the input is not a
* 16-bit value; it has been multiplied by 255! */
#endif /* PNG_SIMPLIFIED_READ/WRITE */
#endif /* SIMPLIFIED_READ/WRITE */
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
@ -1243,7 +1243,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
PNG_EMPTY);
/* Finish a row while reading, dealing with interlacing passes, etc. */
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#endif /* SEQUENTIAL_READ */
/* Initialize the row buffers, etc. */
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
@ -1319,7 +1319,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
#ifdef PNG_READ_iCCP_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif /* PNG_READ_iCCP_SUPPORTED */
#endif /* READ_iCCP */
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
@ -1354,7 +1354,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
#ifdef PNG_READ_sPLT_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif /* PNG_READ_sPLT_SUPPORTED */
#endif /* READ_sPLT */
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
@ -1468,7 +1468,7 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
png_inforp info_ptr),PNG_EMPTY);
# endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PROGRESSIVE_READ */
#ifdef PNG_APNG_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_ensure_fcTL_is_valid,(png_structp png_ptr,
@ -1494,8 +1494,8 @@ PNG_INTERNAL_FUNCTION(void,png_read_reinit,(png_structp png_ptr,
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_progressive_read_reset,(png_structp png_ptr),
PNG_EMPTY);
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#endif /* PNG_READ_APNG_SUPPORTED */
#endif /* PROGRESSIVE_READ */
#endif /* READ_APNG */
#ifdef PNG_WRITE_APNG_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_acTL,(png_structp png_ptr,
@ -1510,8 +1510,8 @@ PNG_INTERNAL_FUNCTION(void,png_write_fdAT,(png_structp png_ptr,
PNG_INTERNAL_FUNCTION(void,png_write_reset,(png_structp png_ptr),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_write_reinit,(png_structp png_ptr,
png_infop info_ptr, png_uint_32 width, png_uint_32 height),PNG_EMPTY);
#endif /* PNG_WRITE_APNG_SUPPORTED */
#endif /* PNG_APNG_SUPPORTED */
#endif /* WRITE_APNG */
#endif /* APNG */
/* Added at libpng version 1.6.0 */
#ifdef PNG_GAMMA_SUPPORTED

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