");
+// doesn't succeed on SeaMonkey currently, see bug 469331
+// mark it todo there instead
+var testfunc_h = (navigator.userAgent.match(/ SeaMonkey\//)) ? todo : ok;
+var testfunc_w = (navigator.userAgent.match(/Windows/)) ? ok : testfunc_h;
+
function loaded() {
win.sizeToContent();
- ok(win.innerWidth >= 100, "innerWidth");
- ok(win.innerHeight >= 200, "innerHeight");
+ testfunc_w(win.innerWidth >= 100, "innerWidth");
+ testfunc_h(win.innerHeight >= 200, "innerHeight");
win.close();
SimpleTest.finish();
}
diff --git a/layout/generic/crashtests/435529.html b/layout/generic/crashtests/435529.html
new file mode 100644
index 000000000000..736e3377cb13
--- /dev/null
+++ b/layout/generic/crashtests/435529.html
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
AB
+
+
diff --git a/layout/generic/crashtests/436823.html b/layout/generic/crashtests/436823.html
new file mode 100644
index 000000000000..aa6caeff1541
--- /dev/null
+++ b/layout/generic/crashtests/436823.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list
index 27e2217195d9..d7913f87ac41 100644
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -154,6 +154,8 @@ load 426272-1.html
load 428263-1.html
load 429981-1.html
load 430352-1.html
+load 435529.html
+load 436823.html
load 437156-1.html
load 438259-1.html
load 438509-1.html
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 4f8497459e1d..156f70542749 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -99,6 +99,7 @@
#include "nsITextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
+#include "nsStyleStructInlines.h"
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
@@ -553,6 +554,16 @@ nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const
/* virtual */ void
nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
{
+ // We have to start loading the border image before or during reflow,
+ // because the border-image's width overrides only apply once the
+ // image is loaded. Starting the load of the image means we'll get a
+ // reflow when the image loads. (Otherwise, if the image loads
+ // between reflow and paint, we never get the notification and our
+ // size ends up wrong.)
+ imgIRequest *borderImage = GetStyleBorder()->GetBorderImage();
+ if (borderImage) {
+ PresContext()->LoadBorderImage(borderImage, this);
+ }
}
/* virtual */ nsMargin
diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp
index efd313c99e3b..9b08cd639699 100644
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -57,7 +57,6 @@
#include "nsIPercentHeightObserver.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
-#include "nsStyleStructInlines.h"
#ifdef IBMBIDI
#include "nsBidiUtils.h"
#endif
@@ -287,17 +286,6 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
InitResizeFlags(aPresContext);
- // We have to start loading the border image now, because the
- // border-image's width overrides only apply once the image is loaded.
- // Starting the load of the image means we'll get a reflow when the
- // image loads. (If we didn't do it now, and the image loaded between
- // reflow and paint, we'd never get the notification, and our size
- // would be wrong.)
- imgIRequest *borderImage = mStyleBorder->GetBorderImage();
- if (borderImage) {
- aPresContext->LoadBorderImage(borderImage, frame);
- }
-
NS_ASSERTION((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
!frame->IsFrameOfType(nsIFrame::eReplaced)) ||
frame->GetType() == nsGkAtoms::textFrame ||
diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h
index c1e66ae45766..fd17a3eb22da 100644
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -307,11 +307,11 @@ private:
{
// in case the pref service releases us later
if (mLoadingImage) {
- mLoadingImage->Cancel(NS_ERROR_FAILURE);
+ mLoadingImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mLoadingImage = nsnull;
}
if (mBrokenImage) {
- mBrokenImage->Cancel(NS_ERROR_FAILURE);
+ mBrokenImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mBrokenImage = nsnull;
}
}
diff --git a/layout/reftests/border-image/10x5multicolor.png b/layout/reftests/border-image/10x5multicolor.png
index a7d888a32188..7940d1abc7c6 100644
Binary files a/layout/reftests/border-image/10x5multicolor.png and b/layout/reftests/border-image/10x5multicolor.png differ
diff --git a/layout/reftests/border-image/3x3multicolor.png b/layout/reftests/border-image/3x3multicolor.png
index 9be62f07a0f1..586102670ad8 100644
Binary files a/layout/reftests/border-image/3x3multicolor.png and b/layout/reftests/border-image/3x3multicolor.png differ
diff --git a/layout/reftests/border-image/4x4multicolor.png b/layout/reftests/border-image/4x4multicolor.png
index c2518c3e10c6..4b817a1264d6 100644
Binary files a/layout/reftests/border-image/4x4multicolor.png and b/layout/reftests/border-image/4x4multicolor.png differ
diff --git a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png
index 77a369ec1b28..b36c5f4f9922 100644
Binary files a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png and b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png differ
diff --git a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png
index 7a27adf95087..ef3fce2dce36 100644
Binary files a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png and b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png differ
diff --git a/layout/reftests/bugs/213834-1-ref.html b/layout/reftests/bugs/213834-1-ref.html
new file mode 100644
index 000000000000..a7ca2076efd7
--- /dev/null
+++ b/layout/reftests/bugs/213834-1-ref.html
@@ -0,0 +1,3 @@
+
Bug 213834 reftest - reference
+
+text text
diff --git a/layout/reftests/bugs/213834-1.html b/layout/reftests/bugs/213834-1.html
new file mode 100644
index 000000000000..4ccbd14ee10d
--- /dev/null
+++ b/layout/reftests/bugs/213834-1.html
@@ -0,0 +1,3 @@
+
Bug 213834 reftest - test
+
+text text
diff --git a/layout/reftests/bugs/468473-1-ref.xul b/layout/reftests/bugs/468473-1-ref.xul
new file mode 100644
index 000000000000..617cd6aaf7e7
--- /dev/null
+++ b/layout/reftests/bugs/468473-1-ref.xul
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/bugs/468473-1.xul b/layout/reftests/bugs/468473-1.xul
new file mode 100644
index 000000000000..d2a22261e23d
--- /dev/null
+++ b/layout/reftests/bugs/468473-1.xul
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list
index 39f32d0c0248..122b182c0aad 100644
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -138,6 +138,7 @@ fails == 25888-3r.html 25888-3r-ref.html # bug 25888
== 210876-1.html 210876-1-ref.html
== 212563-1.html 212563-1-ref.html
== 212563-2.html 212563-2-ref.html
+== 213834-1.html 213834-1-ref.html
== 214077-1a.html 214077-1-ref.html
== 214077-1b.html 214077-1-ref.html
== 218473-1.html 218473-1-ref.html
@@ -996,3 +997,4 @@ fails == 461512-1.html 461512-1-ref.html # Bug 461512
== 467084-1.html 467084-1-ref.html
== 467084-2.html 467084-2-ref.html
== 467460-1.html 467460-1-ref.html
+== 468473-1.xul 468473-1-ref.xul
diff --git a/layout/reftests/bugs/solidblue.png b/layout/reftests/bugs/solidblue.png
index b42fc158ef69..a64b6a4255c9 100644
Binary files a/layout/reftests/bugs/solidblue.png and b/layout/reftests/bugs/solidblue.png differ
diff --git a/layout/reftests/bugs/solidblue2.png b/layout/reftests/bugs/solidblue2.png
index 9998c98b9608..5da013700156 100644
Binary files a/layout/reftests/bugs/solidblue2.png and b/layout/reftests/bugs/solidblue2.png differ
diff --git a/layout/reftests/bugs/square-outline-32x32.png b/layout/reftests/bugs/square-outline-32x32.png
index 144cb3b10aba..917163f409c0 100644
Binary files a/layout/reftests/bugs/square-outline-32x32.png and b/layout/reftests/bugs/square-outline-32x32.png differ
diff --git a/layout/reftests/font-face/download-2-big-otf.html b/layout/reftests/font-face/download-2-big-otf.html
new file mode 100644
index 000000000000..e2a3a757d4e2
--- /dev/null
+++ b/layout/reftests/font-face/download-2-big-otf.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
A
+
+
+
diff --git a/layout/reftests/font-face/download-2-big.html b/layout/reftests/font-face/download-2-big.html
new file mode 100644
index 000000000000..3f57fd3307b2
--- /dev/null
+++ b/layout/reftests/font-face/download-2-big.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
A
+
+
+
diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list
index b798a4a38380..0614f87c4925 100644
--- a/layout/reftests/font-face/reftest.list
+++ b/layout/reftests/font-face/reftest.list
@@ -5,6 +5,8 @@
HTTP(..) != download-1.html download-1-notref.html
HTTP(..) == download-2.html download-2-ref.html
HTTP(..) != download-2.html about:blank
+fails-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == download-2-big.html download-2-big-otf.html # bug 470713
+HTTP(..) != download-2-big-otf.html about:blank
HTTP(..) == fallback-to-system-1.html fallback-to-system-1-ref.html
HTTP(..) == name-override-simple-1.html name-override-simple-1-ref.html
HTTP(..) != name-override-simple-1.html download-1-notref.html
@@ -13,6 +15,7 @@ HTTP(..) == multiple-descriptor-1.html multiple-descriptor-1-ref.html
HTTP(..) != multiple-descriptor-1.html multiple-descriptor-1-notref.html
HTTP(..) == src-list-1.html src-list-1-ref.html
HTTP(..) == src-list-2.html src-list-2-ref.html
+fails-if(MOZ_WIDGET_TOOLKIT=="windows") HTTP(..) == src-list-2-big-otf.html src-list-2-big-ref.html # bug 470713
fails HTTP(..) == src-list-format-1.html src-list-format-1-ref.html # bug 465452
fails HTTP(..) == src-list-format-2.html src-list-format-2-ref.html # bug 465452
HTTP(..) == src-list-format-3.html src-list-format-3-ref.html
diff --git a/layout/reftests/font-face/src-list-2-big-otf.html b/layout/reftests/font-face/src-list-2-big-otf.html
new file mode 100644
index 000000000000..98b4b8ee71ef
--- /dev/null
+++ b/layout/reftests/font-face/src-list-2-big-otf.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
ABC
+
+
+
diff --git a/layout/reftests/font-face/src-list-2-big-ref.html b/layout/reftests/font-face/src-list-2-big-ref.html
new file mode 100644
index 000000000000..ce855b7040c7
--- /dev/null
+++ b/layout/reftests/font-face/src-list-2-big-ref.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
DBC
+
+
+
diff --git a/layout/reftests/fonts/README b/layout/reftests/fonts/README
new file mode 100755
index 000000000000..d8825c8091a0
--- /dev/null
+++ b/layout/reftests/fonts/README
@@ -0,0 +1,18 @@
+
+Notes about fonts in this directory
+
+Ahem.ttf - ACID3 test font
+
+markXXX.ttf and markXXX.otf
+
+These fonts are autogenerated with FontForge using the Python script mark-generate.py.
+See the comments in that file for more information on how to run the script.
+
+The markX.ttf and markX.otf fonts contain a single glyph for the X character consisting
+of three stacked boxes. The mark2X.ttf and mark2X.otf files also contain just a glyph for the
+character X but the glyph is similar to the space mark character. The markXmark2Y.ttf has
+two glyphs, the first glyph for X and the second glyph for Y.
+
+The markA.eot and markB.eot files are for EOT-related testing. The markA.eot file is just
+a copy of markA.ttf while markB.eot is a valid EOT file embedding the contents of markB.ttf
+with a null root string (so it can be used in IE without domain-specific restrictions).
diff --git a/layout/reftests/fonts/markA.eot b/layout/reftests/fonts/markA.eot
new file mode 100644
index 000000000000..66f5fee2e4f2
Binary files /dev/null and b/layout/reftests/fonts/markA.eot differ
diff --git a/layout/reftests/fonts/markB.eot b/layout/reftests/fonts/markB.eot
new file mode 100755
index 000000000000..fc6334e70d43
Binary files /dev/null and b/layout/reftests/fonts/markB.eot differ
diff --git a/layout/reftests/generated-content/square-outline-32x32.png b/layout/reftests/generated-content/square-outline-32x32.png
index 144cb3b10aba..917163f409c0 100644
Binary files a/layout/reftests/generated-content/square-outline-32x32.png and b/layout/reftests/generated-content/square-outline-32x32.png differ
diff --git a/layout/reftests/pixel-rounding/corner-bl.png b/layout/reftests/pixel-rounding/corner-bl.png
index bed9056cb61b..f9be106e07c9 100644
Binary files a/layout/reftests/pixel-rounding/corner-bl.png and b/layout/reftests/pixel-rounding/corner-bl.png differ
diff --git a/layout/reftests/pixel-rounding/corner-tr.png b/layout/reftests/pixel-rounding/corner-tr.png
index df6590fa0429..97cedba6cac4 100644
Binary files a/layout/reftests/pixel-rounding/corner-tr.png and b/layout/reftests/pixel-rounding/corner-tr.png differ
diff --git a/layout/reftests/pixel-rounding/random-10x10.png b/layout/reftests/pixel-rounding/random-10x10.png
index a91d31a838e2..466588ade136 100644
Binary files a/layout/reftests/pixel-rounding/random-10x10.png and b/layout/reftests/pixel-rounding/random-10x10.png differ
diff --git a/layout/reftests/table-background/repeatable-diagonal-gradient-with-ticks.png b/layout/reftests/table-background/repeatable-diagonal-gradient-with-ticks.png
index 9ac1548c8a68..1b019db984c7 100644
Binary files a/layout/reftests/table-background/repeatable-diagonal-gradient-with-ticks.png and b/layout/reftests/table-background/repeatable-diagonal-gradient-with-ticks.png differ
diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp
index 9eaa2b91d22b..097b0de4a6c8 100644
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -59,30 +59,6 @@
#include "nsCOMPtr.h"
-#define B_BORDER_TOP_STYLE 0x001
-#define B_BORDER_LEFT_STYLE 0x002
-#define B_BORDER_RIGHT_STYLE 0x004
-#define B_BORDER_BOTTOM_STYLE 0x008
-#define B_BORDER_TOP_COLOR 0x010
-#define B_BORDER_LEFT_COLOR 0x020
-#define B_BORDER_RIGHT_COLOR 0x040
-#define B_BORDER_BOTTOM_COLOR 0x080
-#define B_BORDER_TOP_WIDTH 0x100
-#define B_BORDER_LEFT_WIDTH 0x200
-#define B_BORDER_RIGHT_WIDTH 0x400
-#define B_BORDER_BOTTOM_WIDTH 0x800
-
-#define B_BORDER_STYLE 0x00f
-#define B_BORDER_COLOR 0x0f0
-#define B_BORDER_WIDTH 0xf00
-
-#define B_BORDER_TOP 0x111
-#define B_BORDER_LEFT 0x222
-#define B_BORDER_RIGHT 0x444
-#define B_BORDER_BOTTOM 0x888
-
-#define B_BORDER 0xfff
-
nsCSSDeclaration::nsCSSDeclaration()
: mData(nsnull),
mImportantData(nsnull)
@@ -621,11 +597,7 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
return NS_OK;
}
-
- // XXX What about checking the consistency of '!important'?
- // XXX What about checking that we don't serialize inherit,
- // -moz-initial, or other illegal values?
- // XXXldb Can we share shorthand logic with ToString?
+ nsCSSCompressedDataBlock *data = importantCount ? mImportantData : mData;
switch (aProperty) {
case eCSSProperty_margin:
case eCSSProperty_padding:
@@ -639,14 +611,40 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
nsCSSProps::kTypeTable[subprops[2]] == eCSSType_Value &&
nsCSSProps::kTypeTable[subprops[3]] == eCSSType_Value,
"type mismatch");
- if (!AppendValueToString(subprops[0], aValue) ||
- !(aValue.Append(PRUnichar(' ')),
- AppendValueToString(subprops[1], aValue)) ||
- !(aValue.Append(PRUnichar(' ')),
- AppendValueToString(subprops[2], aValue)) ||
- !(aValue.Append(PRUnichar(' ')),
- AppendValueToString(subprops[3], aValue))) {
- aValue.Truncate();
+ NS_ASSERTION(nsCSSProps::GetStringValue(subprops[0]).Find("-top") !=
+ kNotFound, "first subprop must be top");
+ NS_ASSERTION(nsCSSProps::GetStringValue(subprops[1]).Find("-right") !=
+ kNotFound, "second subprop must be right");
+ NS_ASSERTION(nsCSSProps::GetStringValue(subprops[2]).Find("-bottom") !=
+ kNotFound, "third subprop must be bottom");
+ NS_ASSERTION(nsCSSProps::GetStringValue(subprops[3]).Find("-left") !=
+ kNotFound, "fourth subprop must be left");
+ const nsCSSValue &topValue =
+ *static_cast
(data->StorageFor(subprops[0]));
+ const nsCSSValue &rightValue =
+ *static_cast(data->StorageFor(subprops[1]));
+ const nsCSSValue &bottomValue =
+ *static_cast(data->StorageFor(subprops[2]));
+ const nsCSSValue &leftValue =
+ *static_cast(data->StorageFor(subprops[3]));
+ PRBool haveValue;
+ haveValue = AppendCSSValueToString(subprops[0], topValue, aValue);
+ NS_ASSERTION(haveValue, "should have bailed before");
+ if (topValue != rightValue || topValue != leftValue ||
+ topValue != bottomValue) {
+ aValue.Append(PRUnichar(' '));
+ haveValue = AppendCSSValueToString(subprops[1], rightValue, aValue);
+ NS_ASSERTION(haveValue, "should have bailed before");
+ if (topValue != bottomValue || rightValue != leftValue) {
+ aValue.Append(PRUnichar(' '));
+ haveValue = AppendCSSValueToString(subprops[2], bottomValue, aValue);
+ NS_ASSERTION(haveValue, "should have bailed before");
+ if (rightValue != leftValue) {
+ aValue.Append(PRUnichar(' '));
+ haveValue = AppendCSSValueToString(subprops[3], leftValue, aValue);
+ NS_ASSERTION(haveValue, "should have bailed before");
+ }
+ }
}
break;
}
@@ -659,8 +657,6 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
nsCSSProps::kTypeTable[subprops[2]] == eCSSType_ValuePair &&
nsCSSProps::kTypeTable[subprops[3]] == eCSSType_ValuePair,
"type mismatch");
- nsCSSCompressedDataBlock *data = GetValueIsImportant(aProperty)
- ? mImportantData : mData;
const nsCSSValuePair* vals[4] = {
static_cast(data->StorageFor(subprops[0])),
static_cast(data->StorageFor(subprops[1])),
@@ -693,9 +689,34 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
}
break;
}
- case eCSSProperty_border:
- // XXX More consistency checking needed before falling through.
+ case eCSSProperty_border: {
+ const nsCSSProperty* subproptables[3] = {
+ nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color),
+ nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_style),
+ nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_width)
+ };
+ PRBool match = PR_TRUE;
+ for (const nsCSSProperty** subprops = subproptables,
+ **subprops_end = subproptables + NS_ARRAY_LENGTH(subproptables);
+ subprops < subprops_end; ++subprops) {
+ // Check only the first four subprops in each table, since the
+ // others are extras for dimensional box properties.
+ const nsCSSValue *firstSide =
+ static_cast(data->StorageFor((*subprops)[0]));
+ for (PRInt32 side = 1; side < 4; ++side) {
+ const nsCSSValue *otherSide =
+ static_cast(data->StorageFor((*subprops)[side]));
+ if (*firstSide != *otherSide)
+ match = PR_FALSE;
+ }
+ }
+ if (!match) {
+ // We can't express what we have in the border shorthand
+ break;
+ }
+ // tweak aProperty and fall through
aProperty = eCSSProperty_border_top;
+ }
case eCSSProperty_border_top:
case eCSSProperty_border_right:
case eCSSProperty_border_bottom:
@@ -710,11 +731,23 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
nsCSSProps::kTypeTable[subprops[1]] == eCSSType_Value &&
nsCSSProps::kTypeTable[subprops[2]] == eCSSType_Value,
"type mismatch");
+ NS_ASSERTION(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
+ NS_LITERAL_CSTRING("-color")) ||
+ StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
+ NS_LITERAL_CSTRING("-color-value")),
+ "third subprop must be the color property");
+ const nsCSSValue *colorValue =
+ static_cast(data->StorageFor(subprops[2]));
+ PRBool isMozUseTextColor =
+ colorValue->GetUnit() == eCSSUnit_Enumerated &&
+ colorValue->GetIntValue() == NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR;
if (!AppendValueToString(subprops[0], aValue) ||
!(aValue.Append(PRUnichar(' ')),
AppendValueToString(subprops[1], aValue)) ||
- !(aValue.Append(PRUnichar(' ')),
- AppendValueToString(subprops[2], aValue))) {
+ // Don't output a third value when it's -moz-use-text-color.
+ !(isMozUseTextColor ||
+ (aValue.Append(PRUnichar(' ')),
+ AppendValueToString(subprops[2], aValue)))) {
aValue.Truncate();
}
break;
@@ -747,6 +780,26 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
break;
}
case eCSSProperty_background: {
+ // The -moz-background-clip, -moz-background-origin, and
+ // -moz-background-inline-policy properties are reset by this
+ // shorthand property to their initial values, but can't be
+ // represented in its syntax.
+ const nsCSSValue *clipValue = static_cast(
+ data->StorageFor(eCSSProperty__moz_background_clip));
+ const nsCSSValue *originValue = static_cast(
+ data->StorageFor(eCSSProperty__moz_background_origin));
+ const nsCSSValue *inlinePolicyValue = static_cast(
+ data->StorageFor(eCSSProperty__moz_background_inline_policy));
+ if (*clipValue !=
+ nsCSSValue(NS_STYLE_BG_CLIP_BORDER, eCSSUnit_Enumerated) ||
+ *originValue !=
+ nsCSSValue(NS_STYLE_BG_ORIGIN_PADDING, eCSSUnit_Enumerated) ||
+ *inlinePolicyValue !=
+ nsCSSValue(NS_STYLE_BG_INLINE_POLICY_CONTINUOUS,
+ eCSSUnit_Enumerated)) {
+ return NS_OK;
+ }
+
PRBool appendedSomething = PR_FALSE;
if (AppendValueToString(eCSSProperty_background_color, aValue)) {
appendedSomething = PR_TRUE;
@@ -795,6 +848,18 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
systemFont.GetUnit() != eCSSUnit_Null) {
AppendCSSValueToString(eCSSProperty__x_system_font, systemFont, aValue);
} else {
+ // The font-stretch and font-size-adjust
+ // properties are reset by this shorthand property to their
+ // initial values, but can't be represented in its syntax.
+ const nsCSSValue *stretchValue = static_cast(
+ data->StorageFor(eCSSProperty_font_stretch));
+ const nsCSSValue *sizeAdjustValue = static_cast(
+ data->StorageFor(eCSSProperty_font_size_adjust));
+ if (*stretchValue != nsCSSValue(eCSSUnit_Normal) ||
+ *sizeAdjustValue != nsCSSValue(eCSSUnit_None)) {
+ return NS_OK;
+ }
+
if (style.GetUnit() != eCSSUnit_Normal) {
AppendCSSValueToString(eCSSProperty_font_style, style, aValue);
aValue.Append(PRUnichar(' '));
@@ -829,7 +894,7 @@ nsCSSDeclaration::GetValue(nsCSSProperty aProperty,
GetValueOrImportantValue(eCSSProperty_overflow_x, xValue);
GetValueOrImportantValue(eCSSProperty_overflow_y, yValue);
if (xValue == yValue)
- AppendValueToString(eCSSProperty_overflow_x, aValue);
+ AppendCSSValueToString(eCSSProperty_overflow_x, xValue, aValue);
break;
}
case eCSSProperty_pause: {
@@ -890,50 +955,6 @@ nsCSSDeclaration::GetValueIsImportant(nsCSSProperty aProperty) const
return mImportantData->StorageFor(aProperty) != nsnull;
}
-// XXXldb Bug 376075 All callers of AllPropertiesSameImportance also
-// need to check for 'inherit' and 'initial' values, since you can't
-// output a mix of either mixed with other values in the same shorthand!
-PRBool
-nsCSSDeclaration::AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond,
- PRInt32 aThird, PRInt32 aFourth,
- PRInt32 aFifth,
- PRBool & aImportance) const
-{
- aImportance = GetValueIsImportant(OrderValueAt(aFirst-1));
- if ((aSecond && aImportance != GetValueIsImportant(OrderValueAt(aSecond-1))) ||
- (aThird && aImportance != GetValueIsImportant(OrderValueAt(aThird-1))) ||
- (aFourth && aImportance != GetValueIsImportant(OrderValueAt(aFourth-1))) ||
- (aFifth && aImportance != GetValueIsImportant(OrderValueAt(aFifth-1)))) {
- return PR_FALSE;
- }
- return PR_TRUE;
-}
-
-PRBool
-nsCSSDeclaration::AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
- PRInt32 aThird, PRInt32 aFourth) const
-{
- nsCSSValue firstValue, otherValue;
- // TryBorderShorthand does the bounds-checking for us; valid values there
- // are > 0; 0 is a flag for "not set". We here are passed the actual
- // index, which comes from finding the value in the mOrder property array.
- // Of course, re-getting the mOrder value here is pretty silly.
- GetValueOrImportantValue(OrderValueAt(aFirst-1), firstValue);
- GetValueOrImportantValue(OrderValueAt(aSecond-1), otherValue);
- if (firstValue != otherValue) {
- return PR_FALSE;
- }
- GetValueOrImportantValue(OrderValueAt(aThird-1), otherValue);
- if (firstValue != otherValue) {
- return PR_FALSE;
- }
- GetValueOrImportantValue(OrderValueAt(aFourth-1), otherValue);
- if (firstValue != otherValue) {
- return PR_FALSE;
- }
- return PR_TRUE;
-}
-
/* static */ void
nsCSSDeclaration::AppendImportanceToString(PRBool aIsImportant,
nsAString& aString)
@@ -945,636 +966,74 @@ nsCSSDeclaration::AppendImportanceToString(PRBool aIsImportant,
void
nsCSSDeclaration::AppendPropertyAndValueToString(nsCSSProperty aProperty,
- nsCSSProperty aPropertyName,
+ nsAutoString& aValue,
nsAString& aResult) const
{
- NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands,
+ NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
"property enum out of range");
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(aPropertyName), aResult);
+ NS_ASSERTION((aProperty < eCSSProperty_COUNT_no_shorthands) ==
+ aValue.IsEmpty(),
+ "aValue should be given for shorthands but not longhands");
+ AppendASCIItoUTF16(nsCSSProps::GetStringValue(aProperty), aResult);
aResult.AppendLiteral(": ");
- AppendValueToString(aProperty, aResult);
+ if (aValue.IsEmpty())
+ AppendValueToString(aProperty, aResult);
+ else
+ aResult.Append(aValue);
PRBool isImportant = GetValueIsImportant(aProperty);
AppendImportanceToString(isImportant, aResult);
aResult.AppendLiteral("; ");
}
-PRBool
-nsCSSDeclaration::TryBorderShorthand(nsAString & aString, PRUint32 aPropertiesSet,
- PRInt32 aBorderTopWidth,
- PRInt32 aBorderTopStyle,
- PRInt32 aBorderTopColor,
- PRInt32 aBorderBottomWidth,
- PRInt32 aBorderBottomStyle,
- PRInt32 aBorderBottomColor,
- PRInt32 aBorderLeftWidth,
- PRInt32 aBorderLeftStyle,
- PRInt32 aBorderLeftColor,
- PRInt32 aBorderRightWidth,
- PRInt32 aBorderRightStyle,
- PRInt32 aBorderRightColor) const
-{
- PRBool border = PR_FALSE, isImportant = PR_FALSE;
- // 0 means not in the mOrder array; otherwise it's index+1
- if (B_BORDER == aPropertiesSet
- && AllPropertiesSameValue(aBorderTopWidth, aBorderBottomWidth,
- aBorderLeftWidth, aBorderRightWidth)
- && AllPropertiesSameValue(aBorderTopStyle, aBorderBottomStyle,
- aBorderLeftStyle, aBorderRightStyle)
- && AllPropertiesSameValue(aBorderTopColor, aBorderBottomColor,
- aBorderLeftColor, aBorderRightColor)) {
- border = PR_TRUE;
- }
- if (border) {
- border = PR_FALSE;
- PRBool isWidthImportant, isStyleImportant, isColorImportant;
- if (AllPropertiesSameImportance(aBorderTopWidth, aBorderBottomWidth,
- aBorderLeftWidth, aBorderRightWidth,
- 0,
- isWidthImportant) &&
- AllPropertiesSameImportance(aBorderTopStyle, aBorderBottomStyle,
- aBorderLeftStyle, aBorderRightStyle,
- 0,
- isStyleImportant) &&
- AllPropertiesSameImportance(aBorderTopColor, aBorderBottomColor,
- aBorderLeftColor, aBorderRightColor,
- 0,
- isColorImportant)) {
- if (isWidthImportant == isStyleImportant && isWidthImportant == isColorImportant) {
- border = PR_TRUE;
- isImportant = isWidthImportant;
- }
- }
- }
- if (border) {
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(eCSSProperty_border), aString);
- aString.AppendLiteral(": ");
-
- AppendValueToString(eCSSProperty_border_top_width, aString);
- aString.Append(PRUnichar(' '));
-
- AppendValueToString(eCSSProperty_border_top_style, aString);
- aString.Append(PRUnichar(' '));
-
- nsAutoString valueString;
- AppendValueToString(eCSSProperty_border_top_color, valueString);
- if (!valueString.EqualsLiteral("-moz-use-text-color")) {
- /* don't output this value, it's proprietary Mozilla and */
- /* not intended to be exposed ; we can remove it from the */
- /* values of the shorthand since this value represents the */
- /* initial value of border-*-color */
- aString.Append(valueString);
- }
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- }
- return border;
-}
-
-PRBool
-nsCSSDeclaration::TryBorderSideShorthand(nsAString & aString,
- nsCSSProperty aShorthand,
- PRInt32 aBorderWidth,
- PRInt32 aBorderStyle,
- PRInt32 aBorderColor) const
-{
- PRBool isImportant;
- if (AllPropertiesSameImportance(aBorderWidth, aBorderStyle, aBorderColor,
- 0, 0,
- isImportant)) {
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(aShorthand), aString);
- aString.AppendLiteral(": ");
-
- AppendValueToString(OrderValueAt(aBorderWidth-1), aString);
-
- aString.Append(PRUnichar(' '));
- AppendValueToString(OrderValueAt(aBorderStyle-1), aString);
-
- nsAutoString valueString;
- AppendValueToString(OrderValueAt(aBorderColor-1), valueString);
- if (!valueString.EqualsLiteral("-moz-use-text-color")) {
- aString.AppendLiteral(" ");
- aString.Append(valueString);
- }
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- return PR_TRUE;
- }
- return PR_FALSE;
-}
-
-PRBool
-nsCSSDeclaration::TryFourSidesShorthand(nsAString & aString,
- nsCSSProperty aShorthand,
- PRInt32 & aTop,
- PRInt32 & aBottom,
- PRInt32 & aLeft,
- PRInt32 & aRight,
- PRBool aClearIndexes) const
-{
- // 0 means not in the mOrder array; otherwise it's index+1
- PRBool isImportant;
- if (aTop && aBottom && aLeft && aRight &&
- AllPropertiesSameImportance(aTop, aBottom, aLeft, aRight,
- 0,
- isImportant)) {
- // all 4 properties are set, we can output a shorthand
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(aShorthand), aString);
- aString.AppendLiteral(": ");
- nsCSSValue topValue, bottomValue, leftValue, rightValue;
- nsCSSProperty topProp = OrderValueAt(aTop-1);
- nsCSSProperty bottomProp = OrderValueAt(aBottom-1);
- nsCSSProperty leftProp = OrderValueAt(aLeft-1);
- nsCSSProperty rightProp = OrderValueAt(aRight-1);
- GetValueOrImportantValue(topProp, topValue);
- GetValueOrImportantValue(bottomProp, bottomValue);
- GetValueOrImportantValue(leftProp, leftValue);
- GetValueOrImportantValue(rightProp, rightValue);
- AppendCSSValueToString(topProp, topValue, aString);
- if (topValue != rightValue || topValue != leftValue || topValue != bottomValue) {
- aString.Append(PRUnichar(' '));
- AppendCSSValueToString(rightProp, rightValue, aString);
- if (topValue != bottomValue || rightValue != leftValue) {
- aString.Append(PRUnichar(' '));
- AppendCSSValueToString(bottomProp, bottomValue, aString);
- if (rightValue != leftValue) {
- aString.Append(PRUnichar(' '));
- AppendCSSValueToString(leftProp, leftValue, aString);
- }
- }
- }
- if (aClearIndexes) {
- aTop = 0; aBottom = 0; aLeft = 0; aRight = 0;
- }
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- return PR_TRUE;
- }
- return PR_FALSE;
-}
-
-void
-nsCSSDeclaration::TryBackgroundShorthand(nsAString & aString,
- PRInt32 & aBgColor,
- PRInt32 & aBgImage,
- PRInt32 & aBgRepeat,
- PRInt32 & aBgAttachment,
- PRInt32 & aBgPosition) const
-{
- // 0 means not in the mOrder array; otherwise it's index+1
- // check if we have at least two properties set; otherwise, no need to
- // use a shorthand
- PRBool isImportant;
- if (aBgColor && aBgImage && aBgRepeat && aBgAttachment && aBgPosition &&
- AllPropertiesSameImportance(aBgColor, aBgImage, aBgRepeat, aBgAttachment,
- aBgPosition, isImportant)) {
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(eCSSProperty_background), aString);
- aString.AppendLiteral(": ");
-
- AppendValueToString(eCSSProperty_background_color, aString);
- aBgColor = 0;
-
- aString.Append(PRUnichar(' '));
- AppendValueToString(eCSSProperty_background_image, aString);
- aBgImage = 0;
-
- aString.Append(PRUnichar(' '));
- AppendValueToString(eCSSProperty_background_repeat, aString);
- aBgRepeat = 0;
-
- aString.Append(PRUnichar(' '));
- AppendValueToString(eCSSProperty_background_attachment, aString);
- aBgAttachment = 0;
-
- aString.Append(PRUnichar(' '));
- AppendValueToString(eCSSProperty_background_position, aString);
- aBgPosition = 0;
-
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- }
-}
-
-void
-nsCSSDeclaration::TryOverflowShorthand(nsAString & aString,
- PRInt32 & aOverflowX,
- PRInt32 & aOverflowY) const
-{
- PRBool isImportant;
- if (aOverflowX && aOverflowY &&
- AllPropertiesSameImportance(aOverflowX, aOverflowY,
- 0, 0, 0, isImportant)) {
- nsCSSValue xValue, yValue;
- GetValueOrImportantValue(eCSSProperty_overflow_x, xValue);
- GetValueOrImportantValue(eCSSProperty_overflow_y, yValue);
- if (xValue == yValue) {
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(eCSSProperty_overflow),
- aString);
- aString.AppendLiteral(": ");
-
- AppendCSSValueToString(eCSSProperty_overflow_x, xValue, aString);
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- aOverflowX = aOverflowY = 0;
- }
- }
-}
-
-#ifdef MOZ_SVG
-void
-nsCSSDeclaration::TryMarkerShorthand(nsAString & aString,
- PRInt32 & aMarkerEnd,
- PRInt32 & aMarkerMid,
- PRInt32 & aMarkerStart) const
-{
- PRBool isImportant;
- if (aMarkerEnd && aMarkerMid && aMarkerEnd &&
- AllPropertiesSameImportance(aMarkerEnd, aMarkerMid, aMarkerStart,
- 0, 0, isImportant)) {
- nsCSSValue endValue, midValue, startValue;
- GetValueOrImportantValue(eCSSProperty_marker_end, endValue);
- GetValueOrImportantValue(eCSSProperty_marker_mid, midValue);
- GetValueOrImportantValue(eCSSProperty_marker_start, startValue);
- if (endValue == midValue && midValue == startValue) {
- AppendASCIItoUTF16(nsCSSProps::GetStringValue(eCSSProperty_marker),
- aString);
- aString.AppendLiteral(": ");
-
- AppendCSSValueToString(eCSSProperty_marker_end, endValue, aString);
- AppendImportanceToString(isImportant, aString);
- aString.AppendLiteral("; ");
- aMarkerEnd = aMarkerMid = aMarkerStart = 0;
- }
- }
-}
-#endif
-
-#define NS_CASE_OUTPUT_PROPERTY_VALUE(_prop, _index) \
-case _prop: \
- if (_index) { \
- AppendPropertyAndValueToString(property, aString); \
- _index = 0; \
- } \
- break;
-
-#define NS_CASE_OUTPUT_PROPERTY_VALUE_AS(_prop, _propas, _index) \
-case _prop: \
- if (_index) { \
- AppendPropertyAndValueToString(property, _propas, aString); \
- _index = 0; \
- } \
- break;
-
-#define NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(_condition, _prop, _index) \
-case _prop: \
- if ((_condition) && _index) { \
- AppendPropertyAndValueToString(property, aString); \
- _index = 0; \
- } \
- break;
-
-#define NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(_condition, _prop, _propas, _index) \
-case _prop: \
- if ((_condition) && _index) { \
- AppendPropertyAndValueToString(property, _propas, aString); \
- _index = 0; \
- } \
- break;
-
-void nsCSSDeclaration::PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const
-{
- aPropertyIndex = aIndex + 1;
- aSet |= aValue;
-}
-
nsresult
nsCSSDeclaration::ToString(nsAString& aString) const
{
PRInt32 count = mOrder.Length();
PRInt32 index;
- // 0 means not in the mOrder array; otherwise it's index+1
- PRInt32 borderTopWidth = 0, borderTopStyle = 0, borderTopColor = 0;
- PRInt32 borderBottomWidth = 0, borderBottomStyle = 0, borderBottomColor = 0;
- PRInt32 borderLeftWidth = 0, borderLeftStyle = 0, borderLeftColor = 0;
- PRInt32 borderRightWidth = 0, borderRightStyle = 0, borderRightColor = 0;
- PRInt32 borderStartWidth = 0, borderStartStyle = 0, borderStartColor = 0;
- PRInt32 borderEndWidth = 0, borderEndStyle = 0, borderEndColor = 0;
- PRInt32 marginTop = 0, marginBottom = 0, marginLeft = 0, marginRight = 0;
- PRInt32 paddingTop = 0, paddingBottom = 0, paddingLeft = 0, paddingRight = 0;
- PRInt32 bgColor = 0, bgImage = 0, bgRepeat = 0, bgAttachment = 0;
- PRInt32 bgPosition = 0;
- PRInt32 overflowX = 0, overflowY = 0;
- PRInt32 columnRuleWidth = 0, columnRuleStyle = 0, columnRuleColor = 0;
- PRUint32 borderPropertiesSet = 0, finalBorderPropertiesToSet = 0;
-#ifdef MOZ_SVG
- PRInt32 markerEnd = 0, markerMid = 0, markerStart = 0;
-#endif
-
+ nsAutoTArray shorthandsUsed;
for (index = 0; index < count; index++) {
nsCSSProperty property = OrderValueAt(index);
- switch (property) {
- case eCSSProperty_border_top_width:
- PropertyIsSet(borderTopWidth, index, borderPropertiesSet, B_BORDER_TOP_WIDTH);
- break;
- case eCSSProperty_border_bottom_width:
- PropertyIsSet(borderBottomWidth, index, borderPropertiesSet, B_BORDER_BOTTOM_WIDTH);
- break;
- case eCSSProperty_border_left_width_value:
- PropertyIsSet(borderLeftWidth, index, borderPropertiesSet, B_BORDER_LEFT_WIDTH);
- break;
- case eCSSProperty_border_right_width_value:
- PropertyIsSet(borderRightWidth, index, borderPropertiesSet, B_BORDER_RIGHT_WIDTH);
- break;
- case eCSSProperty_border_start_width_value:
- borderStartWidth = index+1;
- break;
- case eCSSProperty_border_end_width_value:
- borderEndWidth = index+1;
- break;
+ PRBool doneProperty = PR_FALSE;
- case eCSSProperty_border_top_style:
- PropertyIsSet(borderTopStyle, index, borderPropertiesSet, B_BORDER_TOP_STYLE);
- break;
- case eCSSProperty_border_bottom_style:
- PropertyIsSet(borderBottomStyle, index, borderPropertiesSet, B_BORDER_BOTTOM_STYLE);
- break;
- case eCSSProperty_border_left_style_value:
- PropertyIsSet(borderLeftStyle, index, borderPropertiesSet, B_BORDER_LEFT_STYLE);
- break;
- case eCSSProperty_border_right_style_value:
- PropertyIsSet(borderRightStyle, index, borderPropertiesSet, B_BORDER_RIGHT_STYLE);
- break;
- case eCSSProperty_border_start_style_value:
- borderStartStyle = index+1;
- break;
- case eCSSProperty_border_end_style_value:
- borderEndStyle = index+1;
- break;
-
- case eCSSProperty_border_top_color:
- PropertyIsSet(borderTopColor, index, borderPropertiesSet, B_BORDER_TOP_COLOR);
- break;
- case eCSSProperty_border_bottom_color:
- PropertyIsSet(borderBottomColor, index, borderPropertiesSet, B_BORDER_BOTTOM_COLOR);
- break;
- case eCSSProperty_border_left_color_value:
- PropertyIsSet(borderLeftColor, index, borderPropertiesSet, B_BORDER_LEFT_COLOR);
- break;
- case eCSSProperty_border_right_color_value:
- PropertyIsSet(borderRightColor, index, borderPropertiesSet, B_BORDER_RIGHT_COLOR);
- break;
- case eCSSProperty_border_start_color_value:
- borderStartColor = index+1;
- break;
- case eCSSProperty_border_end_color_value:
- borderEndColor = index+1;
- break;
-
- case eCSSProperty_margin_top: marginTop = index+1; break;
- case eCSSProperty_margin_bottom: marginBottom = index+1; break;
- case eCSSProperty_margin_left_value: marginLeft = index+1; break;
- case eCSSProperty_margin_right_value: marginRight = index+1; break;
-
- case eCSSProperty_padding_top: paddingTop = index+1; break;
- case eCSSProperty_padding_bottom: paddingBottom = index+1; break;
- case eCSSProperty_padding_left_value: paddingLeft = index+1; break;
- case eCSSProperty_padding_right_value: paddingRight = index+1; break;
-
- case eCSSProperty_background_color: bgColor = index+1; break;
- case eCSSProperty_background_image: bgImage = index+1; break;
- case eCSSProperty_background_repeat: bgRepeat = index+1; break;
- case eCSSProperty_background_attachment: bgAttachment = index+1; break;
- case eCSSProperty_background_position: bgPosition = index+1; break;
-
- case eCSSProperty_overflow_x: overflowX = index+1; break;
- case eCSSProperty_overflow_y: overflowY = index+1; break;
-
- case eCSSProperty__moz_column_rule_width: columnRuleWidth = index+1; break;
- case eCSSProperty__moz_column_rule_style: columnRuleStyle = index+1; break;
- case eCSSProperty__moz_column_rule_color: columnRuleColor = index+1; break;
-
-#ifdef MOZ_SVG
- case eCSSProperty_marker_end: markerEnd = index+1; break;
- case eCSSProperty_marker_mid: markerMid = index+1; break;
- case eCSSProperty_marker_start: markerStart = index+1; break;
-#endif
-
- default: break;
- }
- }
-
- if (!TryBorderShorthand(aString, borderPropertiesSet,
- borderTopWidth, borderTopStyle, borderTopColor,
- borderBottomWidth, borderBottomStyle, borderBottomColor,
- borderLeftWidth, borderLeftStyle, borderLeftColor,
- borderRightWidth, borderRightStyle, borderRightColor)) {
- PRUint32 borderPropertiesToSet = 0;
- if ((borderPropertiesSet & B_BORDER_STYLE) != B_BORDER_STYLE ||
- !TryFourSidesShorthand(aString, eCSSProperty_border_style,
- borderTopStyle, borderBottomStyle,
- borderLeftStyle, borderRightStyle,
- PR_FALSE)) {
- borderPropertiesToSet |= B_BORDER_STYLE;
- }
- if ((borderPropertiesSet & B_BORDER_COLOR) != B_BORDER_COLOR ||
- !TryFourSidesShorthand(aString, eCSSProperty_border_color,
- borderTopColor, borderBottomColor,
- borderLeftColor, borderRightColor,
- PR_FALSE)) {
- borderPropertiesToSet |= B_BORDER_COLOR;
- }
- if ((borderPropertiesSet & B_BORDER_WIDTH) != B_BORDER_WIDTH ||
- !TryFourSidesShorthand(aString, eCSSProperty_border_width,
- borderTopWidth, borderBottomWidth,
- borderLeftWidth, borderRightWidth,
- PR_FALSE)) {
- borderPropertiesToSet |= B_BORDER_WIDTH;
- }
- borderPropertiesToSet &= borderPropertiesSet;
- if (borderPropertiesToSet) {
- if ((borderPropertiesSet & B_BORDER_TOP) != B_BORDER_TOP ||
- !TryBorderSideShorthand(aString, eCSSProperty_border_top,
- borderTopWidth, borderTopStyle, borderTopColor)) {
- finalBorderPropertiesToSet |= B_BORDER_TOP;
- }
- if ((borderPropertiesSet & B_BORDER_LEFT) != B_BORDER_LEFT ||
- !TryBorderSideShorthand(aString, eCSSProperty_border_left,
- borderLeftWidth, borderLeftStyle, borderLeftColor)) {
- finalBorderPropertiesToSet |= B_BORDER_LEFT;
- }
- if ((borderPropertiesSet & B_BORDER_RIGHT) != B_BORDER_RIGHT ||
- !TryBorderSideShorthand(aString, eCSSProperty_border_right,
- borderRightWidth, borderRightStyle, borderRightColor)) {
- finalBorderPropertiesToSet |= B_BORDER_RIGHT;
- }
- if ((borderPropertiesSet & B_BORDER_BOTTOM) != B_BORDER_BOTTOM ||
- !TryBorderSideShorthand(aString, eCSSProperty_border_bottom,
- borderBottomWidth, borderBottomStyle, borderBottomColor)) {
- finalBorderPropertiesToSet |= B_BORDER_BOTTOM;
- }
- finalBorderPropertiesToSet &= borderPropertiesToSet;
- }
- }
-
- TryFourSidesShorthand(aString, eCSSProperty_margin,
- marginTop, marginBottom,
- marginLeft, marginRight,
- PR_TRUE);
- TryFourSidesShorthand(aString, eCSSProperty_padding,
- paddingTop, paddingBottom,
- paddingLeft, paddingRight,
- PR_TRUE);
- TryBackgroundShorthand(aString,
- bgColor, bgImage, bgRepeat, bgAttachment,
- bgPosition);
- TryOverflowShorthand(aString, overflowX, overflowY);
-#ifdef MOZ_SVG
- TryMarkerShorthand(aString, markerEnd, markerMid, markerStart);
-#endif
-
- if (columnRuleColor && columnRuleStyle && columnRuleWidth) {
- TryBorderSideShorthand(aString, eCSSProperty__moz_column_rule,
- columnRuleWidth, columnRuleStyle, columnRuleColor);
- columnRuleWidth = columnRuleStyle = columnRuleColor = 0;
- }
-
- // FIXME The order of the declarations should depend on the *-source
- // properties.
- if (borderStartWidth && borderStartStyle && borderStartColor &&
- TryBorderSideShorthand(aString, eCSSProperty_border_start,
- borderStartWidth, borderStartStyle, borderStartColor))
- borderStartWidth = borderStartStyle = borderStartColor = 0;
- if (borderEndWidth && borderEndStyle && borderEndColor &&
- TryBorderSideShorthand(aString, eCSSProperty_border_end,
- borderEndWidth, borderEndStyle, borderEndColor))
- borderEndWidth = borderEndStyle = borderEndColor = 0;
-
- for (index = 0; index < count; index++) {
- nsCSSProperty property = OrderValueAt(index);
- switch (property) {
-
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_STYLE,
- eCSSProperty_border_top_style, borderTopStyle)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_STYLE,
- eCSSProperty_border_left_style_value,
- eCSSProperty_border_left_style, borderLeftStyle)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_STYLE,
- eCSSProperty_border_right_style_value,
- eCSSProperty_border_right_style, borderRightStyle)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_STYLE,
- eCSSProperty_border_bottom_style, borderBottomStyle)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_style_value,
- eCSSProperty_border_start_style, borderStartStyle)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_style_value,
- eCSSProperty_border_end_style, borderEndStyle)
-
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_COLOR,
- eCSSProperty_border_top_color, borderTopColor)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_COLOR,
- eCSSProperty_border_left_color_value,
- eCSSProperty_border_left_color, borderLeftColor)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_COLOR,
- eCSSProperty_border_right_color_value,
- eCSSProperty_border_right_color, borderRightColor)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_COLOR,
- eCSSProperty_border_bottom_color, borderBottomColor)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_color_value,
- eCSSProperty_border_start_color, borderStartColor)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_color_value,
- eCSSProperty_border_end_color, borderEndColor)
-
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_TOP_WIDTH,
- eCSSProperty_border_top_width, borderTopWidth)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_LEFT_WIDTH,
- eCSSProperty_border_left_width_value,
- eCSSProperty_border_left_width, borderLeftWidth)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE_AS(finalBorderPropertiesToSet & B_BORDER_RIGHT_WIDTH,
- eCSSProperty_border_right_width_value,
- eCSSProperty_border_right_width, borderRightWidth)
- NS_CASE_CONDITIONAL_OUTPUT_PROPERTY_VALUE(finalBorderPropertiesToSet & B_BORDER_BOTTOM_WIDTH,
- eCSSProperty_border_bottom_width, borderBottomWidth)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_start_width_value,
- eCSSProperty_border_start_width, borderStartWidth)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_border_end_width_value,
- eCSSProperty_border_end_width, borderEndWidth)
-
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_margin_top, marginTop)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_margin_bottom, marginBottom)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_margin_left_value,
- eCSSProperty_margin_left, marginLeft)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_margin_right_value,
- eCSSProperty_margin_right, marginRight)
-
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_padding_top, paddingTop)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_padding_bottom, paddingBottom)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_padding_left_value,
- eCSSProperty_padding_left, paddingLeft)
- NS_CASE_OUTPUT_PROPERTY_VALUE_AS(eCSSProperty_padding_right_value,
- eCSSProperty_padding_right, paddingRight)
-
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_background_color, bgColor)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_background_image, bgImage)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_background_repeat, bgRepeat)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_background_attachment, bgAttachment)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_background_position, bgPosition)
-
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_x, overflowX)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_overflow_y, overflowY)
-
-#ifdef MOZ_SVG
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_marker_end, markerEnd)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_marker_mid, markerMid)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty_marker_start, markerStart)
-#endif
-
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty__moz_column_rule_width, columnRuleWidth)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty__moz_column_rule_style, columnRuleStyle)
- NS_CASE_OUTPUT_PROPERTY_VALUE(eCSSProperty__moz_column_rule_color, columnRuleColor)
-
- case eCSSProperty_margin_left_ltr_source:
- case eCSSProperty_margin_left_rtl_source:
- case eCSSProperty_margin_right_ltr_source:
- case eCSSProperty_margin_right_rtl_source:
- case eCSSProperty_padding_left_ltr_source:
- case eCSSProperty_padding_left_rtl_source:
- case eCSSProperty_padding_right_ltr_source:
- case eCSSProperty_padding_right_rtl_source:
- case eCSSProperty_border_left_color_ltr_source:
- case eCSSProperty_border_left_color_rtl_source:
- case eCSSProperty_border_left_style_ltr_source:
- case eCSSProperty_border_left_style_rtl_source:
- case eCSSProperty_border_left_width_ltr_source:
- case eCSSProperty_border_left_width_rtl_source:
- case eCSSProperty_border_right_color_ltr_source:
- case eCSSProperty_border_right_color_rtl_source:
- case eCSSProperty_border_right_style_ltr_source:
- case eCSSProperty_border_right_style_rtl_source:
- case eCSSProperty_border_right_width_ltr_source:
- case eCSSProperty_border_right_width_rtl_source:
- break;
-
- case eCSSProperty_margin_start_value:
- AppendPropertyAndValueToString(property, eCSSProperty_margin_start,
- aString);
- break;
- case eCSSProperty_margin_end_value:
- AppendPropertyAndValueToString(property, eCSSProperty_margin_end,
- aString);
- break;
- case eCSSProperty_padding_start_value:
- AppendPropertyAndValueToString(property, eCSSProperty_padding_start,
- aString);
- break;
- case eCSSProperty_padding_end_value:
- AppendPropertyAndValueToString(property, eCSSProperty_padding_end,
- aString);
- break;
-
- default:
- if (0 <= property) {
- AppendPropertyAndValueToString(property, aString);
+ // If we already used this property in a shorthand, skip it.
+ if (shorthandsUsed.Length() > 0) {
+ for (const nsCSSProperty *shorthands =
+ nsCSSProps::ShorthandsContaining(property);
+ *shorthands != eCSSProperty_UNKNOWN; ++shorthands) {
+ if (shorthandsUsed.Contains(*shorthands)) {
+ doneProperty = PR_TRUE;
+ break;
}
- break;
+ }
+ if (doneProperty)
+ continue;
}
+
+ // Try to use this property in a shorthand.
+ nsAutoString value;
+ for (const nsCSSProperty *shorthands =
+ nsCSSProps::ShorthandsContaining(property);
+ *shorthands != eCSSProperty_UNKNOWN; ++shorthands) {
+ // ShorthandsContaining returns the shorthands in order from those
+ // that contain the most subproperties to those that contain the
+ // least, which is exactly the order we want to test them.
+ nsCSSProperty shorthand = *shorthands;
+
+ // If GetValue gives us a non-empty string back, we can use that
+ // value; otherwise it's not possible to use this shorthand.
+ GetValue(shorthand, value);
+ if (!value.IsEmpty()) {
+ AppendPropertyAndValueToString(shorthand, value, aString);
+ shorthandsUsed.AppendElement(shorthand);
+ doneProperty = PR_TRUE;
+ break;
+ }
+ }
+ if (doneProperty)
+ continue;
+
+ NS_ASSERTION(value.IsEmpty(), "value should be empty now");
+ AppendPropertyAndValueToString(property, value, aString);
}
if (! aString.IsEmpty()) {
// if the string is not empty, we have a trailing whitespace we should remove
diff --git a/layout/style/nsCSSDeclaration.h b/layout/style/nsCSSDeclaration.h
index 30a8a4a58e80..bcab9505424f 100644
--- a/layout/style/nsCSSDeclaration.h
+++ b/layout/style/nsCSSDeclaration.h
@@ -165,58 +165,9 @@ private:
// May be called only for properties whose type is eCSSType_Value.
nsresult GetValueOrImportantValue(nsCSSProperty aProperty, nsCSSValue& aValue) const;
- void PropertyIsSet(PRInt32 & aPropertyIndex, PRInt32 aIndex, PRUint32 & aSet, PRUint32 aValue) const;
- PRBool TryBorderShorthand(nsAString & aString, PRUint32 aPropertiesSet,
- PRInt32 aBorderTopWidth,
- PRInt32 aBorderTopStyle,
- PRInt32 aBorderTopColor,
- PRInt32 aBorderBottomWidth,
- PRInt32 aBorderBottomStyle,
- PRInt32 aBorderBottomColor,
- PRInt32 aBorderLeftWidth,
- PRInt32 aBorderLeftStyle,
- PRInt32 aBorderLeftColor,
- PRInt32 aBorderRightWidth,
- PRInt32 aBorderRightStyle,
- PRInt32 aBorderRightColor) const;
- PRBool TryBorderSideShorthand(nsAString & aString,
- nsCSSProperty aShorthand,
- PRInt32 aBorderWidth,
- PRInt32 aBorderStyle,
- PRInt32 aBorderColor) const;
- PRBool TryFourSidesShorthand(nsAString & aString,
- nsCSSProperty aShorthand,
- PRInt32 & aTop,
- PRInt32 & aBottom,
- PRInt32 & aLeft,
- PRInt32 & aRight,
- PRBool aClearIndexes) const;
- void TryBackgroundShorthand(nsAString & aString,
- PRInt32 & aBgColor, PRInt32 & aBgImage,
- PRInt32 & aBgRepeat, PRInt32 & aBgAttachment,
- PRInt32 & aBgPosition) const;
- void TryOverflowShorthand(nsAString & aString,
- PRInt32 & aOverflowX, PRInt32 & aOverflowY) const;
-#ifdef MOZ_SVG
- void TryMarkerShorthand(nsAString & aString,
- PRInt32 & aMarkerEnd,
- PRInt32 & aMarkerMid,
- PRInt32 & aMarkerStart) const;
-#endif
-
- PRBool AllPropertiesSameImportance(PRInt32 aFirst, PRInt32 aSecond,
- PRInt32 aThird, PRInt32 aFourth,
- PRInt32 aFifth,
- PRBool & aImportance) const;
- PRBool AllPropertiesSameValue(PRInt32 aFirst, PRInt32 aSecond,
- PRInt32 aThird, PRInt32 aFourth) const;
+ // Helper for ToString with strange semantics regarding aValue.
void AppendPropertyAndValueToString(nsCSSProperty aProperty,
- nsAString& aResult) const
- {
- AppendPropertyAndValueToString(aProperty, aProperty, aResult);
- }
- void AppendPropertyAndValueToString(nsCSSProperty aProperty,
- nsCSSProperty aPropertyName,
+ nsAutoString& aValue,
nsAString& aResult) const;
private:
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index a909914d26ca..8cceb644b2ec 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -5375,7 +5375,7 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
return ParseVariant(aValue, VARIANT_HK,
nsCSSProps::kBoxPackKTable);
case eCSSProperty_box_ordinal_group:
- return ParseVariant(aValue, VARIANT_HI, nsnull);
+ return ParsePositiveVariant(aValue, VARIANT_HI, nsnull);
#ifdef MOZ_SVG
case eCSSProperty_clip_path:
return ParseVariant(aValue, VARIANT_HUO, nsnull);
@@ -5431,8 +5431,10 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
return ParseVariant(aValue, VARIANT_HK,
nsCSSProps::kStrokeLinejoinKTable);
case eCSSProperty_stroke_miterlimit:
- return ParsePositiveVariant(aValue, VARIANT_HN,
- nsnull);
+ return ParseVariant(aValue, VARIANT_HN, nsnull) &&
+ // Enforce the restriction that the value is greater than 1.
+ (aValue.GetUnit() != eCSSUnit_Number ||
+ aValue.GetFloatValue() >= 1.0f);
case eCSSProperty_stroke_opacity:
return ParseVariant(aValue, VARIANT_HN,
nsnull);
@@ -6363,37 +6365,36 @@ PRBool
CSSParserImpl::ParseBorderColors(nsCSSValueList** aResult,
nsCSSProperty aProperty)
{
- nsCSSValue value;
- if (ParseVariant(value, VARIANT_HCK|VARIANT_NONE, nsCSSProps::kBorderColorKTable)) {
- nsCSSValueList* listHead = new nsCSSValueList();
- nsCSSValueList* list = listHead;
- if (!list) {
+ nsCSSValueList *list = nsnull;
+ for (nsCSSValueList **curp = &list, *cur; ; curp = &cur->mNext) {
+ cur = *curp = new nsCSSValueList();
+ if (!cur) {
mScanner.SetLowLevelError(NS_ERROR_OUT_OF_MEMORY);
- return PR_FALSE;
+ break;
}
- list->mValue = value;
-
- while (list) {
- if (ExpectEndProperty()) {
- mTempData.SetPropertyBit(aProperty);
- *aResult = listHead;
- return PR_TRUE;
- }
- // FIXME Bug 389404: We should not accept inherit, -moz-initial,
- // or none as anything other than the first value.
- if (ParseVariant(value, VARIANT_HCK|VARIANT_NONE, nsCSSProps::kBorderColorKTable)) {
- list->mNext = new nsCSSValueList();
- list = list->mNext;
- if (list)
- list->mValue = value;
- else
- mScanner.SetLowLevelError(NS_ERROR_OUT_OF_MEMORY);
- }
- else
- break;
+ if (!ParseVariant(cur->mValue,
+ (cur == list)
+ ? (VARIANT_HCK | VARIANT_NONE)
+ : (VARIANT_COLOR | VARIANT_KEYWORD),
+ nsCSSProps::kBorderColorKTable)) {
+ break;
+ }
+ if (ExpectEndProperty()) {
+ // Only success case here, since having the failure case at the
+ // end allows more sharing of code.
+ mTempData.SetPropertyBit(aProperty);
+ *aResult = list;
+ return PR_TRUE;
+ }
+ if (cur->mValue.GetUnit() == eCSSUnit_Inherit ||
+ cur->mValue.GetUnit() == eCSSUnit_Initial ||
+ cur->mValue.GetUnit() == eCSSUnit_None) {
+ // 'inherit', 'initial', and 'none' are only allowed on their own
+ break;
}
- delete listHead;
}
+ // Have failure case at the end so we can |break| to get to it.
+ delete list;
return PR_FALSE;
}
@@ -7628,7 +7629,12 @@ CSSParserImpl::ParseTextDecoration(nsCSSValue& aValue)
PRInt32 index;
for (index = 0; index < 3; index++) {
if (ParseEnum(keyword, nsCSSProps::kTextDecorationKTable)) {
- intValue |= keyword.GetIntValue();
+ PRInt32 newValue = keyword.GetIntValue();
+ if (newValue & intValue) {
+ // duplicate keyword is not allowed
+ return PR_FALSE;
+ }
+ intValue |= newValue;
}
else {
break;
diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp
index 277c1b5b71b6..3618720bae28 100644
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -70,6 +70,10 @@ static PRInt32 gTableRefCount;
static nsStaticCaseInsensitiveNameTable* gPropertyTable;
static nsStaticCaseInsensitiveNameTable* gFontDescTable;
+/* static */ nsCSSProperty *
+ nsCSSProps::gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands];
+/* static */ nsCSSProperty* nsCSSProps::gShorthandsContainingPool = nsnull;
+
// Keep in sync with enum nsCSSFontDesc in nsCSSProperty.h.
static const char* const kCSSRawFontDescs[] = {
"font-family",
@@ -80,6 +84,23 @@ static const char* const kCSSRawFontDescs[] = {
"unicode-range"
};
+struct PropertyAndCount {
+ nsCSSProperty property;
+ PRUint32 count;
+};
+
+static int
+SortPropertyAndCount(const void* s1, const void* s2, void *closure)
+{
+ const PropertyAndCount *pc1 = static_cast(s1);
+ const PropertyAndCount *pc2 = static_cast(s2);
+ // Primary sort by count (lowest to highest)
+ if (pc1->count != pc2->count)
+ return pc1->count - pc2->count;
+ // Secondary sort by property index (highest to lowest)
+ return pc2->property - pc1->property;
+}
+
void
nsCSSProps::AddRefTable(void)
{
@@ -120,21 +141,170 @@ nsCSSProps::AddRefTable(void)
#endif
gFontDescTable->Init(kCSSRawFontDescs, eCSSFontDesc_COUNT);
}
+
+ BuildShorthandsContainingTable();
}
}
+#undef DEBUG_SHORTHANDS_CONTAINING
+
+PRBool
+nsCSSProps::BuildShorthandsContainingTable()
+{
+ PRUint32 occurrenceCounts[eCSSProperty_COUNT_no_shorthands];
+ memset(occurrenceCounts, 0, sizeof(occurrenceCounts));
+ PropertyAndCount subpropCounts[eCSSProperty_COUNT -
+ eCSSProperty_COUNT_no_shorthands];
+ for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands;
+ shorthand < eCSSProperty_COUNT;
+ shorthand = nsCSSProperty(shorthand + 1)) {
+#ifdef DEBUG_SHORTHANDS_CONTAINING
+ printf("Considering shorthand property '%s'.\n",
+ nsCSSProps::GetStringValue(shorthand).get());
+#endif
+ PropertyAndCount &subpropCountsEntry =
+ subpropCounts[shorthand - eCSSProperty_COUNT_no_shorthands];
+ subpropCountsEntry.property = shorthand;
+ subpropCountsEntry.count = 0;
+ for (const nsCSSProperty* subprops = SubpropertyEntryFor(shorthand);
+ *subprops != eCSSProperty_UNKNOWN;
+ ++subprops) {
+ NS_ASSERTION(0 < *subprops &&
+ *subprops < eCSSProperty_COUNT_no_shorthands,
+ "subproperty must be a longhand");
+ ++occurrenceCounts[*subprops];
+ ++subpropCountsEntry.count;
+ }
+ }
+
+ PRUint32 poolEntries = 0;
+ for (nsCSSProperty longhand = nsCSSProperty(0);
+ longhand < eCSSProperty_COUNT_no_shorthands;
+ longhand = nsCSSProperty(longhand + 1)) {
+ PRUint32 count = occurrenceCounts[longhand];
+ if (count > 0)
+ // leave room for terminator
+ poolEntries += count + 1;
+ }
+
+ gShorthandsContainingPool = new nsCSSProperty[poolEntries];
+ if (!gShorthandsContainingPool)
+ return PR_FALSE;
+
+ // Initialize all entries to point to their null-terminator.
+ {
+ nsCSSProperty *poolCursor = gShorthandsContainingPool - 1;
+ nsCSSProperty *lastTerminator =
+ gShorthandsContainingPool + poolEntries - 1;
+ for (nsCSSProperty longhand = nsCSSProperty(0);
+ longhand < eCSSProperty_COUNT_no_shorthands;
+ longhand = nsCSSProperty(longhand + 1)) {
+ PRUint32 count = occurrenceCounts[longhand];
+ if (count > 0) {
+ poolCursor += count + 1;
+ gShorthandsContainingTable[longhand] = poolCursor;
+ *poolCursor = eCSSProperty_UNKNOWN;
+ } else {
+ gShorthandsContainingTable[longhand] = lastTerminator;
+ }
+ }
+ NS_ASSERTION(poolCursor == lastTerminator, "miscalculation");
+ }
+
+ // Sort with lowest count at the start and highest at the end, and
+ // within counts sort in reverse property index order.
+ NS_QuickSort(&subpropCounts, NS_ARRAY_LENGTH(subpropCounts),
+ sizeof(subpropCounts[0]), SortPropertyAndCount, nsnull);
+
+ // Fill in all the entries in gShorthandsContainingTable
+ for (const PropertyAndCount *shorthandAndCount = subpropCounts,
+ *shorthandAndCountEnd =
+ subpropCounts + NS_ARRAY_LENGTH(subpropCounts);
+ shorthandAndCount < shorthandAndCountEnd;
+ ++shorthandAndCount) {
+#ifdef DEBUG_SHORTHANDS_CONTAINING
+ printf("Entering %u subprops for '%s'.\n",
+ shorthandAndCount->count,
+ nsCSSProps::GetStringValue(shorthandAndCount->property).get());
+#endif
+ for (const nsCSSProperty* subprops =
+ SubpropertyEntryFor(shorthandAndCount->property);
+ *subprops != eCSSProperty_UNKNOWN;
+ ++subprops) {
+ *(--gShorthandsContainingTable[*subprops]) = shorthandAndCount->property;
+ }
+ }
+
+#ifdef DEBUG_SHORTHANDS_CONTAINING
+ for (nsCSSProperty longhand = nsCSSProperty(0);
+ longhand < eCSSProperty_COUNT_no_shorthands;
+ longhand = nsCSSProperty(longhand + 1)) {
+ printf("Property %s is in %d shorthands.\n",
+ nsCSSProps::GetStringValue(longhand).get(),
+ occurrenceCounts[longhand]);
+ for (const nsCSSProperty *shorthands = ShorthandsContaining(longhand);
+ *shorthands != eCSSProperty_UNKNOWN;
+ ++shorthands) {
+ printf(" %s\n", nsCSSProps::GetStringValue(*shorthands).get());
+ }
+ }
+#endif
+
+#ifdef DEBUG
+ // Verify that all values that should be are present.
+ for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands;
+ shorthand < eCSSProperty_COUNT;
+ shorthand = nsCSSProperty(shorthand + 1)) {
+ for (const nsCSSProperty* subprops = SubpropertyEntryFor(shorthand);
+ *subprops != eCSSProperty_UNKNOWN;
+ ++subprops) {
+ PRUint32 count = 0;
+ for (const nsCSSProperty *shcont = ShorthandsContaining(*subprops);
+ *shcont != eCSSProperty_UNKNOWN;
+ ++shcont) {
+ if (*shcont == shorthand)
+ ++count;
+ }
+ NS_ASSERTION(count == 1, "subproperty of shorthand should have shorthand"
+ " in its ShorthandsContaining() table");
+ }
+ }
+
+ // Verify that there are no extra values
+ for (nsCSSProperty longhand = nsCSSProperty(0);
+ longhand < eCSSProperty_COUNT_no_shorthands;
+ longhand = nsCSSProperty(longhand + 1)) {
+ for (const nsCSSProperty *shorthands = ShorthandsContaining(longhand);
+ *shorthands != eCSSProperty_UNKNOWN;
+ ++shorthands) {
+ PRUint32 count = 0;
+ for (const nsCSSProperty* subprops = SubpropertyEntryFor(*shorthands);
+ *subprops != eCSSProperty_UNKNOWN;
+ ++subprops) {
+ if (*subprops == longhand)
+ ++count;
+ }
+ NS_ASSERTION(count == 1, "longhand should be in subproperty table of "
+ "property in its ShorthandsContaining() table");
+ }
+ }
+#endif
+
+ return PR_TRUE;
+}
+
void
nsCSSProps::ReleaseTable(void)
{
if (0 == --gTableRefCount) {
- if (gPropertyTable) {
- delete gPropertyTable;
- gPropertyTable = nsnull;
- }
- if (gFontDescTable) {
- delete gFontDescTable;
- gFontDescTable = nsnull;
- }
+ delete gPropertyTable;
+ gPropertyTable = nsnull;
+
+ delete gFontDescTable;
+ gFontDescTable = nsnull;
+
+ delete gShorthandsContainingPool;
+ gShorthandsContainingPool = nsnull;
}
}
@@ -1349,6 +1519,7 @@ static const nsCSSProperty gBorderSubpropTable[] = {
static const nsCSSProperty gBorderBottomSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_bottom_width,
eCSSProperty_border_bottom_style,
eCSSProperty_border_bottom_color,
@@ -1403,6 +1574,7 @@ static const nsCSSProperty gMozBorderStartColorSubpropTable[] = {
static const nsCSSProperty gMozBorderEndSubpropTable[] = {
// nsCSSDeclaration.cpp output the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_end_width_value,
eCSSProperty_border_end_style_value,
eCSSProperty_border_end_color_value,
@@ -1418,6 +1590,7 @@ static const nsCSSProperty gMozBorderEndSubpropTable[] = {
static const nsCSSProperty gBorderLeftSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_left_width_value,
eCSSProperty_border_left_style_value,
eCSSProperty_border_left_color_value,
@@ -1433,6 +1606,7 @@ static const nsCSSProperty gBorderLeftSubpropTable[] = {
static const nsCSSProperty gBorderRightSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_right_width_value,
eCSSProperty_border_right_style_value,
eCSSProperty_border_right_color_value,
@@ -1448,6 +1622,7 @@ static const nsCSSProperty gBorderRightSubpropTable[] = {
static const nsCSSProperty gMozBorderStartSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_start_width_value,
eCSSProperty_border_start_style_value,
eCSSProperty_border_start_color_value,
@@ -1509,6 +1684,7 @@ static const nsCSSProperty gMozBorderEndStyleSubpropTable[] = {
static const nsCSSProperty gBorderTopSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty_border_top_width,
eCSSProperty_border_top_style,
eCSSProperty_border_top_color,
@@ -1636,13 +1812,16 @@ static const nsCSSProperty gMozMarginEndSubpropTable[] = {
static const nsCSSProperty gOutlineSubpropTable[] = {
// nsCSSDeclaration.cpp outputs the subproperties in this order.
- eCSSProperty_outline_color,
- eCSSProperty_outline_style,
+ // It also depends on the color being third.
eCSSProperty_outline_width,
+ eCSSProperty_outline_style,
+ eCSSProperty_outline_color,
eCSSProperty_UNKNOWN
};
static const nsCSSProperty gMozColumnRuleSubpropTable[] = {
+ // nsCSSDeclaration.cpp outputs the subproperties in this order.
+ // It also depends on the color being third.
eCSSProperty__moz_column_rule_width,
eCSSProperty__moz_column_rule_style,
eCSSProperty__moz_column_rule_color,
diff --git a/layout/style/nsCSSProps.h b/layout/style/nsCSSProps.h
index 0ecbf636c4c4..7edb68684cd7 100644
--- a/layout/style/nsCSSProps.h
+++ b/layout/style/nsCSSProps.h
@@ -105,9 +105,19 @@ public:
static const nsCSSType kTypeTable[eCSSProperty_COUNT_no_shorthands];
static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
static const PRInt32* const kKeywordTableTable[eCSSProperty_COUNT_no_shorthands];
+
private:
static const PRUint32 kFlagsTable[eCSSProperty_COUNT];
+public:
+ static inline PRBool PropHasFlags(nsCSSProperty aProperty, PRUint32 aFlags)
+ {
+ NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
+ "out of range");
+ return (nsCSSProps::kFlagsTable[aProperty] & aFlags) == aFlags;
+ }
+
+private:
// A table for shorthand properties. The appropriate index is the
// property ID minus eCSSProperty_COUNT_no_shorthands.
static const nsCSSProperty *const
@@ -115,7 +125,7 @@ private:
public:
static inline
- const nsCSSProperty *const SubpropertyEntryFor(nsCSSProperty aProperty) {
+ const nsCSSProperty * SubpropertyEntryFor(nsCSSProperty aProperty) {
NS_ASSERTION(eCSSProperty_COUNT_no_shorthands <= aProperty &&
aProperty < eCSSProperty_COUNT,
"out of range");
@@ -123,10 +133,26 @@ public:
eCSSProperty_COUNT_no_shorthands];
}
- static inline PRBool PropHasFlags(nsCSSProperty aProperty, PRUint32 aFlags)
- {
- return (nsCSSProps::kFlagsTable[aProperty] & aFlags) == aFlags;
+ // Returns an eCSSProperty_UNKNOWN-terminated array of the shorthand
+ // properties containing |aProperty|, sorted from those that contain
+ // the most properties to those that contain the least.
+ static const nsCSSProperty * ShorthandsContaining(nsCSSProperty aProperty) {
+ NS_ASSERTION(gShorthandsContainingPool, "uninitialized");
+ NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT_no_shorthands,
+ "out of range");
+ return gShorthandsContainingTable[aProperty];
}
+private:
+ // gShorthandsContainingTable is an array of the return values for
+ // ShorthandsContaining (arrays of nsCSSProperty terminated by
+ // eCSSProperty_UNKNOWN) pointing into memory in
+ // gShorthandsContainingPool (which contains all of those arrays in a
+ // single allocation, and is the one pointer that should be |free|d).
+ static nsCSSProperty *gShorthandsContainingTable[eCSSProperty_COUNT_no_shorthands];
+ static nsCSSProperty* gShorthandsContainingPool;
+ static PRBool BuildShorthandsContainingTable();
+
+public:
#define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_) \
for (const nsCSSProperty* iter_ = nsCSSProps::SubpropertyEntryFor(prop_); \
diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp
index 468547d4324a..7ad89800f547 100644
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -193,11 +193,6 @@ GetColor(nsPresContext* aPresContext, nsCSSValue& aResult)
nsIDeviceContext *dx = GetDeviceContextFor(aPresContext);
PRUint32 depth;
dx->GetDepth(depth);
- // Some graphics backends may claim 32-bit depth when it's really 24
- // (because they're counting the Alpha component).
- if (depth == 32) {
- depth = 24;
- }
// The spec says to use bits *per color component*, so divide by 3,
// and round down, since the spec says to use the smallest when the
// color components differ.
diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp
index 2d41feb14ee4..acdb6fe26101 100644
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3819,17 +3819,19 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
Margin, marginData)
// -moz-box-shadow: none, list, inherit, initial
- nsCSSValueList* list = marginData.mBoxShadow;
- if (list) {
- // This handles 'none' and 'initial'
- border->mBoxShadow = nsnull;
+ {
+ nsCSSValueList* list = marginData.mBoxShadow;
+ if (list) {
+ // This handles 'none' and 'initial'
+ border->mBoxShadow = nsnull;
- if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
- inherited = PR_TRUE;
- border->mBoxShadow = parentBorder->mBoxShadow;
- } else if (eCSSUnit_Array == list->mValue.GetUnit()) {
- // List of arrays
- border->mBoxShadow = GetShadowData(list, aContext, PR_TRUE, inherited);
+ if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
+ inherited = PR_TRUE;
+ border->mBoxShadow = parentBorder->mBoxShadow;
+ } else if (eCSSUnit_Array == list->mValue.GetUnit()) {
+ // List of arrays
+ border->mBoxShadow = GetShadowData(list, aContext, PR_TRUE, inherited);
+ }
}
}
@@ -3918,7 +3920,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
}
}
- // -moz-border-*-colors: color, string, enum
+ // -moz-border-*-colors: color, string, enum, none, inherit/initial
nscolor borderColor;
nscolor unused = NS_RGB(0,0,0);
@@ -3926,17 +3928,38 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
NS_FOR_CSS_SIDES(side) {
nsCSSValueList* list =
marginData.mBorderColors.*(nsCSSValueListRect::sides[side]);
- // FIXME Bug 389404: Implement inherit and -moz-initial.
if (list) {
- // Some composite border color information has been specified for this
- // border side.
- border->EnsureBorderColors();
- border->ClearBorderColors(side);
- while (list) {
- if (SetColor(list->mValue, unused, mPresContext,
- aContext, borderColor, inherited))
- border->AppendBorderColor(side, borderColor);
- list = list->mNext;
+ if (eCSSUnit_Initial == list->mValue.GetUnit() ||
+ eCSSUnit_None == list->mValue.GetUnit()) {
+ NS_ASSERTION(!list->mNext, "should have only one item");
+ border->ClearBorderColors(side);
+ }
+ else if (eCSSUnit_Inherit == list->mValue.GetUnit()) {
+ NS_ASSERTION(!list->mNext, "should have only one item");
+ nsBorderColors *parentColors;
+ parentBorder->GetCompositeColors(side, &parentColors);
+ if (parentColors) {
+ border->EnsureBorderColors();
+ border->ClearBorderColors(side);
+ border->mBorderColors[side] = parentColors->Clone();
+ } else {
+ border->ClearBorderColors(side);
+ }
+ }
+ else {
+ // Some composite border color information has been specified for this
+ // border side.
+ border->EnsureBorderColors();
+ border->ClearBorderColors(side);
+ while (list) {
+ if (SetColor(list->mValue, unused, mPresContext,
+ aContext, borderColor, inherited))
+ border->AppendBorderColor(side, borderColor);
+ else {
+ NS_NOTREACHED("unexpected item in -moz-border-*-colors list");
+ }
+ list = list->mNext;
+ }
}
}
}
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index fcfdf961475f..c9032f628ec6 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -431,7 +431,7 @@ struct nsStyleBorder {
}
void ClearBorderColors(PRUint8 aSide) {
- if (mBorderColors[aSide]) {
+ if (mBorderColors && mBorderColors[aSide]) {
delete mBorderColors[aSide];
mBorderColors[aSide] = nsnull;
}
diff --git a/layout/style/test/Makefile.in b/layout/style/test/Makefile.in
index 5d70c94930be..556de3ba0b2d 100644
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -98,6 +98,7 @@ _TEST_FILES = test_acid3_test46.html \
test_bug437915.html \
test_bug450191.html \
test_bug453896_deck.html \
+ test_bug470769.html \
test_cascade.html \
test_compute_data_with_start_struct.html \
test_css_eof_handling.html \
@@ -117,6 +118,7 @@ _TEST_FILES = test_acid3_test46.html \
test_property_syntax_errors.html \
test_selectors.html \
test_selectors_on_anonymous_content.html \
+ test_shorthand_property_getters.html \
test_style_struct_copy_constructors.html \
test_value_computation.html \
test_value_storage.html \
diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js
index 39d03392b69d..3682f4f57722 100644
--- a/layout/style/test/property_database.js
+++ b/layout/style/test/property_database.js
@@ -109,7 +109,7 @@ var gCSSProperties = {
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "red green", "red #fc3", "#ff00cc", "currentColor", "blue currentColor orange currentColor" ],
- invalid_values: [ "red none", "red inherit", "red, green" ]
+ invalid_values: [ "red none", "red inherit", "red, green", "none red", "inherit red" ]
},
"-moz-border-end": {
domProp: "MozBorderEnd",
@@ -172,7 +172,7 @@ var gCSSProperties = {
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "red green", "red #fc3", "#ff00cc", "currentColor", "blue currentColor orange currentColor" ],
- invalid_values: [ "red none", "red inherit", "red, green" ]
+ invalid_values: [ "red none", "red inherit", "red, green", "none red", "inherit red" ]
},
"-moz-border-radius": {
domProp: "MozBorderRadius",
@@ -231,7 +231,7 @@ var gCSSProperties = {
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "red green", "red #fc3", "#ff00cc", "currentColor", "blue currentColor orange currentColor" ],
- invalid_values: [ "red none", "red inherit", "red, green" ]
+ invalid_values: [ "red none", "red inherit", "red, green", "none red", "inherit red" ]
},
"-moz-border-start": {
domProp: "MozBorderStart",
@@ -277,7 +277,7 @@ var gCSSProperties = {
type: CSS_TYPE_LONGHAND,
initial_values: [ "none" ],
other_values: [ "red green", "red #fc3", "#ff00cc", "currentColor", "blue currentColor orange currentColor" ],
- invalid_values: [ "red none", "red inherit", "red, green" ]
+ invalid_values: [ "red none", "red inherit", "red, green", "none red", "inherit red" ]
},
"-moz-box-align": {
domProp: "MozBoxAlign",
@@ -308,8 +308,8 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "1" ],
- other_values: [ "0", "-1", "100", "-1000" ],
- invalid_values: [ "1.0" ]
+ other_values: [ "0", "100" ],
+ invalid_values: [ "1.0", "-1", "-1000" ]
},
"-moz-box-orient": {
domProp: "MozBoxOrient",
@@ -1957,8 +1957,8 @@ var gCSSProperties = {
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "4" ],
- other_values: [ "1", "7", "5000" ],
- invalid_values: [ "0.9", "0", "-1", "3px" ]
+ other_values: [ "1", "7", "5000", "1.1" ],
+ invalid_values: [ "0.9", "0", "-1", "3px", "-0.3" ]
},
"stroke-opacity": {
domProp: null,
diff --git a/layout/style/test/test_bug377947.html b/layout/style/test/test_bug377947.html
index 7c5256e0ef7b..58d961efcf6a 100644
--- a/layout/style/test/test_bug377947.html
+++ b/layout/style/test/test_bug377947.html
@@ -57,8 +57,8 @@ var all_but_one = {
"font-variant": "normal",
"font-weight": "bold",
"font-size": "small",
- "font-size-adjust": "0.45",
- "font-stretch": "normal"
+ "font-size-adjust": "none", // has to be default value
+ "font-stretch": "normal" // has to be default value
};
for (var prop in all_but_one) {
s.setProperty(prop, all_but_one[prop], "");
@@ -66,6 +66,12 @@ for (var prop in all_but_one) {
is(s.getPropertyValue("font"), "",
"font shorthand should be empty when some subproperties specified");
s.setProperty("line-height", "1.5", "");
+isnot(s.getPropertyValue("font"), "",
+ "font shorthand should produce value when all subproperties set");
+s.setProperty("font-stretch", "condensed", "");
+is(s.getPropertyValue("font"), "",
+ "font shorthand should be empty when font-stretch is non-default");
+s.setProperty("font-stretch", "normal", "");
isnot(s.getPropertyValue("font"), "",
"font shorthand should produce value when all subproperties set");
s.removeProperty("font");
diff --git a/layout/style/test/test_bug470769.html b/layout/style/test/test_bug470769.html
new file mode 100644
index 000000000000..103fec9fcc13
--- /dev/null
+++ b/layout/style/test/test_bug470769.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Test for Bug 470769
+
+
+
+
+
+Mozilla Bug 470769
+
+
+
+
+
+
+
+
+
diff --git a/layout/style/test/test_inherit_computation.html b/layout/style/test/test_inherit_computation.html
index 0cdc9f5ee32e..a5ca75443b92 100644
--- a/layout/style/test/test_inherit_computation.html
+++ b/layout/style/test/test_inherit_computation.html
@@ -22,18 +22,6 @@
/** Test for computation of CSS 'inherit' **/
-var gBrokenInherit = {
- // Not implemented in nsRuleNode
- "-moz-border-bottom-colors": true,
- "-moz-border-left-colors": true,
- "-moz-border-right-colors": true,
- "-moz-border-top-colors": true,
-};
-
-function xfail_inherit(property, matching_initial) {
- return property in gBrokenInherit;
-}
-
// elements without a frame
var gNParent = document.getElementById("nparent");
var gNChild = document.getElementById("nchild");
@@ -86,23 +74,19 @@ function test_property(property)
gNChild.className="allother";
var inherit_initial_computed_n = get_computed_value_node(gNChild, property);
var inherit_initial_computed_f = get_computed_value_node(gFChild, property);
- (xfail_inherit(property, true) ? todo_is : is)(
- inherit_initial_computed_n, initial_computed_n,
+ is(inherit_initial_computed_n, initial_computed_n,
"inherit should cause inheritance of initial value for '" +
property + "'");
- (xfail_inherit(property, true) ? todo_is : is)(
- inherit_initial_computed_f, initial_computed_f,
+ is(inherit_initial_computed_f, initial_computed_f,
"inherit should cause inheritance of initial value for '" +
property + "'");
gParentRuleTop.style.setProperty(property, info.other_values[0], "");
var inherit_other_computed_n = get_computed_value_node(gNChild, property);
var inherit_other_computed_f = get_computed_value_node(gFChild, property);
- (xfail_inherit(property, false) ? todo_is : is)(
- inherit_other_computed_n, other_computed_n,
+ is(inherit_other_computed_n, other_computed_n,
"inherit should cause inheritance of other value for '" +
property + "'");
- (xfail_inherit(property, false) ? todo_is : is)(
- inherit_other_computed_f, other_computed_f,
+ is(inherit_other_computed_f, other_computed_f,
"inherit should cause inheritance of other value for '" +
property + "'");
gParentRuleTop.style.removeProperty(property);
@@ -125,24 +109,20 @@ function test_property(property)
gChildRule2.style.setProperty(property, "inherit", "");
var inherit_other_computed_n = get_computed_value_node(gNChild, property);
var inherit_other_computed_f = get_computed_value_node(gFChild, property);
- (xfail_inherit(property, false) ? todo_is : is)(
- inherit_other_computed_n, other_computed_n,
+ is(inherit_other_computed_n, other_computed_n,
"inherit should cause inheritance of other value for '" +
property + "'");
- (xfail_inherit(property, false) ? todo_is : is)(
- inherit_other_computed_f, other_computed_f,
+ is(inherit_other_computed_f, other_computed_f,
"inherit should cause inheritance of other value for '" +
property + "'");
gParentRuleTop.style.removeProperty(property);
gChildRule1.style.setProperty(property, info.other_values[0], "");
var inherit_initial_computed_n = get_computed_value_node(gNChild, property);
var inherit_initial_computed_f = get_computed_value_node(gFChild, property);
- (xfail_inherit(property, true) ? todo_is : is)(
- inherit_initial_computed_n, initial_computed_n,
+ is(inherit_initial_computed_n, initial_computed_n,
"inherit should cause inheritance of initial value for '" +
property + "'");
- (xfail_inherit(property, true) ? todo_is : is)(
- inherit_initial_computed_f, initial_computed_f,
+ is(inherit_initial_computed_f, initial_computed_f,
"inherit should cause inheritance of initial value for '" +
property + "'");
gParentRuleTop.style.removeProperty(property);
diff --git a/layout/style/test/test_inherit_storage.html b/layout/style/test/test_inherit_storage.html
index 74d391903337..d000eb34c03c 100644
--- a/layout/style/test/test_inherit_storage.html
+++ b/layout/style/test/test_inherit_storage.html
@@ -25,25 +25,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=375363
var gDeclaration = document.getElementById("testnode").style;
-var gKnownFails2 = {
- "-moz-border-end": true,
- "-moz-border-radius": true,
- "-moz-border-start": true,
- "-moz-column-rule": true,
- "-moz-outline-radius": true,
- "background": true,
- "border": true,
- "border-bottom": true,
- "border-left": true,
- "border-right": true,
- "border-top": true,
- "cue": true,
- "font": true,
- "list-style": true,
- "outline": true,
- "pause": true
-};
-
function test_property(property)
{
var info = gCSSProperties[property];
@@ -82,10 +63,7 @@ function test_property(property)
// We don't care particularly about the whitespace or the placement of
// semicolons, but for simplicity we'll test the current behavior.
- var cssTextFunc = is;
- if (property in gKnownFails2)
- cssTextFunc = todo_is;
- cssTextFunc(gDeclaration.cssText, property + ": inherit;",
+ is(gDeclaration.cssText, property + ": inherit;",
"declaration should serialize to exactly what went in (for inherit)");
gDeclaration.removeProperty(property);
diff --git a/layout/style/test/test_initial_storage.html b/layout/style/test/test_initial_storage.html
index ac85197ffcc5..15060e1e31e3 100644
--- a/layout/style/test/test_initial_storage.html
+++ b/layout/style/test/test_initial_storage.html
@@ -25,25 +25,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=375363
var gDeclaration = document.getElementById("testnode").style;
-var gKnownFails2 = {
- "-moz-border-end": true,
- "-moz-border-radius": true,
- "-moz-border-start": true,
- "-moz-column-rule": true,
- "-moz-outline-radius": true,
- "background": true,
- "border": true,
- "border-bottom": true,
- "border-left": true,
- "border-right": true,
- "border-top": true,
- "cue": true,
- "font": true,
- "list-style": true,
- "outline": true,
- "pause": true
-};
-
function test_property(property)
{
var info = gCSSProperties[property];
@@ -82,10 +63,7 @@ function test_property(property)
// We don't care particularly about the whitespace or the placement of
// semicolons, but for simplicity we'll test the current behavior.
- var cssTextFunc = is;
- if (property in gKnownFails2)
- cssTextFunc = todo_is;
- cssTextFunc(gDeclaration.cssText, property + ": -moz-initial;",
+ is(gDeclaration.cssText, property + ": -moz-initial;",
"declaration should serialize to exactly what went in (for -moz-initial)");
gDeclaration.removeProperty(property);
diff --git a/layout/style/test/test_property_syntax_errors.html b/layout/style/test/test_property_syntax_errors.html
index 6e561f2fc479..f54db56be664 100644
--- a/layout/style/test/test_property_syntax_errors.html
+++ b/layout/style/test/test_property_syntax_errors.html
@@ -22,16 +22,10 @@
var gDeclaration = document.getElementById("testnode").style;
var gKnownFails = {
- "-moz-border-bottom-colors": [ "red none", "red inherit" ],
- "-moz-border-left-colors": [ "red none", "red inherit" ],
- "-moz-border-right-colors": [ "red none", "red inherit" ],
- "-moz-border-top-colors": [ "red none", "red inherit" ],
"pitch-range": [ " -0.01", "100.2", "108", "-3" ],
"richness": [ " -0.01", "100.2", "108", "-3" ],
"stress": [ " -0.01", "100.2", "108", "-3" ],
- "volume": [ " -0.01", "100.2", "108", "-3" ],
- "text-decoration": [ "line-through blink line-through" ],
- "stroke-miterlimit": [ "0.9", "0" ]
+ "volume": [ " -0.01", "100.2", "108", "-3" ]
}
for (var property in gCSSProperties) {
diff --git a/layout/style/test/test_shorthand_property_getters.html b/layout/style/test/test_shorthand_property_getters.html
new file mode 100644
index 000000000000..574664d1ef11
--- /dev/null
+++ b/layout/style/test/test_shorthand_property_getters.html
@@ -0,0 +1,121 @@
+
+
+
+
+ Test for Bug 376075
+
+
+
+
+
+Mozilla Bug 376075
+
+
+
+
+
+
+
+
+
diff --git a/layout/style/test/test_value_storage.html b/layout/style/test/test_value_storage.html
index a5ee652be11c..7e247c2c8d00 100644
--- a/layout/style/test/test_value_storage.html
+++ b/layout/style/test/test_value_storage.html
@@ -46,17 +46,6 @@
* cserialize.
*/
-var gShorthandsWithoutCondensingSerialize = {
- "-moz-border-radius": true,
- "-moz-outline-radius": true,
- "background": true, // really there, but not complete
- "cue": true,
- "font": true,
- "list-style": true,
- "outline": true,
- "pause": true,
-};
-
var gNotAccepted = {
"-moz-column-width": [ "50%" ],
"list-style": [ "none disc outside" ],
@@ -76,11 +65,6 @@ var gBadCompute = {
"-moz-box-ordinal-group": [ "-1", "-1000" ],
};
-var gShortenableValues = {
- "border-color": [ "currentColor currentColor currentcolor CURRENTcolor" ],
- "border-style": [ "none none none none", "groove none none none", "none none double none" ],
-};
-
function xfail_accepted(property, value)
{
if (property in gNotAccepted &&
@@ -99,37 +83,6 @@ function xfail_accepted_split(property, subprop, value)
return false;
}
-function xfail_ser_val(property, value)
-{
- if (property != "font" && xfail_accepted(property, value))
- // We already failed the first test, which will make us always pass this
- // one.
- return false;
-
- if (property in gShorthandsWithoutCondensingSerialize)
- return true;
-
- // We output unneeded -moz-use-text-color only in the value getter and
- // not the serialization.
- // XXXbz is there any way we could actually filter for that, so that colors
- // other than green could be used in the property database here?
- if ((property.match(/^border(|-bottom|-left|-right|-top)$/) ||
- property.match(/^-moz-border(|-start|-end)$/)) &&
- !value.match(/(green|currentcolor)/i))
- return true;
-
- // We condense multiple values in the serialization, but not in the
- // value getter.
- if (property.match(/^(border-(color|style|width)|margin|padding)$/) &&
- value.split(" ").length != 4)
- return true;
- if (property in gShortenableValues &&
- gShortenableValues[property].indexOf(value) != -1)
- return true;
-
- return false;
-}
-
function xfail_idparseser(property, value)
{
if (property != "font" && xfail_accepted(property, value))
@@ -211,12 +164,11 @@ function test_property(property)
// We don't care particularly about the whitespace or the placement of
// semicolons, but for simplicity we'll test the current behavior.
- func = xfail_ser_val(property, value) ? todo_is : is;
var expected_serialization = "";
if (step1val != "")
expected_serialization = property + ": " + step1val + ";";
- func(step1ser, expected_serialization,
- "serialization should match property value");
+ is(step1ser, expected_serialization,
+ "serialization should match property value");
gDeclaration.removeProperty(property);
gDeclaration.setProperty(property, step1val, "");
diff --git a/layout/svg/base/src/nsSVGFilterFrame.cpp b/layout/svg/base/src/nsSVGFilterFrame.cpp
index 55a57515d3cf..13868b2eeaee 100644
--- a/layout/svg/base/src/nsSVGFilterFrame.cpp
+++ b/layout/svg/base/src/nsSVGFilterFrame.cpp
@@ -122,6 +122,8 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
PRUint16 units =
filter->mEnumAttributes[nsSVGFilterElement::FILTERUNITS].GetAnimValue();
+ PRUint16 primitiveUnits =
+ filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue();
nsCOMPtr bbox;
if (aOverrideSourceBBox) {
NS_NewSVGRect(getter_AddRefs(bbox),
@@ -130,7 +132,8 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
} else {
bbox = nsSVGUtils::GetBBox(aTarget);
}
- if (!bbox && units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
+ if (!bbox && (units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ||
+ primitiveUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX))
return;
gfxRect filterArea = nsSVGUtils::GetRelativeRect(units,
@@ -182,8 +185,6 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
MapDeviceRectToFilterSpace(finiM, filterRes, aDirtyInputRect);
// Setup instance data
- PRUint16 primitiveUnits =
- filter->mEnumAttributes[nsSVGFilterElement::PRIMITIVEUNITS].GetAnimValue();
mInstance = new nsSVGFilterInstance(aTarget, aPaint, filter, bbox, filterArea,
nsIntSize(filterRes.width, filterRes.height),
fini,
diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp
index cdab38ee8c93..25b4127a9149 100644
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -207,7 +207,7 @@ nsImageBoxFrame::Destroy()
{
// Release image loader first so that it's refcnt can go to zero
if (mImageRequest)
- mImageRequest->Cancel(NS_ERROR_FAILURE);
+ mImageRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
if (mListener)
reinterpret_cast(mListener.get())->SetFrame(nsnull); // set the frame to null so we don't send messages to a dead object.
diff --git a/layout/xul/base/src/nsPopupSetFrame.cpp b/layout/xul/base/src/nsPopupSetFrame.cpp
index 547d720a04ae..7eea4e62211a 100644
--- a/layout/xul/base/src/nsPopupSetFrame.cpp
+++ b/layout/xul/base/src/nsPopupSetFrame.cpp
@@ -77,7 +77,6 @@ nsPopupSetFrame::Init(nsIContent* aContent,
// Normally the root box is our grandparent, but in case of wrapping
// it can be our great-grandparent.
nsIRootBox *rootBox = nsIRootBox::GetRootBox(PresContext()->GetPresShell());
- NS_ASSERTION(rootBox, "must have root box");
if (rootBox) {
rootBox->SetPopupSetFrame(this);
}
@@ -148,7 +147,6 @@ nsPopupSetFrame::Destroy()
// Normally the root box is our grandparent, but in case of wrapping
// it can be our great-grandparent.
nsIRootBox *rootBox = nsIRootBox::GetRootBox(PresContext()->GetPresShell());
- NS_ASSERTION(rootBox, "must have root box");
if (rootBox) {
rootBox->SetPopupSetFrame(nsnull);
}
diff --git a/layout/xul/base/src/tree/src/crashtests/399227-1.xul b/layout/xul/base/src/tree/src/crashtests/399227-1.xul
new file mode 100644
index 000000000000..bfc381892a38
--- /dev/null
+++ b/layout/xul/base/src/tree/src/crashtests/399227-1.xul
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/xul/base/src/tree/src/crashtests/399227-2.xul b/layout/xul/base/src/tree/src/crashtests/399227-2.xul
new file mode 100644
index 000000000000..55665ec475b8
--- /dev/null
+++ b/layout/xul/base/src/tree/src/crashtests/399227-2.xul
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/layout/xul/base/src/tree/src/crashtests/crashtests.list b/layout/xul/base/src/tree/src/crashtests/crashtests.list
index decf92ebd3d3..e3c7ae0c22a1 100644
--- a/layout/xul/base/src/tree/src/crashtests/crashtests.list
+++ b/layout/xul/base/src/tree/src/crashtests/crashtests.list
@@ -4,6 +4,8 @@ load 309732-2.xul
load 366583-1.xul
load 380217-1.xul
load 393665-1.xul
+load 399227-1.xul
+load 399227-2.xul
load 399692-1.xhtml
load 399715-1.xhtml
load 409807-1.xul
diff --git a/layout/xul/base/src/tree/src/nsTreeSelection.cpp b/layout/xul/base/src/tree/src/nsTreeSelection.cpp
index 4f5ce665ce1d..19bd221d6ae5 100644
--- a/layout/xul/base/src/tree/src/nsTreeSelection.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeSelection.cpp
@@ -299,6 +299,9 @@ NS_IMETHODIMP nsTreeSelection::SetTree(nsITreeBoxObject * aTree)
NS_IMETHODIMP nsTreeSelection::GetSingle(PRBool* aSingle)
{
+ if (!mTree)
+ return NS_ERROR_NULL_POINTER;
+
nsCOMPtr boxObject = do_QueryInterface(mTree);
nsCOMPtr element;
@@ -410,8 +413,8 @@ NS_IMETHODIMP nsTreeSelection::ToggleSelect(PRInt32 aIndex)
else {
if (!mFirstRange->Contains(aIndex)) {
PRBool single;
- GetSingle(&single);
- if (!single)
+ rv = GetSingle(&single);
+ if (NS_SUCCEEDED(rv) && !single)
rv = mFirstRange->Add(aIndex);
}
else
@@ -430,7 +433,10 @@ NS_IMETHODIMP nsTreeSelection::ToggleSelect(PRInt32 aIndex)
NS_IMETHODIMP nsTreeSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aAugment)
{
PRBool single;
- GetSingle(&single);
+ nsresult rv = GetSingle(&single);
+ if (NS_FAILED(rv))
+ return rv;
+
if ((mFirstRange || (aStartIndex != aEndIndex)) && single)
return NS_OK;
@@ -452,7 +458,7 @@ NS_IMETHODIMP nsTreeSelection::RangedSelect(PRInt32 aStartIndex, PRInt32 aEndInd
}
mShiftSelectPivot = aStartIndex;
- nsresult rv = SetCurrentIndex(aEndIndex);
+ rv = SetCurrentIndex(aEndIndex);
if (NS_FAILED(rv))
return rv;
@@ -534,7 +540,10 @@ NS_IMETHODIMP nsTreeSelection::SelectAll()
PRInt32 rowCount;
view->GetRowCount(&rowCount);
PRBool single;
- GetSingle(&single);
+ nsresult rv = GetSingle(&single);
+ if (NS_FAILED(rv))
+ return rv;
+
if (rowCount == 0 || (rowCount > 1 && single))
return NS_OK;
@@ -658,6 +667,9 @@ NS_IMETHODIMP nsTreeSelection::GetCurrentColumn(nsITreeColumn** aCurrentColumn)
NS_IMETHODIMP nsTreeSelection::SetCurrentColumn(nsITreeColumn* aCurrentColumn)
{
+ if (!mTree) {
+ return NS_ERROR_UNEXPECTED;
+ }
if (mCurrentColumn == aCurrentColumn) {
return NS_OK;
}
diff --git a/media/libvorbis/README_MOZILLA b/media/libvorbis/README_MOZILLA
index 04855409a2b7..f8581995d8b4 100644
--- a/media/libvorbis/README_MOZILLA
+++ b/media/libvorbis/README_MOZILLA
@@ -9,3 +9,5 @@ file names with other Mozilla libraries.
BUG 455372 - WinCE LibVorbis No FPU Support on WinMobile, removed FPU
support for builds with WINCE defined.
+BUG 469639 - Failed to build firefox trunk on OpenSolaris
+
diff --git a/media/libvorbis/alloca.diff b/media/libvorbis/alloca.diff
new file mode 100644
index 000000000000..6e67aff9eb32
--- /dev/null
+++ b/media/libvorbis/alloca.diff
@@ -0,0 +1,14 @@
+diff -r f33a75da59bd media/libvorbis/lib/os.h
+--- a/media/libvorbis/lib/os.h Sun Dec 07 19:31:40 2008 -0800
++++ b/media/libvorbis/lib/os.h Mon Dec 15 16:26:36 2008 +0800
+@@ -25,6 +25,10 @@
+ #include
+
+ #include "misc.h"
++
++#ifdef SOLARIS
++#define HAVE_ALLOCA_H
++#endif
+
+ #ifndef _V_IFDEFJAIL_H_
+ # define _V_IFDEFJAIL_H_
diff --git a/media/libvorbis/lib/os.h b/media/libvorbis/lib/os.h
index 3c636e712a28..5bfaa7a688ca 100644
--- a/media/libvorbis/lib/os.h
+++ b/media/libvorbis/lib/os.h
@@ -26,6 +26,10 @@
#include "misc.h"
+#ifdef SOLARIS
+#define HAVE_ALLOCA_H
+#endif
+
#ifndef _V_IFDEFJAIL_H_
# define _V_IFDEFJAIL_H_
diff --git a/media/libvorbis/update.sh b/media/libvorbis/update.sh
index da8195aa0450..e3559ea39c2b 100644
--- a/media/libvorbis/update.sh
+++ b/media/libvorbis/update.sh
@@ -46,3 +46,4 @@ cp $1/todo.txt ./todo.txt
cp $1/COPYING ./COPYING
cp $1/README ./README
cp $1/AUTHORS ./AUTHORS
+patch -p3 < ./alloca.diff
diff --git a/modules/libimg/png/CHANGES b/modules/libimg/png/CHANGES
index 0b06404be2fd..3f04811b31e8 100644
--- a/modules/libimg/png/CHANGES
+++ b/modules/libimg/png/CHANGES
@@ -2186,7 +2186,7 @@ version 1.2.30beta03 [July 6, 2008]
version 1.2.30beta04 [July 10, 2008]
Merged more cosmetic whitespace changes from libpng-1.4.0beta19.
-version 1.0.38rc01, 1.2.30rc01 [August 13, 2008]
+version 1.0.38rc01, 1.2.30rc01 [December 18, 2008]
No changes.
version 1.0.38rc02, 1.2.30rc02 [July 21, 2008]
@@ -2241,6 +2241,74 @@ version 1.2.31rc03 [August 19, 2008]
version 1.0.39, 1.2.31 [August 21, 2008]
No changes.
+version 1.2.32beta01 [September 6, 2008]
+ Shortened tIME_string to 29 bytes in pngtest.c (bug introduced in
+ libpng-1.2.22).
+ Fixed off-by-one error introduced in png_push_read_zTXt() function in
+ libpng-1.2.30beta04/pngpread.c (Harald van Dijk)
+ These bugs have been given the vulnerability id CVE-2008-3964.
+
+version 1.0.40, 1.2.32 [September 18, 2008]
+ No changes.
+
+version 1.2.33beta01 [October 6, 2008]
+ Revised makefile.darwin to fix shared library numbering.
+ Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
+ in example.c (debian bug report)
+
+version 1.2.33rc01 [October 15, 2008]
+ No changes.
+
+version 1.0.41rc01, version 1.2.33rc02 [October 23, 2008]
+ Changed remaining "key" to "png_ptr->chunkdata" in png_handle_tEXt()
+ to avoid memory leak after memory failure while reading tEXt chunk.`
+
+version 1.2.33 [October 31, 2008]
+ No changes.
+
+version 1.2.34beta01 [November 27, 2008]
+ Revised png_warning() to write its message on standard output by default
+ when warning_fn is NULL. This was the behavior prior to libpng-1.2.9beta9.
+ Fixed string vs pointer-to-string error in png_check_keyword().
+ Added png_check_cHRM_fixed() in png.c and moved checking from pngget.c,
+ pngrutil.c, and pngwrite.c, and eliminated floating point cHRM checking.
+ Added check for zero-area RGB cHRM triangle in png_check_cHRM_fixed().
+ In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant
+ check for all-zero coordinates that is detected by the triangle check.
+ Revised png_warning() to write its message on standard output by default
+ when warning_fn is NULL.
+
+version 1.2.34beta02 [November 28, 2008]
+ Corrected off-by-one error in bKGD validity check in png_write_bKGD()
+ and in png_handle_bKGD().
+
+version 1.2.34beta03 [December 1, 2008]
+ Revised bKGD validity check to use >= x instead of > x + 1
+ Merged with png_debug from libpng-1.4.0 to remove newlines.
+
+version 1.2.34beta04 [December 2, 2008]
+ More merging with png_debug from libpng-1.4.0 to remove newlines.
+
+version 1.2.34beta05 [December 5, 2008]
+ Removed redundant check for key==NULL before calling png_check_keyword()
+ to ensure that new_key gets initialized and removed extra warning
+ (Arvan Pritchard).
+
+version 1.2.34beta06 [December 9, 2008]
+ In png_write_png(), respect the placement of the filler bytes in an earlier
+ call to png_set_filler() (Jim Barry).
+
+version 1.2.34beta07 [December 9, 2008]
+ Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
+ PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
+ PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
+
+version 1.0.42rc01, 1.2.34rc01 [December 11, 2008]
+ No changes.
+
+version 1.0.42, 1.2.34 [December 18, 2008]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/modules/libimg/png/LICENSE b/modules/libimg/png/LICENSE
index 54bb22d31915..4597e138f31a 100644
--- a/modules/libimg/png/LICENSE
+++ b/modules/libimg/png/LICENSE
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following
this sentence.
-libpng versions 1.2.6, August 15, 2004, through 1.2.31, August 21, 2008, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.34, December 18, 2008, are
Copyright (c) 2004, 2006-2008 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
@@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-August 21, 2008
+December 18, 2008
diff --git a/modules/libimg/png/README b/modules/libimg/png/README
index fb7021ae4798..3dd92f41f7b9 100644
--- a/modules/libimg/png/README
+++ b/modules/libimg/png/README
@@ -1,4 +1,4 @@
-README for libpng version 1.2.31 - August 21, 2008 (shared library 12.0)
+README for libpng version 1.2.34 - December 18, 2008 (shared library 12.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@@ -194,11 +194,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.31)
+ gcc, creates libpng12.so.0.1.2.34)
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.31)
+ (gcc, creates libpng12.so.0.1.2.34)
makefile.gcmmx => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.31,
+ (gcc, creates libpng12.so.0.1.2.34,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@@ -220,12 +220,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
- (gcc, creates libpng12.so.0.1.2.31)
+ (gcc, creates libpng12.so.0.1.2.34)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.31)
+ (gcc, creates libpng12.so.0.1.2.34)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.31)
+ (gcc, creates libpng12.so.0.1.2.34)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
diff --git a/modules/libimg/png/libpng.txt b/modules/libimg/png/libpng.txt
index 307bdaed5afc..f9921aaa6030 100644
--- a/modules/libimg/png/libpng.txt
+++ b/modules/libimg/png/libpng.txt
@@ -1,15 +1,15 @@
-libpng.txt - A description on how to use and modify libpng
-
- libpng version 1.2.31 - August 21, 2008
+ libpng.txt - A description on how to use and modify libpng
+
+ libpng version 1.2.34 - December 18, 2008
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2008 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h.
-
+
Based on:
-
- libpng versions 0.97, January 1998, through 1.2.31 - August 21, 2008
+
+ libpng versions 0.97, January 1998, through 1.2.34 - December 18, 2008
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2008 Glenn Randers-Pehrson
diff --git a/modules/libimg/png/png.c b/modules/libimg/png/png.c
index ef19d86d9cdf..ae78dd379002 100644
--- a/modules/libimg/png/png.c
+++ b/modules/libimg/png/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.2.30 [August 13, 2008]
+ * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -13,7 +13,7 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_31 Your_png_h_is_not_version_1_2_31;
+typedef version_1_2_34 Your_png_h_is_not_version_1_2_34;
/* Version information for C files. This had better match the version
* string defined in png.h. */
@@ -96,7 +96,7 @@ void PNGAPI
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
{
if (png_ptr == NULL) return;
- png_debug(1, "in png_set_sig_bytes\n");
+ png_debug(1, "in png_set_sig_bytes");
if (num_bytes > 8)
png_error(png_ptr, "Too many bytes for PNG signature.");
@@ -243,7 +243,7 @@ png_create_info_struct(png_structp png_ptr)
{
png_infop info_ptr;
- png_debug(1, "in png_create_info_struct\n");
+ png_debug(1, "in png_create_info_struct");
if (png_ptr == NULL) return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
@@ -268,7 +268,7 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
png_infop info_ptr = NULL;
if (png_ptr == NULL) return;
- png_debug(1, "in png_destroy_info_struct\n");
+ png_debug(1, "in png_destroy_info_struct");
if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr;
@@ -307,7 +307,7 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
if (info_ptr == NULL) return;
- png_debug(1, "in png_info_init_3\n");
+ png_debug(1, "in png_info_init_3");
if (png_sizeof(png_info) > png_info_struct_size)
{
@@ -325,7 +325,7 @@ void PNGAPI
png_data_freer(png_structp png_ptr, png_infop info_ptr,
int freer, png_uint_32 mask)
{
- png_debug(1, "in png_data_freer\n");
+ png_debug(1, "in png_data_freer");
if (png_ptr == NULL || info_ptr == NULL)
return;
if (freer == PNG_DESTROY_WILL_FREE_DATA)
@@ -342,7 +342,7 @@ void PNGAPI
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
int num)
{
- png_debug(1, "in png_free_data\n");
+ png_debug(1, "in png_free_data");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -596,7 +596,7 @@ if (mask & PNG_FREE_ROWS)
void /* PRIVATE */
png_info_destroy(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_info_destroy\n");
+ png_debug(1, "in png_info_destroy");
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
@@ -635,7 +635,7 @@ png_get_io_ptr(png_structp png_ptr)
void PNGAPI
png_init_io(png_structp png_ptr, png_FILE_p fp)
{
- png_debug(1, "in png_init_io\n");
+ png_debug(1, "in png_init_io");
if (png_ptr == NULL) return;
png_ptr->io_ptr = (png_voidp)fp;
}
@@ -697,7 +697,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
- return ((png_charp) "\n libpng version 1.2.31 - August 21, 2008\n\
+ return ((png_charp) "\n libpng version 1.2.34 - December 18, 2008\n\
Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
@@ -799,4 +799,116 @@ png_convert_size(size_t size)
return ((png_size_t)size);
}
#endif /* PNG_SIZE_T */
+
+/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
+#if defined(PNG_cHRM_SUPPORTED)
+#if !defined(PNG_NO_CHECK_cHRM)
+/*
+ Multiply two 32-bit numbers, V1 and V2, using 32-bit
+ arithmetic, to produce a 64 bit result in the HI/LO words.
+
+ A B
+ x C D
+ ------
+ AD || BD
+AC || CB || 0
+
+ where A and B are the high and low 16-bit words of V1,
+ C and D are the 16-bit words of V2, AD is the product of
+ A and D, and X || Y is (X << 16) + Y.
+*/
+
+void png_64bit_product (long v1, long v2, unsigned long *hi_product,
+ unsigned long *lo_product)
+{
+ int a, b, c, d;
+ long lo, hi, x, y;
+
+ a = (v1 >> 16) & 0xffff;
+ b = v1 & 0xffff;
+ c = (v2 >> 16) & 0xffff;
+ d = v2 & 0xffff;
+
+ lo = b * d; /* BD */
+ x = a * d + c * b; /* AD + CB */
+ y = ((lo >> 16) & 0xffff) + x;
+
+ lo = (lo & 0xffff) | ((y & 0xffff) << 16);
+ hi = (y >> 16) & 0xffff;
+
+ hi += a * c; /* AC */
+
+ *hi_product = (unsigned long)hi;
+ *lo_product = (unsigned long)lo;
+}
+int /* private */
+png_check_cHRM_fixed(png_structp png_ptr,
+ png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
+ png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
+ png_fixed_point blue_x, png_fixed_point blue_y)
+{
+ int ret = 1;
+ unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
+
+ png_debug(1, "in function png_check_cHRM_fixed");
+ if (png_ptr == NULL)
+ return 0;
+
+ if (white_x < 0 || white_y <= 0 ||
+ red_x < 0 || red_y < 0 ||
+ green_x < 0 || green_y < 0 ||
+ blue_x < 0 || blue_y < 0)
+ {
+ png_warning(png_ptr,
+ "Ignoring attempt to set negative chromaticity value");
+ ret = 0;
+ }
+ if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
+ white_y > (png_fixed_point) PNG_UINT_31_MAX ||
+ red_x > (png_fixed_point) PNG_UINT_31_MAX ||
+ red_y > (png_fixed_point) PNG_UINT_31_MAX ||
+ green_x > (png_fixed_point) PNG_UINT_31_MAX ||
+ green_y > (png_fixed_point) PNG_UINT_31_MAX ||
+ blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
+ blue_y > (png_fixed_point) PNG_UINT_31_MAX )
+ {
+ png_warning(png_ptr,
+ "Ignoring attempt to set chromaticity value exceeding 21474.83");
+ ret = 0;
+ }
+ if (white_x > 100000L - white_y)
+ {
+ png_warning(png_ptr, "Invalid cHRM white point");
+ ret = 0;
+ }
+ if (red_x > 100000L - red_y)
+ {
+ png_warning(png_ptr, "Invalid cHRM red point");
+ ret = 0;
+ }
+ if (green_x > 100000L - green_y)
+ {
+ png_warning(png_ptr, "Invalid cHRM green point");
+ ret = 0;
+ }
+ if (blue_x > 100000L - blue_y)
+ {
+ png_warning(png_ptr, "Invalid cHRM blue point");
+ ret = 0;
+ }
+
+ png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
+ png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);
+
+ if (xy_hi == yx_hi && xy_lo == yx_lo)
+ {
+ png_warning(png_ptr,
+ "Ignoring attempt to set cHRM RGB triangle with zero area");
+ ret = 0;
+ }
+
+ return ret;
+}
+#endif /* NO_PNG_CHECK_cHRM */
+#endif /* PNG_cHRM_SUPPORTED */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
diff --git a/modules/libimg/png/png.h b/modules/libimg/png/png.h
index 0f395c49ff8f..b9bee0b1789a 100644
--- a/modules/libimg/png/png.h
+++ b/modules/libimg/png/png.h
@@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.31 - August 21, 2008
+ * libpng version 1.2.34 - December 18, 2008
* Copyright (c) 1998-2008 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.)
@@ -8,7 +8,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.2.31 - August 21, 2008: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.34 - December 18, 2008: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -202,6 +202,21 @@
* 1.2.31rc01-03 13 10231 12.so.0.31[.0]
* 1.0.39 10 10039 10.so.0.39[.0]
* 1.2.31 13 10231 12.so.0.31[.0]
+ * 1.2.32beta01-02 13 10232 12.so.0.32[.0]
+ * 1.0.40rc01 10 10040 10.so.0.40[.0]
+ * 1.2.32rc01 13 10232 12.so.0.32[.0]
+ * 1.0.40 10 10040 10.so.0.40[.0]
+ * 1.2.32 13 10232 12.so.0.32[.0]
+ * 1.2.33beta01-02 13 10233 12.so.0.33[.0]
+ * 1.2.33rc01-02 13 10233 12.so.0.33[.0]
+ * 1.0.41rc01 10 10041 10.so.0.41[.0]
+ * 1.2.33 13 10233 12.so.0.33[.0]
+ * 1.0.41 10 10041 10.so.0.41[.0]
+ * 1.2.34beta01-07 13 10234 12.so.0.34[.0]
+ * 1.0.42rc01 10 10042 10.so.0.42[.0]
+ * 1.2.34rc01 13 10234 12.so.0.34[.0]
+ * 1.0.42 10 10042 10.so.0.42[.0]
+ * 1.2.34 13 10234 12.so.0.34[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -231,7 +246,7 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.31, August 21, 2008, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.34, December 18, 2008, are
* Copyright (c) 2004, 2006-2008 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:
@@ -343,13 +358,13 @@
* Y2K compliance in libpng:
* =========================
*
- * August 21, 2008
+ * December 18, 2008
*
* 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.2.31 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.34 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -405,9 +420,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.31"
+#define PNG_LIBPNG_VER_STRING "1.2.34"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.31 - August 21, 2008\n"
+ " libpng version 1.2.34 - December 18, 2008\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -415,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 2
-#define PNG_LIBPNG_VER_RELEASE 31
+#define PNG_LIBPNG_VER_RELEASE 34
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@@ -443,7 +458,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* 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 10231 /* 1.2.31 */
+#define PNG_LIBPNG_VER 10234 /* 1.2.34 */
#ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */
@@ -1163,7 +1178,10 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
-#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
+#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only, deprecated */
+/* Added to libpng-1.2.34 */
+#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* WRITE only */
+#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1516,7 +1534,7 @@ struct png_struct_def
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef png_structp version_1_2_31;
+typedef png_structp version_1_2_34;
typedef png_struct FAR * FAR * png_structpp;
@@ -2638,33 +2656,80 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include
#if (PNG_DEBUG > 1)
-#define png_debug(l,m) _RPT0(_CRT_WARN,m)
-#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1)
-#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2)
+#ifndef _DEBUG
+# define _DEBUG
+#endif
+#ifndef png_debug
+#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
+#endif
+#ifndef png_debug1
+#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
+#endif
+#ifndef png_debug2
+#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
+#endif
#endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */
#if (PNG_DEBUG > 1)
+#ifndef png_debug
+/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
+ * non-ISO compilers */
+#ifdef __STDC__
#define png_debug(l,m) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
}
+#endif
+#ifndef png_debug1
#define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
}
+#endif
+#ifndef png_debug2
#define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
}
+#endif
+#else /* __STDC __ */
+#ifndef png_debug
+#define png_debug(l,m) \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format);
+#endif
+#ifndef png_debug1
+#define png_debug1(l,m,p1) \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format,p1);
+#endif
+#ifndef png_debug2
+#define png_debug2(l,m,p1,p2) \
+ int num_tabs=l; \
+ char format[256]; \
+ snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
+ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
+ m,PNG_STRING_NEWLINE); \
+ fprintf(PNG_DEBUG_FILE,format,p1,p2);
+#endif
+#endif /* __STDC __ */
#endif /* (PNG_DEBUG > 1) */
#endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */
@@ -3741,6 +3806,15 @@ png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
+/* Added at libpng version 1.2.34 */
+#if defined(PNG_cHRM_SUPPORTED)
+PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
+ png_fixed_point int_white_x, png_fixed_point int_white_y,
+ png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
+ int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
+ png_fixed_point int_blue_y));
+#endif
+
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */
diff --git a/modules/libimg/png/pngconf.h b/modules/libimg/png/pngconf.h
index ce205f80c351..e47d53c3595e 100644
--- a/modules/libimg/png/pngconf.h
+++ b/modules/libimg/png/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.31 - August 21, 2008
+ * libpng version 1.2.34 - December 18, 2008
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -800,6 +800,12 @@
# define PNG_USER_HEIGHT_MAX 1000000L
#endif
+
+/* Added at libpng-1.2.34 and 1.4.0 */
+#ifndef PNG_STRING_NEWLINE
+#define PNG_STRING_NEWLINE "\n"
+#endif
+
/* These are currently experimental features, define them if you want */
/* very little testing */
diff --git a/modules/libimg/png/pngerror.c b/modules/libimg/png/pngerror.c
index ec4661f587cb..765217196ba3 100644
--- a/modules/libimg/png/pngerror.c
+++ b/modules/libimg/png/pngerror.c
@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.2.30 [August 13, 2008]
+ * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -116,9 +116,9 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
break;
}
}
- if (png_ptr != NULL && png_ptr->warning_fn != NULL)
- (*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
}
+ if (png_ptr != NULL && png_ptr->warning_fn != NULL)
+ (*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
else
png_default_warning(png_ptr, warning_message + offset);
}
diff --git a/modules/libimg/png/pngget.c b/modules/libimg/png/pngget.c
index eba36d66c62a..f9bb43da937e 100644
--- a/modules/libimg/png/pngget.c
+++ b/modules/libimg/png/pngget.c
@@ -120,7 +120,7 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter");
+ png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else return (info_ptr->x_pixels_per_unit);
@@ -138,7 +138,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter");
+ png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else return (info_ptr->y_pixels_per_unit);
@@ -156,7 +156,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter");
+ png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0);
@@ -176,7 +176,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio");
+ png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0);
else
@@ -197,7 +197,7 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
+ png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else return (info_ptr->x_offset);
@@ -215,7 +215,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
+ png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else return (info_ptr->y_offset);
@@ -233,7 +233,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns");
+ png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else return (info_ptr->x_offset);
@@ -251,7 +251,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs)
{
- png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns");
+ png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else return (info_ptr->y_offset);
@@ -307,7 +307,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
- png_debug1(1, "in %s retrieval function\n", "pHYs");
+ png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL)
{
*res_x = info_ptr->x_pixels_per_unit;
@@ -364,7 +364,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
&& background != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "bKGD");
+ png_debug1(1, "in %s retrieval function", "bKGD");
*background = &(info_ptr->background);
return (PNG_INFO_bKGD);
}
@@ -381,7 +381,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
- png_debug1(1, "in %s retrieval function\n", "cHRM");
+ png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL)
*white_x = (double)info_ptr->x_white;
if (white_y != NULL)
@@ -412,7 +412,7 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
- png_debug1(1, "in %s retrieval function\n", "cHRM");
+ png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL)
*white_x = info_ptr->int_x_white;
if (white_y != NULL)
@@ -444,7 +444,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "gAMA");
+ png_debug1(1, "in %s retrieval function", "gAMA");
*file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA);
}
@@ -459,7 +459,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "gAMA");
+ png_debug1(1, "in %s retrieval function", "gAMA");
*int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA);
}
@@ -475,7 +475,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "sRGB");
+ png_debug1(1, "in %s retrieval function", "sRGB");
*file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB);
}
@@ -492,7 +492,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "iCCP");
+ png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
/* compression_type is a dummy so the API won't have to change
@@ -526,7 +526,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "hIST");
+ png_debug1(1, "in %s retrieval function", "hIST");
*hist = info_ptr->hist;
return (PNG_INFO_hIST);
}
@@ -544,7 +544,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
bit_depth != NULL && color_type != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "IHDR");
+ png_debug1(1, "in %s retrieval function", "IHDR");
*width = info_ptr->width;
*height = info_ptr->height;
*bit_depth = info_ptr->bit_depth;
@@ -588,7 +588,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "oFFs");
+ png_debug1(1, "in %s retrieval function", "oFFs");
*offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type;
@@ -608,7 +608,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "pCAL");
+ png_debug1(1, "in %s retrieval function", "pCAL");
*purpose = info_ptr->pcal_purpose;
*X0 = info_ptr->pcal_X0;
*X1 = info_ptr->pcal_X1;
@@ -668,7 +668,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs))
{
- png_debug1(1, "in %s retrieval function\n", "pHYs");
+ png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL)
{
*res_x = info_ptr->x_pixels_per_unit;
@@ -696,10 +696,10 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "PLTE");
+ png_debug1(1, "in %s retrieval function", "PLTE");
*palette = info_ptr->palette;
*num_palette = info_ptr->num_palette;
- png_debug1(3, "num_palette = %d\n", *num_palette);
+ png_debug1(3, "num_palette = %d", *num_palette);
return (PNG_INFO_PLTE);
}
return (0);
@@ -712,7 +712,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "sBIT");
+ png_debug1(1, "in %s retrieval function", "sBIT");
*sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT);
}
@@ -727,7 +727,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
{
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
{
- png_debug1(1, "in %s retrieval function\n",
+ png_debug1(1, "in %s retrieval function",
(png_ptr->chunk_name[0] == '\0' ? "text"
: (png_const_charp)png_ptr->chunk_name));
if (text_ptr != NULL)
@@ -749,7 +749,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL)
{
- png_debug1(1, "in %s retrieval function\n", "tIME");
+ png_debug1(1, "in %s retrieval function", "tIME");
*mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME);
}
@@ -765,7 +765,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
{
- png_debug1(1, "in %s retrieval function\n", "tRNS");
+ png_debug1(1, "in %s retrieval function", "tRNS");
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
if (trans != NULL)
@@ -801,7 +801,7 @@ png_uint_32 PNGAPI
png_get_acTL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *num_frames, png_uint_32 *num_plays)
{
- png_debug1(1, "in %s retrieval function\n", "acTL");
+ png_debug1(1, "in %s retrieval function", "acTL");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_acTL) &&
@@ -818,7 +818,7 @@ png_get_acTL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 PNGAPI
png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_num_frames()\n");
+ png_debug(1, "in png_get_num_frames()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->num_frames);
@@ -828,7 +828,7 @@ png_get_num_frames(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI
png_get_num_plays(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_num_plays()\n");
+ png_debug(1, "in png_get_num_plays()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->num_plays);
@@ -842,7 +842,7 @@ png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
png_uint_16 *delay_num, png_uint_16 *delay_den,
png_byte *dispose_op, png_byte *blend_op)
{
- png_debug1(1, "in %s retrieval function\n", "fcTL");
+ png_debug1(1, "in %s retrieval function", "fcTL");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_fcTL) &&
@@ -868,7 +868,7 @@ png_get_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 PNGAPI
png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_width()\n");
+ png_debug(1, "in png_get_next_frame_width()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_width);
@@ -878,7 +878,7 @@ png_get_next_frame_width(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI
png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_height()\n");
+ png_debug(1, "in png_get_next_frame_height()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_height);
@@ -888,7 +888,7 @@ png_get_next_frame_height(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI
png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_x_offset()\n");
+ png_debug(1, "in png_get_next_frame_x_offset()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_x_offset);
@@ -898,7 +898,7 @@ png_get_next_frame_x_offset(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI
png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_y_offset()\n");
+ png_debug(1, "in png_get_next_frame_y_offset()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_y_offset);
@@ -908,7 +908,7 @@ png_get_next_frame_y_offset(png_structp png_ptr, png_infop info_ptr)
png_uint_16 PNGAPI
png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_delay_num()\n");
+ png_debug(1, "in png_get_next_frame_delay_num()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_delay_num);
@@ -918,7 +918,7 @@ png_get_next_frame_delay_num(png_structp png_ptr, png_infop info_ptr)
png_uint_16 PNGAPI
png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_delay_den()\n");
+ png_debug(1, "in png_get_next_frame_delay_den()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_delay_den);
@@ -928,7 +928,7 @@ png_get_next_frame_delay_den(png_structp png_ptr, png_infop info_ptr)
png_byte PNGAPI
png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_dispose_op()\n");
+ png_debug(1, "in png_get_next_frame_dispose_op()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_dispose_op);
@@ -938,7 +938,7 @@ png_get_next_frame_dispose_op(png_structp png_ptr, png_infop info_ptr)
png_byte PNGAPI
png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_get_next_frame_blend_op()\n");
+ png_debug(1, "in png_get_next_frame_blend_op()");
if (png_ptr != NULL && info_ptr != NULL)
return (info_ptr->next_frame_blend_op);
@@ -948,7 +948,7 @@ png_get_next_frame_blend_op(png_structp png_ptr, png_infop info_ptr)
png_byte PNGAPI
png_get_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_first_frame_is_hidden()\n");
+ png_debug(1, "in png_first_frame_is_hidden()");
if (png_ptr != NULL)
return (png_byte)(png_ptr->apng_flags & PNG_FIRST_FRAME_HIDDEN);
diff --git a/modules/libimg/png/pngpread.c b/modules/libimg/png/pngpread.c
index fe038aa87fbf..2f5c0cec00a7 100644
--- a/modules/libimg/png/pngpread.c
+++ b/modules/libimg/png/pngpread.c
@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.2.30 [August 13, 2008]
+ * Last changed in libpng 1.2.32 [September 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1463,7 +1463,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size +
(png_uint_32)(png_ptr->zbuf_size
- - png_ptr->zstream.avail_out));
+ - png_ptr->zstream.avail_out + 1));
png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf,
diff --git a/modules/libimg/png/pngread.c b/modules/libimg/png/pngread.c
index d266d7cead6f..e964e3e295cd 100644
--- a/modules/libimg/png/pngread.c
+++ b/modules/libimg/png/pngread.c
@@ -47,7 +47,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
int i;
- png_debug(1, "in png_create_read_struct\n");
+ png_debug(1, "in png_create_read_struct");
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -263,7 +263,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
}
} while (png_libpng_ver[i++]);
- png_debug(1, "in png_read_init_3\n");
+ png_debug(1, "in png_read_init_3");
#ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */
@@ -327,7 +327,7 @@ void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr == NULL || info_ptr == NULL) return;
- png_debug(1, "in png_read_info\n");
+ png_debug(1, "in png_read_info");
/* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8)
{
@@ -550,7 +550,7 @@ png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
{
png_byte have_chunk_after_DAT; /* after IDAT or after fdAT */
- png_debug(0, "Reading frame head\n");
+ png_debug(0, "Reading frame head");
if (!(png_ptr->mode & PNG_HAVE_acTL))
png_error(png_ptr, "attempt to png_read_frame_head() but "
@@ -625,7 +625,7 @@ png_read_frame_head(png_structp png_ptr, png_infop info_ptr)
void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_read_update_info\n");
+ png_debug(1, "in png_read_update_info");
if (png_ptr == NULL) return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
@@ -645,7 +645,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI
png_start_read_image(png_structp png_ptr)
{
- png_debug(1, "in png_start_read_image\n");
+ png_debug(1, "in png_start_read_image");
if (png_ptr == NULL) return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
@@ -668,7 +668,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
#endif
int ret;
if (png_ptr == NULL) return;
- png_debug2(1, "in png_read_row (row %lu, pass %d)\n",
+ png_debug2(1, "in png_read_row (row %lu, pass %d)",
png_ptr->row_number, png_ptr->pass);
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
@@ -949,7 +949,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp rp;
png_bytepp dp;
- png_debug(1, "in png_read_rows\n");
+ png_debug(1, "in png_read_rows");
if (png_ptr == NULL) return;
rp = row;
dp = display_row;
@@ -998,7 +998,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
int pass, j;
png_bytepp rp;
- png_debug(1, "in png_read_image\n");
+ png_debug(1, "in png_read_image");
if (png_ptr == NULL) return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
@@ -1034,7 +1034,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_read_end\n");
+ png_debug(1, "in png_read_end");
if (png_ptr == NULL) return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
@@ -1227,7 +1227,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_voidp mem_ptr = NULL;
#endif
- png_debug(1, "in png_destroy_read_struct\n");
+ png_debug(1, "in png_destroy_read_struct");
if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr;
if (png_ptr == NULL)
@@ -1301,7 +1301,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free_ptr free_fn;
#endif
- png_debug(1, "in png_read_destroy\n");
+ png_debug(1, "in png_read_destroy");
if (info_ptr != NULL)
png_info_destroy(png_ptr, info_ptr);
diff --git a/modules/libimg/png/pngrio.c b/modules/libimg/png/pngrio.c
index d1029435a683..34605ff9e3ed 100644
--- a/modules/libimg/png/pngrio.c
+++ b/modules/libimg/png/pngrio.c
@@ -27,7 +27,7 @@
void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
- png_debug1(4, "reading %d bytes\n", (int)length);
+ png_debug1(4, "reading %d bytes", (int)length);
if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length);
else
diff --git a/modules/libimg/png/pngrtran.c b/modules/libimg/png/pngrtran.c
index bfb77f77abba..f38927596948 100644
--- a/modules/libimg/png/pngrtran.c
+++ b/modules/libimg/png/pngrtran.c
@@ -21,7 +21,7 @@
void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{
- png_debug(1, "in png_set_crc_action\n");
+ png_debug(1, "in png_set_crc_action");
/* Tell libpng how we react to CRC errors in critical chunks */
if (png_ptr == NULL) return;
switch (crit_action)
@@ -80,7 +80,7 @@ png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)
{
- png_debug(1, "in png_set_background\n");
+ png_debug(1, "in png_set_background");
if (png_ptr == NULL) return;
if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
{
@@ -102,7 +102,7 @@ png_set_background(png_structp png_ptr,
void PNGAPI
png_set_strip_16(png_structp png_ptr)
{
- png_debug(1, "in png_set_strip_16\n");
+ png_debug(1, "in png_set_strip_16");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_16_TO_8;
}
@@ -112,7 +112,7 @@ png_set_strip_16(png_structp png_ptr)
void PNGAPI
png_set_strip_alpha(png_structp png_ptr)
{
- png_debug(1, "in png_set_strip_alpha\n");
+ png_debug(1, "in png_set_strip_alpha");
if (png_ptr == NULL) return;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
}
@@ -142,7 +142,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_uint_16p histogram,
int full_dither)
{
- png_debug(1, "in png_set_dither\n");
+ png_debug(1, "in png_set_dither");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_DITHER;
@@ -526,7 +526,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{
- png_debug(1, "in png_set_gamma\n");
+ png_debug(1, "in png_set_gamma");
if (png_ptr == NULL) return;
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
@@ -545,7 +545,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
void PNGAPI
png_set_expand(png_structp png_ptr)
{
- png_debug(1, "in png_set_expand\n");
+ png_debug(1, "in png_set_expand");
if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
@@ -572,7 +572,7 @@ png_set_expand(png_structp png_ptr)
void PNGAPI
png_set_palette_to_rgb(png_structp png_ptr)
{
- png_debug(1, "in png_set_palette_to_rgb\n");
+ png_debug(1, "in png_set_palette_to_rgb");
if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
@@ -583,7 +583,7 @@ png_set_palette_to_rgb(png_structp png_ptr)
void PNGAPI
png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
{
- png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
+ png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_EXPAND;
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
@@ -596,7 +596,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
void PNGAPI
png_set_gray_1_2_4_to_8(png_structp png_ptr)
{
- png_debug(1, "in png_set_gray_1_2_4_to_8\n");
+ png_debug(1, "in png_set_gray_1_2_4_to_8");
if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
}
@@ -607,7 +607,7 @@ png_set_gray_1_2_4_to_8(png_structp png_ptr)
void PNGAPI
png_set_tRNS_to_alpha(png_structp png_ptr)
{
- png_debug(1, "in png_set_tRNS_to_alpha\n");
+ png_debug(1, "in png_set_tRNS_to_alpha");
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
@@ -617,7 +617,7 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr)
{
- png_debug(1, "in png_set_gray_to_rgb\n");
+ png_debug(1, "in png_set_gray_to_rgb");
png_ptr->transformations |= PNG_GRAY_TO_RGB;
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
@@ -644,7 +644,7 @@ void PNGAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green)
{
- png_debug(1, "in png_set_rgb_to_gray\n");
+ png_debug(1, "in png_set_rgb_to_gray");
if (png_ptr == NULL) return;
switch(error_action)
{
@@ -697,7 +697,7 @@ void PNGAPI
png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
read_user_transform_fn)
{
- png_debug(1, "in png_set_read_user_transform_fn\n");
+ png_debug(1, "in png_set_read_user_transform_fn");
if (png_ptr == NULL) return;
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_ptr->transformations |= PNG_USER_TRANSFORM;
@@ -717,7 +717,7 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr)
{
- png_debug(1, "in png_init_read_transformations\n");
+ png_debug(1, "in png_init_read_transformations");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (png_ptr != NULL)
#endif
@@ -1124,7 +1124,7 @@ png_init_read_transformations(png_structp png_ptr)
void /* PRIVATE */
png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_read_transform_info\n");
+ png_debug(1, "in png_read_transform_info");
#if defined(PNG_READ_EXPAND_SUPPORTED)
if (png_ptr->transformations & PNG_EXPAND)
{
@@ -1268,7 +1268,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr)
{
- png_debug(1, "in png_do_read_transformations\n");
+ png_debug(1, "in png_do_read_transformations");
if (png_ptr->row_buf == NULL)
{
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
@@ -1514,7 +1514,7 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
void /* PRIVATE */
png_do_unpack(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_unpack\n");
+ png_debug(1, "in png_do_unpack");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && row_info->bit_depth < 8)
#else
@@ -1604,7 +1604,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
{
- png_debug(1, "in png_do_unshift\n");
+ png_debug(1, "in png_do_unshift");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && sig_bits != NULL &&
@@ -1710,7 +1710,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_chop\n");
+ png_debug(1, "in png_do_chop");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && row_info->bit_depth == 16)
#else
@@ -1764,7 +1764,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_read_swap_alpha\n");
+ png_debug(1, "in png_do_read_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -1856,7 +1856,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_read_invert_alpha\n");
+ png_debug(1, "in png_do_read_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -1962,7 +1962,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
png_byte lo_filler = (png_byte)(filler & 0xff);
- png_debug(1, "in png_do_read_filler\n");
+ png_debug(1, "in png_do_read_filler");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -2134,7 +2134,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
png_uint_32 i;
png_uint_32 row_width = row_info->width;
- png_debug(1, "in png_do_gray_to_rgb\n");
+ png_debug(1, "in png_do_gray_to_rgb");
if (row_info->bit_depth >= 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -2240,7 +2240,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
png_uint_32 row_width = row_info->width;
int rgb_error = 0;
- png_debug(1, "in png_do_rgb_to_gray\n");
+ png_debug(1, "in png_do_rgb_to_gray");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -2478,7 +2478,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
int i;
int v;
- png_debug(1, "in png_do_build_grayscale_palette\n");
+ png_debug(1, "in png_do_build_grayscale_palette");
if (palette == NULL)
return;
@@ -2520,7 +2520,7 @@ void /* PRIVATE */
png_correct_palette(png_structp png_ptr, png_colorp palette,
int num_palette)
{
- png_debug(1, "in png_correct_palette\n");
+ png_debug(1, "in png_correct_palette");
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND))
@@ -2717,7 +2717,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
int shift;
- png_debug(1, "in png_do_background\n");
+ png_debug(1, "in png_do_background");
if (background != NULL &&
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -3399,7 +3399,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width=row_info->width;
- png_debug(1, "in png_do_gamma\n");
+ png_debug(1, "in png_do_gamma");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -3581,7 +3581,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width=row_info->width;
- png_debug(1, "in png_do_expand_palette\n");
+ png_debug(1, "in png_do_expand_palette");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -3724,7 +3724,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width=row_info->width;
- png_debug(1, "in png_do_expand\n");
+ png_debug(1, "in png_do_expand");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -3930,7 +3930,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width=row_info->width;
- png_debug(1, "in png_do_dither\n");
+ png_debug(1, "in png_do_dither");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -4025,7 +4025,7 @@ static PNG_CONST int png_gamma_shift[] =
void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr)
{
- png_debug(1, "in png_build_gamma_table\n");
+ png_debug(1, "in png_build_gamma_table");
if (png_ptr->bit_depth <= 8)
{
@@ -4238,7 +4238,7 @@ png_build_gamma_table(png_structp png_ptr)
void /* PRIVATE */
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_read_intrapixel\n");
+ png_debug(1, "in png_do_read_intrapixel");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
diff --git a/modules/libimg/png/pngrutil.c b/modules/libimg/png/pngrutil.c
index 3ef3253e226e..58ae8f93dd0b 100644
--- a/modules/libimg/png/pngrutil.c
+++ b/modules/libimg/png/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.2.31 [August 21, 2008]
+ * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -115,7 +115,7 @@ png_read_chunk_header(png_structp png_ptr)
/* put the chunk name into png_ptr->chunk_name */
png_memcpy(png_ptr->chunk_name, buf + 4, 4);
- png_debug2(0, "Reading %s chunk, length = %lu\n",
+ png_debug2(0, "Reading %s chunk, length = %lu",
png_ptr->chunk_name, length);
/* reset the crc and run it over the chunk name */
@@ -392,7 +392,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int bit_depth, color_type, compression_type, filter_type;
int interlace_type;
- png_debug(1, "in png_handle_IHDR\n");
+ png_debug(1, "in png_handle_IHDR");
if (png_ptr->mode & PNG_HAVE_IHDR)
png_error(png_ptr, "Out of place IHDR");
@@ -452,9 +452,9 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->pixel_depth = (png_byte)(png_ptr->bit_depth *
png_ptr->channels);
png_ptr->rowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->width);
- png_debug1(3, "bit_depth = %d\n", png_ptr->bit_depth);
- png_debug1(3, "channels = %d\n", png_ptr->channels);
- png_debug1(3, "rowbytes = %lu\n", png_ptr->rowbytes);
+ png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
+ png_debug1(3, "channels = %d", png_ptr->channels);
+ png_debug1(3, "rowbytes = %lu", png_ptr->rowbytes);
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
color_type, interlace_type, compression_type, filter_type);
}
@@ -469,7 +469,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_colorp pal_ptr;
#endif
- png_debug(1, "in png_handle_PLTE\n");
+ png_debug(1, "in png_handle_PLTE");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before PLTE");
@@ -601,7 +601,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void /* PRIVATE */
png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
- png_debug(1, "in png_handle_IEND\n");
+ png_debug(1, "in png_handle_IEND");
if (!(png_ptr->mode & PNG_HAVE_IHDR) || !(png_ptr->mode & PNG_HAVE_IDAT))
{
@@ -629,7 +629,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
png_byte buf[4];
- png_debug(1, "in png_handle_gAMA\n");
+ png_debug(1, "in png_handle_gAMA");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before gAMA");
@@ -681,7 +681,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
#ifndef PNG_NO_CONSOLE_IO
- fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma);
+ fprintf(stderr, "gamma = (%d/100000)", (int)igamma);
#endif
return;
}
@@ -707,7 +707,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_size_t truelen;
png_byte buf[4];
- png_debug(1, "in png_handle_sBIT\n");
+ png_debug(1, "in png_handle_sBIT");
buf[0] = buf[1] = buf[2] = buf[3] = 0;
@@ -779,7 +779,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_uint_32 uint_x, uint_y;
- png_debug(1, "in png_handle_cHRM\n");
+ png_debug(1, "in png_handle_cHRM");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before cHRM");
@@ -817,42 +817,21 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
uint_x = png_get_uint_32(buf);
uint_y = png_get_uint_32(buf + 4);
- if (uint_x > 80000L || uint_y > 80000L ||
- uint_x + uint_y > 100000L)
- {
- png_warning(png_ptr, "Invalid cHRM white point");
- return;
- }
int_x_white = (png_fixed_point)uint_x;
int_y_white = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 8);
uint_y = png_get_uint_32(buf + 12);
- if (uint_x + uint_y > 100000L)
- {
- png_warning(png_ptr, "Invalid cHRM red point");
- return;
- }
int_x_red = (png_fixed_point)uint_x;
int_y_red = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 16);
uint_y = png_get_uint_32(buf + 20);
- if (uint_x + uint_y > 100000L)
- {
- png_warning(png_ptr, "Invalid cHRM green point");
- return;
- }
int_x_green = (png_fixed_point)uint_x;
int_y_green = (png_fixed_point)uint_y;
uint_x = png_get_uint_32(buf + 24);
uint_y = png_get_uint_32(buf + 28);
- if (uint_x + uint_y > 100000L)
- {
- png_warning(png_ptr, "Invalid cHRM blue point");
- return;
- }
int_x_blue = (png_fixed_point)uint_x;
int_y_blue = (png_fixed_point)uint_y;
@@ -918,7 +897,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int intent;
png_byte buf[1];
- png_debug(1, "in png_handle_sRGB\n");
+ png_debug(1, "in png_handle_sRGB");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before sRGB");
@@ -1021,7 +1000,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_uint_32 profile_size, profile_length;
png_size_t slength, prefix_length, data_length;
- png_debug(1, "in png_handle_iCCP\n");
+ png_debug(1, "in png_handle_iCCP");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before iCCP");
@@ -1142,7 +1121,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_uint_32 skip = 0;
png_size_t slength;
- png_debug(1, "in png_handle_sPLT\n");
+ png_debug(1, "in png_handle_sPLT");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before sPLT");
@@ -1278,7 +1257,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
- png_debug(1, "in png_handle_tRNS\n");
+ png_debug(1, "in png_handle_tRNS");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before tRNS");
@@ -1374,7 +1353,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_size_t truelen;
png_byte buf[6];
- png_debug(1, "in png_handle_bKGD\n");
+ png_debug(1, "in png_handle_bKGD");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before bKGD");
@@ -1425,7 +1404,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->background.index = buf[0];
if (info_ptr && info_ptr->num_palette)
{
- if (buf[0] > info_ptr->num_palette)
+ if (buf[0] >= info_ptr->num_palette)
{
png_warning(png_ptr, "Incorrect bKGD chunk index value");
return;
@@ -1463,7 +1442,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
unsigned int num, i;
png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
- png_debug(1, "in png_handle_hIST\n");
+ png_debug(1, "in png_handle_hIST");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before hIST");
@@ -1518,7 +1497,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_uint_32 res_x, res_y;
int unit_type;
- png_debug(1, "in png_handle_pHYs\n");
+ png_debug(1, "in png_handle_pHYs");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before pHYs");
@@ -1561,7 +1540,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_int_32 offset_x, offset_y;
int unit_type;
- png_debug(1, "in png_handle_oFFs\n");
+ png_debug(1, "in png_handle_oFFs");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before oFFs");
@@ -1608,7 +1587,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_size_t slength;
int i;
- png_debug(1, "in png_handle_pCAL\n");
+ png_debug(1, "in png_handle_pCAL");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before pCAL");
@@ -1625,7 +1604,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
- png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)\n",
+ png_debug1(2, "Allocating and reading pCAL chunk data (%lu bytes)",
length + 1);
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
@@ -1646,7 +1625,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00; /* null terminate the last string */
- png_debug(3, "Finding end of pCAL purpose string\n");
+ png_debug(3, "Finding end of pCAL purpose string");
for (buf = png_ptr->chunkdata; *buf; buf++)
/* empty loop */ ;
@@ -1662,14 +1641,14 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
- png_debug(3, "Reading pCAL X0, X1, type, nparams, and units\n");
+ png_debug(3, "Reading pCAL X0, X1, type, nparams, and units");
X0 = png_get_int_32((png_bytep)buf+1);
X1 = png_get_int_32((png_bytep)buf+5);
type = buf[9];
nparams = buf[10];
units = buf + 11;
- png_debug(3, "Checking pCAL equation type and number of parameters\n");
+ png_debug(3, "Checking pCAL equation type and number of parameters");
/* Check that we have the right number of parameters for known
equation types. */
if ((type == PNG_EQUATION_LINEAR && nparams != 2) ||
@@ -1690,7 +1669,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
for (buf = units; *buf; buf++)
/* Empty loop to move past the units string. */ ;
- png_debug(3, "Allocating pCAL parameters array\n");
+ png_debug(3, "Allocating pCAL parameters array");
params = (png_charpp)png_malloc_warn(png_ptr,
(png_uint_32)(nparams * png_sizeof(png_charp))) ;
if (params == NULL)
@@ -1706,7 +1685,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
buf++; /* Skip the null string terminator from previous parameter. */
- png_debug1(3, "Reading pCAL parameter %d\n", i);
+ png_debug1(3, "Reading pCAL parameter %d", i);
for (params[i] = buf; buf <= endptr && *buf != 0x00; buf++)
/* Empty loop to move past each parameter string */ ;
@@ -1746,7 +1725,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
png_size_t slength;
- png_debug(1, "in png_handle_sCAL\n");
+ png_debug(1, "in png_handle_sCAL");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before sCAL");
@@ -1763,7 +1742,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
- png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)\n",
+ png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)",
length + 1);
png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (png_ptr->chunkdata == NULL)
@@ -1880,7 +1859,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_byte buf[7];
png_time mod_time;
- png_debug(1, "in png_handle_tIME\n");
+ png_debug(1, "in png_handle_tIME");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Out of place tIME chunk");
@@ -1928,7 +1907,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_size_t slength;
int ret;
- png_debug(1, "in png_handle_tEXt\n");
+ png_debug(1, "in png_handle_tEXt");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before tEXt");
@@ -1945,21 +1924,24 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
- key = (png_charp)png_malloc_warn(png_ptr, length + 1);
- if (key == NULL)
+ png_free(png_ptr, png_ptr->chunkdata);
+ png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
+ if (png_ptr->chunkdata == NULL)
{
png_warning(png_ptr, "No memory to process text chunk.");
return;
}
slength = (png_size_t)length;
- png_crc_read(png_ptr, (png_bytep)key, slength);
+ png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
if (png_crc_finish(png_ptr, skip))
{
- png_free(png_ptr, key);
+ png_free(png_ptr, png_ptr->chunkdata);
+ png_ptr->chunkdata = NULL;
return;
}
+ key = png_ptr->chunkdata;
key[slength] = 0x00;
for (text = key; *text; text++)
@@ -1973,7 +1955,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (text_ptr == NULL)
{
png_warning(png_ptr, "Not enough memory to process text chunk.");
- png_free(png_ptr, key);
+ png_free(png_ptr, png_ptr->chunkdata);
+ png_ptr->chunkdata = NULL;
return;
}
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
@@ -1988,7 +1971,8 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
- png_free(png_ptr, key);
+ png_free(png_ptr, png_ptr->chunkdata);
+ png_ptr->chunkdata = NULL;
png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to process text chunk.");
@@ -2006,7 +1990,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int ret;
png_size_t slength, prefix_len, data_len;
- png_debug(1, "in png_handle_zTXt\n");
+ png_debug(1, "in png_handle_zTXt");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before zTXt");
@@ -2024,7 +2008,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
- png_free(png_ptr,png_ptr->chunkdata);
+ png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (png_ptr->chunkdata == NULL)
{
@@ -2109,7 +2093,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
int ret;
png_size_t slength, prefix_len, data_len;
- png_debug(1, "in png_handle_iTXt\n");
+ png_debug(1, "in png_handle_iTXt");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before iTXt");
@@ -2235,7 +2219,7 @@ png_handle_acTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_uint_32 num_plays;
png_uint_32 didSet;
- png_debug(1, "in png_handle_acTL\n");
+ png_debug(1, "in png_handle_acTL");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
{
@@ -2285,7 +2269,7 @@ png_handle_fcTL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_byte dispose_op;
png_byte blend_op;
- png_debug(1, "in png_handle_fcTL\n");
+ png_debug(1, "in png_handle_fcTL");
if (!(png_ptr->mode & PNG_HAVE_IHDR))
{
@@ -2397,7 +2381,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_uint_32 skip = 0;
- png_debug(1, "in png_handle_unknown\n");
+ png_debug(1, "in png_handle_unknown");
if (png_ptr->mode & PNG_HAVE_IDAT)
{
@@ -2492,7 +2476,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
void /* PRIVATE */
png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
{
- png_debug(1, "in png_check_chunk_name\n");
+ png_debug(1, "in png_check_chunk_name");
if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) ||
isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3]))
{
@@ -2514,7 +2498,7 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
void /* PRIVATE */
png_combine_row(png_structp png_ptr, png_bytep row, int mask)
{
- png_debug(1, "in png_combine_row\n");
+ png_debug(1, "in png_combine_row");
if (mask == 0xff)
{
png_memcpy(row, png_ptr->row_buf + 1,
@@ -2730,7 +2714,7 @@ png_do_read_interlace(png_structp png_ptr)
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif
- png_debug(1, "in png_do_read_interlace\n");
+ png_debug(1, "in png_do_read_interlace");
if (row != NULL && row_info != NULL)
{
png_uint_32 final_width;
@@ -2943,8 +2927,8 @@ void /* PRIVATE */
png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
png_bytep prev_row, int filter)
{
- png_debug(1, "in png_read_filter_row\n");
- png_debug2(2, "row = %lu, filter = %d\n", png_ptr->row_number, filter);
+ png_debug(1, "in png_read_filter_row");
+ png_debug2(2, "row = %lu, filter = %d", png_ptr->row_number, filter);
switch (filter)
{
case PNG_FILTER_VALUE_NONE:
@@ -3083,7 +3067,7 @@ png_read_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif
- png_debug(1, "in png_read_finish_row\n");
+ png_debug(1, "in png_read_finish_row");
png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows)
return;
@@ -3218,7 +3202,7 @@ png_read_start_row(png_structp png_ptr)
int max_pixel_depth;
png_size_t row_bytes;
- png_debug(1, "in png_read_start_row\n");
+ png_debug(1, "in png_read_start_row");
png_ptr->zstream.avail_in = 0;
png_init_read_transformations(png_ptr);
#ifdef PNG_READ_INTERLACING_SUPPORTED
@@ -3384,12 +3368,12 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
- png_debug1(3, "width = %lu,\n", png_ptr->width);
- png_debug1(3, "height = %lu,\n", png_ptr->height);
- png_debug1(3, "iwidth = %lu,\n", png_ptr->iwidth);
- png_debug1(3, "num_rows = %lu\n", png_ptr->num_rows);
- png_debug1(3, "rowbytes = %lu,\n", png_ptr->rowbytes);
- png_debug1(3, "irowbytes = %lu,\n", png_ptr->irowbytes);
+ png_debug1(3, "width = %lu,", png_ptr->width);
+ png_debug1(3, "height = %lu,", png_ptr->height);
+ png_debug1(3, "iwidth = %lu,", png_ptr->iwidth);
+ png_debug1(3, "num_rows = %lu", png_ptr->num_rows);
+ png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes);
+ png_debug1(3, "irowbytes = %lu,", png_ptr->irowbytes);
png_ptr->flags |= PNG_FLAG_ROW_INIT;
}
diff --git a/modules/libimg/png/pngset.c b/modules/libimg/png/pngset.c
index cb72d1f0318e..1e303fbd9e11 100644
--- a/modules/libimg/png/pngset.c
+++ b/modules/libimg/png/pngset.c
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.2.30 [August 13, 2008]
+ * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -21,7 +21,7 @@
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{
- png_debug1(1, "in %s storage function\n", "bKGD");
+ png_debug1(1, "in %s storage function", "bKGD");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -37,34 +37,9 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y)
{
- png_debug1(1, "in %s storage function\n", "cHRM");
+ png_debug1(1, "in %s storage function", "cHRM");
if (png_ptr == NULL || info_ptr == NULL)
return;
- if (!(white_x || white_y || red_x || red_y || green_x || green_y ||
- blue_x || blue_y))
- {
- png_warning(png_ptr,
- "Ignoring attempt to set all-zero chromaticity values");
- return;
- }
- if (white_x < 0.0 || white_y < 0.0 ||
- red_x < 0.0 || red_y < 0.0 ||
- green_x < 0.0 || green_y < 0.0 ||
- blue_x < 0.0 || blue_y < 0.0)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set negative chromaticity value");
- return;
- }
- if (white_x > 21474.83 || white_y > 21474.83 ||
- red_x > 21474.83 || red_y > 21474.83 ||
- green_x > 21474.83 || green_y > 21474.83 ||
- blue_x > 21474.83 || blue_y > 21474.83)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set chromaticity value exceeding 21474.83");
- return;
- }
info_ptr->x_white = (float)white_x;
info_ptr->y_white = (float)white_y;
@@ -94,61 +69,38 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y)
{
- png_debug1(1, "in %s storage function\n", "cHRM");
+ png_debug1(1, "in %s storage function", "cHRM fixed");
if (png_ptr == NULL || info_ptr == NULL)
return;
- if (!(white_x || white_y || red_x || red_y || green_x || green_y ||
- blue_x || blue_y))
+#if !defined(PNG_NO_CHECK_cHRM)
+ if (png_check_cHRM_fixed(png_ptr,
+ white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
+#endif
{
- png_warning(png_ptr,
- "Ignoring attempt to set all-zero chromaticity values");
- return;
- }
- if (white_x < 0 || white_y < 0 ||
- red_x < 0 || red_y < 0 ||
- green_x < 0 || green_y < 0 ||
- blue_x < 0 || blue_y < 0)
- {
- png_warning(png_ptr,
- "Ignoring attempt to set negative chromaticity value");
- return;
- }
- if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
- white_y > (png_fixed_point) PNG_UINT_31_MAX ||
- red_x > (png_fixed_point) PNG_UINT_31_MAX ||
- red_y > (png_fixed_point) PNG_UINT_31_MAX ||
- green_x > (png_fixed_point) PNG_UINT_31_MAX ||
- green_y > (png_fixed_point) PNG_UINT_31_MAX ||
- blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
- blue_y > (png_fixed_point) PNG_UINT_31_MAX )
- {
- png_warning(png_ptr,
- "Ignoring attempt to set chromaticity value exceeding 21474.83");
- return;
- }
- info_ptr->int_x_white = white_x;
- info_ptr->int_y_white = white_y;
- info_ptr->int_x_red = red_x;
- info_ptr->int_y_red = red_y;
- info_ptr->int_x_green = green_x;
- info_ptr->int_y_green = green_y;
- info_ptr->int_x_blue = blue_x;
- info_ptr->int_y_blue = blue_y;
+ info_ptr->int_x_white = white_x;
+ info_ptr->int_y_white = white_y;
+ info_ptr->int_x_red = red_x;
+ info_ptr->int_y_red = red_y;
+ info_ptr->int_x_green = green_x;
+ info_ptr->int_y_green = green_y;
+ info_ptr->int_x_blue = blue_x;
+ info_ptr->int_y_blue = blue_y;
#ifdef PNG_FLOATING_POINT_SUPPORTED
- info_ptr->x_white = (float)(white_x/100000.);
- info_ptr->y_white = (float)(white_y/100000.);
- info_ptr->x_red = (float)( red_x/100000.);
- info_ptr->y_red = (float)( red_y/100000.);
- info_ptr->x_green = (float)(green_x/100000.);
- info_ptr->y_green = (float)(green_y/100000.);
- info_ptr->x_blue = (float)( blue_x/100000.);
- info_ptr->y_blue = (float)( blue_y/100000.);
+ info_ptr->x_white = (float)(white_x/100000.);
+ info_ptr->y_white = (float)(white_y/100000.);
+ info_ptr->x_red = (float)( red_x/100000.);
+ info_ptr->y_red = (float)( red_y/100000.);
+ info_ptr->x_green = (float)(green_x/100000.);
+ info_ptr->y_green = (float)(green_y/100000.);
+ info_ptr->x_blue = (float)( blue_x/100000.);
+ info_ptr->y_blue = (float)( blue_y/100000.);
#endif
- info_ptr->valid |= PNG_INFO_cHRM;
+ info_ptr->valid |= PNG_INFO_cHRM;
+ }
}
-#endif
-#endif
+#endif /* PNG_FIXED_POINT_SUPPORTED */
+#endif /* PNG_cHRM_SUPPORTED */
#if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -156,7 +108,7 @@ void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{
double gamma;
- png_debug1(1, "in %s storage function\n", "gAMA");
+ png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -183,7 +135,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
{
png_fixed_point gamma;
- png_debug1(1, "in %s storage function\n", "gAMA");
+ png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -220,7 +172,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{
int i;
- png_debug1(1, "in %s storage function\n", "hIST");
+ png_debug1(1, "in %s storage function", "hIST");
if (png_ptr == NULL || info_ptr == NULL)
return;
if (info_ptr->num_palette == 0 || info_ptr->num_palette
@@ -263,7 +215,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
int color_type, int interlace_type, int compression_type,
int filter_type)
{
- png_debug1(1, "in %s storage function\n", "IHDR");
+ png_debug1(1, "in %s storage function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -375,7 +327,7 @@ void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{
- png_debug1(1, "in %s storage function\n", "oFFs");
+ png_debug1(1, "in %s storage function", "oFFs");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -395,12 +347,12 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 length;
int i;
- png_debug1(1, "in %s storage function\n", "pCAL");
+ png_debug1(1, "in %s storage function", "pCAL");
if (png_ptr == NULL || info_ptr == NULL)
return;
length = png_strlen(purpose) + 1;
- png_debug1(3, "allocating purpose for info (%lu bytes)\n",
+ png_debug1(3, "allocating purpose for info (%lu bytes)",
(unsigned long)length);
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL)
@@ -410,14 +362,14 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
}
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
- png_debug(3, "storing X0, X1, type, and nparams in info\n");
+ png_debug(3, "storing X0, X1, type, and nparams in info");
info_ptr->pcal_X0 = X0;
info_ptr->pcal_X1 = X1;
info_ptr->pcal_type = (png_byte)type;
info_ptr->pcal_nparams = (png_byte)nparams;
length = png_strlen(units) + 1;
- png_debug1(3, "allocating units for info (%lu bytes)\n",
+ png_debug1(3, "allocating units for info (%lu bytes)",
(unsigned long)length);
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_units == NULL)
@@ -440,7 +392,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
for (i = 0; i < nparams; i++)
{
length = png_strlen(params[i]) + 1;
- png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i,
+ png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
(unsigned long)length);
info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_params[i] == NULL)
@@ -464,7 +416,7 @@ void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height)
{
- png_debug1(1, "in %s storage function\n", "sCAL");
+ png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -482,14 +434,14 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
{
png_uint_32 length;
- png_debug1(1, "in %s storage function\n", "sCAL");
+ png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL)
return;
info_ptr->scal_unit = (png_byte)unit;
length = png_strlen(swidth) + 1;
- png_debug1(3, "allocating unit for info (%u bytes)\n",
+ png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_width == NULL)
@@ -501,7 +453,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
length = png_strlen(sheight) + 1;
- png_debug1(3, "allocating unit for info (%u bytes)\n",
+ png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_height == NULL)
@@ -527,7 +479,7 @@ void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{
- png_debug1(1, "in %s storage function\n", "pHYs");
+ png_debug1(1, "in %s storage function", "pHYs");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -543,7 +495,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp palette, int num_palette)
{
- png_debug1(1, "in %s storage function\n", "PLTE");
+ png_debug1(1, "in %s storage function", "PLTE");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -592,7 +544,7 @@ void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit)
{
- png_debug1(1, "in %s storage function\n", "sBIT");
+ png_debug1(1, "in %s storage function", "sBIT");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -605,7 +557,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{
- png_debug1(1, "in %s storage function\n", "sRGB");
+ png_debug1(1, "in %s storage function", "sRGB");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -629,12 +581,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
-#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y;
#endif
-#endif
- png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM");
+ png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -652,7 +602,6 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif
#if defined(PNG_cHRM_SUPPORTED)
-#ifdef PNG_FIXED_POINT_SUPPORTED
int_white_x = 31270L;
int_white_y = 32900L;
int_red_x = 64000L;
@@ -662,10 +611,6 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int_blue_x = 15000L;
int_blue_y = 6000L;
- png_set_cHRM_fixed(png_ptr, info_ptr,
- int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y,
- int_blue_x, int_blue_y);
-#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
white_x = (float).3127;
white_y = (float).3290;
@@ -675,11 +620,25 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
green_y = (float).60;
blue_x = (float).15;
blue_y = (float).06;
+#endif
- png_set_cHRM(png_ptr, info_ptr,
- white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
+#if !defined(PNG_NO_CHECK_cHRM)
+ if (png_check_cHRM_fixed(png_ptr,
+ int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
+ int_green_y, int_blue_x, int_blue_y))
#endif
+ {
+#ifdef PNG_FIXED_POINT_SUPPORTED
+ png_set_cHRM_fixed(png_ptr, info_ptr,
+ int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
+ int_green_y, int_blue_x, int_blue_y);
#endif
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_set_cHRM(png_ptr, info_ptr,
+ white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
+#endif
+ }
+#endif /* cHRM */
}
#endif
@@ -694,7 +653,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp new_iccp_profile;
png_uint_32 length;
- png_debug1(1, "in %s storage function\n", "iCCP");
+ png_debug1(1, "in %s storage function", "iCCP");
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return;
@@ -748,7 +707,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
{
int i;
- png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ?
+ png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ?
"text" : (png_const_charp)png_ptr->chunk_name));
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
@@ -790,7 +749,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->free_me |= PNG_FREE_TEXT;
#endif
}
- png_debug1(3, "allocated %d entries for info_ptr->text\n",
+ png_debug1(3, "allocated %d entries for info_ptr->text",
info_ptr->max_text);
}
for (i = 0; i < num_text; i++)
@@ -850,7 +809,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
(key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL)
return(1);
- png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n",
+ png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
(png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key);
@@ -898,7 +857,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#endif
}
info_ptr->num_text++;
- png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
+ png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
}
return(0);
}
@@ -908,7 +867,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{
- png_debug1(1, "in %s storage function\n", "tIME");
+ png_debug1(1, "in %s storage function", "tIME");
if (png_ptr == NULL || info_ptr == NULL ||
(png_ptr->mode & PNG_WROTE_tIME))
return;
@@ -923,7 +882,7 @@ void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans, int num_trans, png_color_16p trans_values)
{
- png_debug1(1, "in %s storage function\n", "tRNS");
+ png_debug1(1, "in %s storage function", "tRNS");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1053,7 +1012,7 @@ png_uint_32 PNGAPI
png_set_acTL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 num_frames, png_uint_32 num_plays)
{
- png_debug1(1, "in %s storage function\n", "acTL");
+ png_debug1(1, "in %s storage function", "acTL");
if (png_ptr == NULL || info_ptr == NULL)
{
@@ -1098,7 +1057,7 @@ png_set_next_frame_fcTL(png_structp png_ptr, png_infop info_ptr,
png_uint_16 delay_num, png_uint_16 delay_den,
png_byte dispose_op, png_byte blend_op)
{
- png_debug1(1, "in %s storage function\n", "fcTL");
+ png_debug1(1, "in %s storage function", "fcTL");
if (png_ptr == NULL || info_ptr == NULL)
{
@@ -1169,7 +1128,7 @@ png_uint_32 PNGAPI
png_set_first_frame_is_hidden(png_structp png_ptr, png_infop info_ptr,
png_byte is_hidden)
{
- png_debug(1, "in png_first_frame_is_hidden()\n");
+ png_debug(1, "in png_first_frame_is_hidden()");
if (png_ptr == NULL)
return 0;
@@ -1263,7 +1222,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
{
/* This function is deprecated in favor of png_permit_mng_features()
and will be removed from libpng-1.3.0 */
- png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n");
+ png_debug(1, "in png_permit_empty_plte, DEPRECATED.");
if (png_ptr == NULL)
return;
png_ptr->mng_features_permitted = (png_byte)
@@ -1277,7 +1236,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{
- png_debug(1, "in png_permit_mng_features\n");
+ png_debug(1, "in png_permit_mng_features");
if (png_ptr == NULL)
return (png_uint_32)0;
png_ptr->mng_features_permitted =
@@ -1338,7 +1297,7 @@ void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn)
{
- png_debug(1, "in png_set_read_user_chunk_fn\n");
+ png_debug(1, "in png_set_read_user_chunk_fn");
if (png_ptr == NULL)
return;
png_ptr->read_user_chunk_fn = read_user_chunk_fn;
@@ -1350,7 +1309,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{
- png_debug1(1, "in %s storage function\n", "rows");
+ png_debug1(1, "in %s storage function", "rows");
if (png_ptr == NULL || info_ptr == NULL)
return;
diff --git a/modules/libimg/png/pngtrans.c b/modules/libimg/png/pngtrans.c
index 4c040bdc0b1c..28861587990a 100644
--- a/modules/libimg/png/pngtrans.c
+++ b/modules/libimg/png/pngtrans.c
@@ -17,7 +17,7 @@
void PNGAPI
png_set_bgr(png_structp png_ptr)
{
- png_debug(1, "in png_set_bgr\n");
+ png_debug(1, "in png_set_bgr");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_BGR;
}
@@ -28,7 +28,7 @@ png_set_bgr(png_structp png_ptr)
void PNGAPI
png_set_swap(png_structp png_ptr)
{
- png_debug(1, "in png_set_swap\n");
+ png_debug(1, "in png_set_swap");
if (png_ptr == NULL) return;
if (png_ptr->bit_depth == 16)
png_ptr->transformations |= PNG_SWAP_BYTES;
@@ -40,7 +40,7 @@ png_set_swap(png_structp png_ptr)
void PNGAPI
png_set_packing(png_structp png_ptr)
{
- png_debug(1, "in png_set_packing\n");
+ png_debug(1, "in png_set_packing");
if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8)
{
@@ -55,7 +55,7 @@ png_set_packing(png_structp png_ptr)
void PNGAPI
png_set_packswap(png_structp png_ptr)
{
- png_debug(1, "in png_set_packswap\n");
+ png_debug(1, "in png_set_packswap");
if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8)
png_ptr->transformations |= PNG_PACKSWAP;
@@ -66,7 +66,7 @@ png_set_packswap(png_structp png_ptr)
void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{
- png_debug(1, "in png_set_shift\n");
+ png_debug(1, "in png_set_shift");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SHIFT;
png_ptr->shift = *true_bits;
@@ -78,7 +78,7 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits)
int PNGAPI
png_set_interlace_handling(png_structp png_ptr)
{
- png_debug(1, "in png_set_interlace handling\n");
+ png_debug(1, "in png_set_interlace handling");
if (png_ptr && png_ptr->interlaced)
{
png_ptr->transformations |= PNG_INTERLACE;
@@ -98,7 +98,7 @@ png_set_interlace_handling(png_structp png_ptr)
void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
- png_debug(1, "in png_set_filler\n");
+ png_debug(1, "in png_set_filler");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_FILLER;
png_ptr->filler = (png_byte)filler;
@@ -131,7 +131,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
- png_debug(1, "in png_set_add_alpha\n");
+ png_debug(1, "in png_set_add_alpha");
if (png_ptr == NULL) return;
png_set_filler(png_ptr, filler, filler_loc);
png_ptr->transformations |= PNG_ADD_ALPHA;
@@ -145,7 +145,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
void PNGAPI
png_set_swap_alpha(png_structp png_ptr)
{
- png_debug(1, "in png_set_swap_alpha\n");
+ png_debug(1, "in png_set_swap_alpha");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SWAP_ALPHA;
}
@@ -156,7 +156,7 @@ png_set_swap_alpha(png_structp png_ptr)
void PNGAPI
png_set_invert_alpha(png_structp png_ptr)
{
- png_debug(1, "in png_set_invert_alpha\n");
+ png_debug(1, "in png_set_invert_alpha");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_ALPHA;
}
@@ -166,7 +166,7 @@ png_set_invert_alpha(png_structp png_ptr)
void PNGAPI
png_set_invert_mono(png_structp png_ptr)
{
- png_debug(1, "in png_set_invert_mono\n");
+ png_debug(1, "in png_set_invert_mono");
if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_MONO;
}
@@ -175,7 +175,7 @@ png_set_invert_mono(png_structp png_ptr)
void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_invert\n");
+ png_debug(1, "in png_do_invert");
/* This test removed from libpng version 1.0.13 and 1.2.0:
* if (row_info->bit_depth == 1 &&
*/
@@ -230,7 +230,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_swap\n");
+ png_debug(1, "in png_do_swap");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -361,7 +361,7 @@ static PNG_CONST png_byte fourbppswaptable[256] = {
void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_packswap\n");
+ png_debug(1, "in png_do_packswap");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -393,7 +393,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{
- png_debug(1, "in png_do_strip_filler\n");
+ png_debug(1, "in png_do_strip_filler");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -551,7 +551,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_bgr\n");
+ png_debug(1, "in png_do_bgr");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -630,7 +630,7 @@ void PNGAPI
png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels)
{
- png_debug(1, "in png_set_user_transform_info\n");
+ png_debug(1, "in png_set_user_transform_info");
if (png_ptr == NULL) return;
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_ptr->user_transform_ptr = user_transform_ptr;
diff --git a/modules/libimg/png/pngwrite.c b/modules/libimg/png/pngwrite.c
index 9f11d7469d45..0ef89a1a1ded 100644
--- a/modules/libimg/png/pngwrite.c
+++ b/modules/libimg/png/pngwrite.c
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.2.31 [August 21, 2008]
+ * Last changed in libpng 1.2.31 [August 19, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -25,7 +25,7 @@
void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_write_info_before_PLTE\n");
+ png_debug(1, "in png_write_info_before_PLTE");
if (png_ptr == NULL || info_ptr == NULL)
return;
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
@@ -99,7 +99,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
png_unknown_chunk *up;
- png_debug(5, "writing extra chunks\n");
+ png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -130,7 +130,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
int i;
#endif
- png_debug(1, "in png_write_info\n");
+ png_debug(1, "in png_write_info");
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -215,7 +215,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* Check to see if we need to write text chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
- png_debug2(2, "Writing header text chunk %d, type %d\n", i,
+ png_debug2(2, "Writing header text chunk %d, type %d", i,
info_ptr->text[i].compression);
/* an internationalized chunk? */
if (info_ptr->text[i].compression > 0)
@@ -272,7 +272,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
{
png_unknown_chunk *up;
- png_debug(5, "writing extra chunks\n");
+ png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -300,7 +300,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI
png_write_end(png_structp png_ptr, png_infop info_ptr)
{
- png_debug(1, "in png_write_end\n");
+ png_debug(1, "in png_write_end");
if (png_ptr == NULL)
return;
if (!(png_ptr->mode & PNG_HAVE_IDAT))
@@ -326,7 +326,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* loop through comment chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
- png_debug2(2, "Writing trailer text chunk %d, type %d\n", i,
+ png_debug2(2, "Writing trailer text chunk %d, type %d", i,
info_ptr->text[i].compression);
/* an internationalized chunk? */
if (info_ptr->text[i].compression > 0)
@@ -378,7 +378,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
{
png_unknown_chunk *up;
- png_debug(5, "writing extra chunks\n");
+ png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -421,7 +421,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
{
- png_debug(1, "in png_convert_from_struct_tm\n");
+ png_debug(1, "in png_convert_from_struct_tm");
ptime->year = (png_uint_16)(1900 + ttime->tm_year);
ptime->month = (png_byte)(ttime->tm_mon + 1);
ptime->day = (png_byte)ttime->tm_mday;
@@ -435,7 +435,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
{
struct tm *tbuf;
- png_debug(1, "in png_convert_from_time_t\n");
+ png_debug(1, "in png_convert_from_time_t");
tbuf = gmtime(&ttime);
png_convert_from_struct_tm(ptime, tbuf);
}
@@ -469,7 +469,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif
#endif
int i;
- png_debug(1, "in png_create_write_struct\n");
+ png_debug(1, "in png_create_write_struct");
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -667,7 +667,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
}
} while (png_libpng_ver[i++]);
- png_debug(1, "in png_write_init_3\n");
+ png_debug(1, "in png_write_init_3");
#ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */
@@ -721,7 +721,7 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
png_uint_32 i; /* row counter */
png_bytepp rp; /* row pointer */
- png_debug(1, "in png_write_rows\n");
+ png_debug(1, "in png_write_rows");
if (png_ptr == NULL)
return;
@@ -746,7 +746,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
if (png_ptr == NULL)
return;
- png_debug(1, "in png_write_image\n");
+ png_debug(1, "in png_write_image");
#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* intialize interlace handling. If image is not interlaced,
this will set pass to 1 */
@@ -771,7 +771,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
{
if (png_ptr == NULL)
return;
- png_debug2(1, "in png_write_row (row %ld, pass %d)\n",
+ png_debug2(1, "in png_write_row (row %ld, pass %d)",
png_ptr->row_number, png_ptr->pass);
/* initialize transformations and other stuff if first time */
@@ -885,12 +885,12 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
png_ptr->row_info.width);
- png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type);
- png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width);
- png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels);
- png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth);
- png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth);
- png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes);
+ png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type);
+ png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width);
+ png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels);
+ png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth);
+ png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth);
+ png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes);
/* Copy user's row into buffer, leaving room for filter byte. */
png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row,
@@ -946,7 +946,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
void PNGAPI
png_set_flush(png_structp png_ptr, int nrows)
{
- png_debug(1, "in png_set_flush\n");
+ png_debug(1, "in png_set_flush");
if (png_ptr == NULL)
return;
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
@@ -958,7 +958,7 @@ png_write_flush(png_structp png_ptr)
{
int wrote_IDAT;
- png_debug(1, "in png_write_flush\n");
+ png_debug(1, "in png_write_flush");
if (png_ptr == NULL)
return;
/* We have already written out all of the data */
@@ -1018,7 +1018,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
png_voidp mem_ptr = NULL;
#endif
- png_debug(1, "in png_destroy_write_struct\n");
+ png_debug(1, "in png_destroy_write_struct");
if (png_ptr_ptr != NULL)
{
png_ptr = *png_ptr_ptr;
@@ -1092,7 +1092,7 @@ png_write_destroy(png_structp png_ptr)
png_free_ptr free_fn;
#endif
- png_debug(1, "in png_write_destroy\n");
+ png_debug(1, "in png_write_destroy");
/* free any memory zlib uses */
deflateEnd(&png_ptr->zstream);
@@ -1149,7 +1149,7 @@ png_write_destroy(png_structp png_ptr)
void PNGAPI
png_set_filter(png_structp png_ptr, int method, int filters)
{
- png_debug(1, "in png_set_filter\n");
+ png_debug(1, "in png_set_filter");
if (png_ptr == NULL)
return;
#if defined(PNG_MNG_FEATURES_SUPPORTED)
@@ -1272,7 +1272,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
{
int i;
- png_debug(1, "in png_set_filter_heuristics\n");
+ png_debug(1, "in png_set_filter_heuristics");
if (png_ptr == NULL)
return;
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
@@ -1386,7 +1386,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
void PNGAPI
png_set_compression_level(png_structp png_ptr, int level)
{
- png_debug(1, "in png_set_compression_level\n");
+ png_debug(1, "in png_set_compression_level");
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
@@ -1396,7 +1396,7 @@ png_set_compression_level(png_structp png_ptr, int level)
void PNGAPI
png_set_compression_mem_level(png_structp png_ptr, int mem_level)
{
- png_debug(1, "in png_set_compression_mem_level\n");
+ png_debug(1, "in png_set_compression_mem_level");
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
@@ -1406,7 +1406,7 @@ png_set_compression_mem_level(png_structp png_ptr, int mem_level)
void PNGAPI
png_set_compression_strategy(png_structp png_ptr, int strategy)
{
- png_debug(1, "in png_set_compression_strategy\n");
+ png_debug(1, "in png_set_compression_strategy");
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
@@ -1437,7 +1437,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
void PNGAPI
png_set_compression_method(png_structp png_ptr, int method)
{
- png_debug(1, "in png_set_compression_method\n");
+ png_debug(1, "in png_set_compression_method");
if (png_ptr == NULL)
return;
if (method != 8)
@@ -1459,7 +1459,7 @@ void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn)
{
- png_debug(1, "in png_set_write_user_transform_fn\n");
+ png_debug(1, "in png_set_write_user_transform_fn");
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_USER_TRANSFORM;
@@ -1514,11 +1514,11 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED)
- /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
- * RGB (4 channels -> 3 channels). The second parameter is not used.
- */
- if (transforms & PNG_TRANSFORM_STRIP_FILLER)
- png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
+ /* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */
+ if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
+ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
+ else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
+ png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
#endif
#if defined(PNG_WRITE_BGR_SUPPORTED)
@@ -1561,7 +1561,7 @@ png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
png_uint_16 delay_num, png_uint_16 delay_den, png_byte dispose_op,
png_byte blend_op)
{
- png_debug(1, "in png_write_frame_head\n");
+ png_debug(1, "in png_write_frame_head");
/* 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? */
@@ -1581,7 +1581,7 @@ png_write_frame_head(png_structp png_ptr, png_infop info_ptr,
void PNGAPI
png_write_frame_tail(png_structp png_ptr, png_infop png_info)
{
- png_debug(1, "in png_write_frame_tail\n");
+ png_debug(1, "in png_write_frame_tail");
png_ptr->num_frames_written++;
}
diff --git a/modules/libimg/png/pngwtran.c b/modules/libimg/png/pngwtran.c
index e9374dcd2854..398fc41be615 100644
--- a/modules/libimg/png/pngwtran.c
+++ b/modules/libimg/png/pngwtran.c
@@ -18,7 +18,7 @@
void /* PRIVATE */
png_do_write_transformations(png_structp png_ptr)
{
- png_debug(1, "in png_do_write_transformations\n");
+ png_debug(1, "in png_do_write_transformations");
if (png_ptr == NULL)
return;
@@ -86,7 +86,7 @@ png_do_write_transformations(png_structp png_ptr)
void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
- png_debug(1, "in png_do_pack\n");
+ png_debug(1, "in png_do_pack");
if (row_info->bit_depth == 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
@@ -212,7 +212,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{
- png_debug(1, "in png_do_shift\n");
+ png_debug(1, "in png_do_shift");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL &&
#else
@@ -336,7 +336,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_write_swap_alpha\n");
+ png_debug(1, "in png_do_write_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -424,7 +424,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_write_invert_alpha\n");
+ png_debug(1, "in png_do_write_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL)
#endif
@@ -514,7 +514,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{
- png_debug(1, "in png_do_write_intrapixel\n");
+ png_debug(1, "in png_do_write_intrapixel");
if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL &&
diff --git a/modules/libimg/png/pngwutil.c b/modules/libimg/png/pngwutil.c
index 86373f571d61..50c9810c0e17 100644
--- a/modules/libimg/png/pngwutil.c
+++ b/modules/libimg/png/pngwutil.c
@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.2.30 [August 13, 2008]
+ * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -96,7 +96,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
{
png_byte buf[8];
- png_debug2(0, "Writing %s chunk, length = %lu\n", chunk_name,
+ png_debug2(0, "Writing %s chunk, length = %lu", chunk_name,
(unsigned long)length);
if (png_ptr == NULL) return;
@@ -392,7 +392,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_byte buf[13]; /* buffer to store the IHDR info */
- png_debug(1, "in png_write_IHDR\n");
+ png_debug(1, "in png_write_IHDR");
/* Check that we have valid input data from the application info */
switch (color_type)
{
@@ -574,7 +574,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_colorp pal_ptr;
png_byte buf[3];
- png_debug(1, "in png_write_PLTE\n");
+ png_debug(1, "in png_write_PLTE");
if ((
#if defined(PNG_MNG_FEATURES_SUPPORTED)
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
@@ -600,7 +600,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
}
png_ptr->num_palette = (png_uint_16)num_pal;
- png_debug1(3, "num_palette = %d\n", png_ptr->num_palette);
+ png_debug1(3, "num_palette = %d", png_ptr->num_palette);
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE,
(png_uint_32)(num_pal * 3));
@@ -637,7 +637,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
PNG_fdAT;
#endif
#endif
- png_debug(1, "in png_write_IDAT\n");
+ png_debug(1, "in png_write_IDAT");
/* Optimize the CMF field in the zlib stream. */
/* This hack of the zlib stream is compliant to the stream specification. */
@@ -710,7 +710,7 @@ png_write_IEND(png_structp png_ptr)
#ifdef PNG_USE_LOCAL_ARRAYS
PNG_IEND;
#endif
- png_debug(1, "in png_write_IEND\n");
+ png_debug(1, "in png_write_IEND");
png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL,
(png_size_t)0);
png_ptr->mode |= PNG_HAVE_IEND;
@@ -728,7 +728,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma)
png_uint_32 igamma;
png_byte buf[4];
- png_debug(1, "in png_write_gAMA\n");
+ png_debug(1, "in png_write_gAMA");
/* file_gamma is saved in 1/100,000ths */
igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5);
png_save_uint_32(buf, igamma);
@@ -744,7 +744,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#endif
png_byte buf[4];
- png_debug(1, "in png_write_gAMA\n");
+ png_debug(1, "in png_write_gAMA");
/* file_gamma is saved in 1/100,000ths */
png_save_uint_32(buf, (png_uint_32)file_gamma);
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
@@ -762,7 +762,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
#endif
png_byte buf[1];
- png_debug(1, "in png_write_sRGB\n");
+ png_debug(1, "in png_write_sRGB");
if (srgb_intent >= PNG_sRGB_INTENT_LAST)
png_warning(png_ptr,
"Invalid sRGB rendering intent specified");
@@ -785,7 +785,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
compression_state comp;
int embedded_profile_len = 0;
- png_debug(1, "in png_write_iCCP\n");
+ png_debug(1, "in png_write_iCCP");
comp.num_output_ptr = 0;
comp.max_output_ptr = 0;
@@ -793,12 +793,9 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
comp.input = NULL;
comp.input_len = 0;
- if (name == NULL || (name_len = png_check_keyword(png_ptr, name,
+ if ((name_len = png_check_keyword(png_ptr, name,
&new_name)) == 0)
- {
- png_warning(png_ptr, "Empty keyword in iCCP chunk");
return;
- }
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_warning(png_ptr, "Unknown compression type in iCCP chunk");
@@ -864,13 +861,10 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
int i;
#endif
- png_debug(1, "in png_write_sPLT\n");
- if (spalette->name == NULL || (name_len = png_check_keyword(png_ptr,
+ png_debug(1, "in png_write_sPLT");
+ if ((name_len = png_check_keyword(png_ptr,
spalette->name, &new_name))==0)
- {
- png_warning(png_ptr, "Empty keyword in sPLT chunk");
- return;
- }
+ return;
/* make sure we include the NULL after the name */
png_write_chunk_start(png_ptr, (png_bytep)png_sPLT,
@@ -941,7 +935,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
png_byte buf[4];
png_size_t size;
- png_debug(1, "in png_write_sBIT\n");
+ png_debug(1, "in png_write_sBIT");
/* make sure we don't depend upon the order of PNG_COLOR_8 */
if (color_type & PNG_COLOR_MASK_COLOR)
{
@@ -998,55 +992,42 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
PNG_cHRM;
#endif
png_byte buf[32];
- png_uint_32 itemp;
- png_debug(1, "in png_write_cHRM\n");
- /* each value is saved in 1/100,000ths */
- if (white_x < 0 || white_x > 0.8 || white_y < 0 || white_y > 0.8 ||
- white_x + white_y > 1.0)
- {
- png_warning(png_ptr, "Invalid cHRM white point specified");
-#if !defined(PNG_NO_CONSOLE_IO)
- fprintf(stderr, "white_x=%f, white_y=%f\n", white_x, white_y);
+ png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y,
+ int_green_x, int_green_y, int_blue_x, int_blue_y;
+
+ png_debug(1, "in png_write_cHRM");
+
+ int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5);
+ int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5);
+ int_red_x = (png_uint_32)(red_x * 100000.0 + 0.5);
+ int_red_y = (png_uint_32)(red_y * 100000.0 + 0.5);
+ int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5);
+ int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5);
+ int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
+ int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
+
+#if !defined(PNG_NO_CHECK_cHRM)
+ if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
+ int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
- return;
- }
- itemp = (png_uint_32)(white_x * 100000.0 + 0.5);
- png_save_uint_32(buf, itemp);
- itemp = (png_uint_32)(white_y * 100000.0 + 0.5);
- png_save_uint_32(buf + 4, itemp);
-
- if (red_x < 0 || red_y < 0 || red_x + red_y > 1.0)
{
- png_warning(png_ptr, "Invalid cHRM red point specified");
- return;
- }
- itemp = (png_uint_32)(red_x * 100000.0 + 0.5);
- png_save_uint_32(buf + 8, itemp);
- itemp = (png_uint_32)(red_y * 100000.0 + 0.5);
- png_save_uint_32(buf + 12, itemp);
+ /* each value is saved in 1/100,000ths */
+
+ png_save_uint_32(buf, int_white_x);
+ png_save_uint_32(buf + 4, int_white_y);
- if (green_x < 0 || green_y < 0 || green_x + green_y > 1.0)
- {
- png_warning(png_ptr, "Invalid cHRM green point specified");
- return;
- }
- itemp = (png_uint_32)(green_x * 100000.0 + 0.5);
- png_save_uint_32(buf + 16, itemp);
- itemp = (png_uint_32)(green_y * 100000.0 + 0.5);
- png_save_uint_32(buf + 20, itemp);
+ png_save_uint_32(buf + 8, int_red_x);
+ png_save_uint_32(buf + 12, int_red_y);
- if (blue_x < 0 || blue_y < 0 || blue_x + blue_y > 1.0)
- {
- png_warning(png_ptr, "Invalid cHRM blue point specified");
- return;
- }
- itemp = (png_uint_32)(blue_x * 100000.0 + 0.5);
- png_save_uint_32(buf + 24, itemp);
- itemp = (png_uint_32)(blue_y * 100000.0 + 0.5);
- png_save_uint_32(buf + 28, itemp);
+ png_save_uint_32(buf + 16, int_green_x);
+ png_save_uint_32(buf + 20, int_green_y);
- png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
+ png_save_uint_32(buf + 24, int_blue_x);
+ png_save_uint_32(buf + 28, int_blue_y);
+
+ png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
+ }
}
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
@@ -1061,45 +1042,27 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#endif
png_byte buf[32];
- png_debug(1, "in png_write_cHRM\n");
+ png_debug(1, "in png_write_cHRM");
/* each value is saved in 1/100,000ths */
- if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L)
- {
- png_warning(png_ptr, "Invalid fixed cHRM white point specified");
-#if !defined(PNG_NO_CONSOLE_IO)
- fprintf(stderr, "white_x=%ld, white_y=%ld\n", (unsigned long)white_x,
- (unsigned long)white_y);
+#if !defined(PNG_NO_CHECK_cHRM)
+ if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
+ green_x, green_y, blue_x, blue_y))
#endif
- return;
- }
+ {
png_save_uint_32(buf, (png_uint_32)white_x);
png_save_uint_32(buf + 4, (png_uint_32)white_y);
- if (red_x + red_y > 100000L)
- {
- png_warning(png_ptr, "Invalid cHRM fixed red point specified");
- return;
- }
png_save_uint_32(buf + 8, (png_uint_32)red_x);
png_save_uint_32(buf + 12, (png_uint_32)red_y);
- if (green_x + green_y > 100000L)
- {
- png_warning(png_ptr, "Invalid fixed cHRM green point specified");
- return;
- }
png_save_uint_32(buf + 16, (png_uint_32)green_x);
png_save_uint_32(buf + 20, (png_uint_32)green_y);
- if (blue_x + blue_y > 100000L)
- {
- png_warning(png_ptr, "Invalid fixed cHRM blue point specified");
- return;
- }
png_save_uint_32(buf + 24, (png_uint_32)blue_x);
png_save_uint_32(buf + 28, (png_uint_32)blue_y);
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
+ }
}
#endif
#endif
@@ -1115,7 +1078,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
#endif
png_byte buf[6];
- png_debug(1, "in png_write_tRNS\n");
+ png_debug(1, "in png_write_tRNS");
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette)
@@ -1170,7 +1133,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
#endif
png_byte buf[6];
- png_debug(1, "in png_write_bKGD\n");
+ png_debug(1, "in png_write_bKGD");
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (
@@ -1178,7 +1141,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
(png_ptr->num_palette ||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
#endif
- back->index > png_ptr->num_palette)
+ back->index >= png_ptr->num_palette)
{
png_warning(png_ptr, "Invalid background palette index");
return;
@@ -1224,10 +1187,10 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
int i;
png_byte buf[3];
- png_debug(1, "in png_write_hIST\n");
+ png_debug(1, "in png_write_hIST");
if (num_hist > (int)png_ptr->num_palette)
{
- png_debug2(3, "num_hist = %d, num_palette = %d\n", num_hist,
+ png_debug2(3, "num_hist = %d, num_palette = %d", num_hist,
png_ptr->num_palette);
png_warning(png_ptr, "Invalid number of histogram entries specified");
return;
@@ -1264,7 +1227,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
int kflag;
int kwarn=0;
- png_debug(1, "in png_check_keyword\n");
+ png_debug(1, "in png_check_keyword");
*new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0)
@@ -1273,7 +1236,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
return ((png_size_t)0);
}
- png_debug1(2, "Keyword to be checked is '%s'\n", key);
+ png_debug1(2, "Keyword to be checked is '%s'", key);
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
if (*new_key == NULL)
@@ -1332,7 +1295,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
}
}
- png_debug1(2, "Checking for multiple internal spaces in '%s'\n", kp);
+ png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
/* Remove multiple internal spaces. */
for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
@@ -1367,7 +1330,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
if (key_len > 79)
{
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
- new_key[79] = '\0';
+ (*new_key)[79] = '\0';
key_len = 79;
}
@@ -1387,12 +1350,9 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t key_len;
png_charp new_key;
- png_debug(1, "in png_write_tEXt\n");
- if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
- {
- png_warning(png_ptr, "Empty keyword in tEXt chunk");
+ png_debug(1, "in png_write_tEXt");
+ if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
return;
- }
if (text == NULL || *text == '\0')
text_len = 0;
@@ -1432,7 +1392,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_charp new_key;
compression_state comp;
- png_debug(1, "in png_write_zTXt\n");
+ png_debug(1, "in png_write_zTXt");
comp.num_output_ptr = 0;
comp.max_output_ptr = 0;
@@ -1440,9 +1400,8 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
comp.input = NULL;
comp.input_len = 0;
- if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
+ if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
{
- png_warning(png_ptr, "Empty keyword in zTXt chunk");
png_free(png_ptr, new_key);
return;
}
@@ -1489,23 +1448,22 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
PNG_iTXt;
#endif
png_size_t lang_len, key_len, lang_key_len, text_len;
- png_charp new_lang, new_key;
+ png_charp new_lang;
+ png_charp new_key = NULL;
png_byte cbuf[2];
compression_state comp;
- png_debug(1, "in png_write_iTXt\n");
+ png_debug(1, "in png_write_iTXt");
comp.num_output_ptr = 0;
comp.max_output_ptr = 0;
comp.output_ptr = NULL;
comp.input = NULL;
- if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
- {
- png_warning(png_ptr, "Empty keyword in iTXt chunk");
+ if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
return;
- }
- if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
+
+ if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
{
png_warning(png_ptr, "Empty language field in iTXt chunk");
new_lang = NULL;
@@ -1581,7 +1539,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
#endif
png_byte buf[9];
- png_debug(1, "in png_write_oFFs\n");
+ png_debug(1, "in png_write_oFFs");
if (unit_type >= PNG_OFFSET_LAST)
png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
@@ -1607,14 +1565,14 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_charp new_purpose;
int i;
- png_debug1(1, "in png_write_pCAL (%d parameters)\n", nparams);
+ png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
if (type >= PNG_EQUATION_LAST)
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
- png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len);
+ png_debug1(3, "pCAL purpose length = %d", (int)purpose_len);
units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
- png_debug1(3, "pCAL units length = %d\n", (int)units_len);
+ png_debug1(3, "pCAL units length = %d", (int)units_len);
total_len = purpose_len + units_len + 10;
params_len = (png_uint_32p)png_malloc(png_ptr,
@@ -1625,12 +1583,12 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
for (i = 0; i < nparams; i++)
{
params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
- png_debug2(3, "pCAL parameter %d length = %lu\n", i,
+ png_debug2(3, "pCAL parameter %d length = %lu", i,
(unsigned long) params_len[i]);
total_len += (png_size_t)params_len[i];
}
- png_debug1(3, "pCAL total length = %d\n", (int)total_len);
+ png_debug1(3, "pCAL total length = %d", (int)total_len);
png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len);
png_write_chunk_data(png_ptr, (png_bytep)new_purpose,
(png_size_t)purpose_len);
@@ -1666,7 +1624,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
char buf[64];
png_size_t total_len;
- png_debug(1, "in png_write_sCAL\n");
+ png_debug(1, "in png_write_sCAL");
buf[0] = (char)unit;
#if defined(_WIN32_WCE)
@@ -1691,7 +1649,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
total_len += png_strlen(buf + total_len);
#endif
- png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
+ png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len);
}
#else
@@ -1706,7 +1664,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_byte buf[64];
png_size_t wlen, hlen, total_len;
- png_debug(1, "in png_write_sCAL_s\n");
+ png_debug(1, "in png_write_sCAL_s");
wlen = png_strlen(width);
hlen = png_strlen(height);
@@ -1721,7 +1679,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
- png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len);
+ png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
}
#endif
@@ -1740,7 +1698,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
#endif
png_byte buf[9];
- png_debug(1, "in png_write_pHYs\n");
+ png_debug(1, "in png_write_pHYs");
if (unit_type >= PNG_RESOLUTION_LAST)
png_warning(png_ptr, "Unrecognized unit type for pHYs chunk");
@@ -1764,7 +1722,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
#endif
png_byte buf[7];
- png_debug(1, "in png_write_tIME\n");
+ png_debug(1, "in png_write_tIME");
if (mod_time->month > 12 || mod_time->month < 1 ||
mod_time->day > 31 || mod_time->day < 1 ||
mod_time->hour > 23 || mod_time->second > 60)
@@ -1794,7 +1752,7 @@ png_write_acTL(png_structp png_ptr,
#endif
png_byte data[16];
- png_debug(1, "in png_write_acTL\n");
+ png_debug(1, "in png_write_acTL");
png_ptr->num_frames_to_write = num_frames;
@@ -1818,15 +1776,15 @@ png_write_fcTL(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
#endif
png_byte data[26];
- png_debug(1, "in png_write_fcTL\n");
+ png_debug(1, "in png_write_fcTL");
if (png_ptr->num_frames_written == 0 && (x_offset != 0 || y_offset != 0))
- png_error(png_ptr, "x and/or y offset for the first frame aren't 0\n");
+ png_error(png_ptr, "x and/or y offset for the first frame aren't 0");
if (png_ptr->num_frames_written == 0 &&
(width != png_ptr->first_frame_width ||
height != png_ptr->first_frame_height))
png_error(png_ptr, "width and/or height in the first frame's fcTL "
- "don't match the ones in IHDR\n");
+ "don't match the ones in IHDR");
/* more error checking */
png_ensure_fcTL_is_valid(png_ptr, width, height, x_offset, y_offset,
@@ -1872,7 +1830,7 @@ png_write_start_row(png_structp png_ptr)
png_size_t buf_size;
- png_debug(1, "in png_write_start_row\n");
+ png_debug(1, "in png_write_start_row");
buf_size = (png_size_t)(PNG_ROWBYTES(
png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1);
@@ -1972,7 +1930,7 @@ png_write_finish_row(png_structp png_ptr)
int ret;
- png_debug(1, "in png_write_finish_row\n");
+ png_debug(1, "in png_write_finish_row");
/* next row */
png_ptr->row_number++;
@@ -2081,7 +2039,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif
- png_debug(1, "in png_do_write_interlace\n");
+ png_debug(1, "in png_do_write_interlace");
/* we don't have to do anything on the last pass (6) */
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && pass < 6)
@@ -2252,7 +2210,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
int num_p_filters = (int)png_ptr->num_prev_filters;
#endif
- png_debug(1, "in png_write_find_filter\n");
+ png_debug(1, "in png_write_find_filter");
/* find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3;
@@ -2861,8 +2819,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
void /* PRIVATE */
png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
{
- png_debug(1, "in png_write_filtered_row\n");
- png_debug1(2, "filter = %d\n", filtered_row[0]);
+ png_debug(1, "in png_write_filtered_row");
+ png_debug1(2, "filter = %d", filtered_row[0]);
/* set up the zlib input buffer */
png_ptr->zstream.next_in = filtered_row;
@@ -2935,7 +2893,7 @@ png_write_reinit(png_structp png_ptr, png_infop info_ptr,
(width != png_ptr->first_frame_width ||
height != png_ptr->first_frame_height))
png_error(png_ptr, "width and/or height in the first frame's fcTL "
- "don't match the ones in IHDR\n");
+ "don't match the ones in IHDR");
if (width > png_ptr->first_frame_width ||
height > png_ptr->first_frame_height)
png_error(png_ptr, "width and/or height for a frame greater than"
diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
index 0c25cb44869e..e403ffac611f 100644
--- a/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
+++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.cpp
@@ -59,6 +59,13 @@
#include "nsCExternalHandlerService.h"
#include "nsDirectoryServiceDefs.h"
+#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+#ifdef _WIN32_WINNT
+#undef _WIN32_WINNT
+#endif
+#define _WIN32_WINNT 0x0600
+#endif
+
// we need windows.h to read out registry information...
#include
#include
@@ -82,6 +89,20 @@ struct ICONENTRY {
PRUint32 ieFileOffset;
};
+#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+typedef HRESULT (WINAPI*SHGetStockIconInfoPtr) (SHSTOCKICONID siid, UINT uFlags, SHSTOCKICONINFO *psii);
+
+// Match stock icons with names
+static SHSTOCKICONID GetStockIconIDForName(const nsACString &aStockName)
+{
+ // UAC shield icon
+ if (aStockName == NS_LITERAL_CSTRING("uac-shield"))
+ return SIID_SHIELD;
+
+ return SIID_INVALID;
+}
+#endif
+
// nsIconChannel methods
nsIconChannel::nsIconChannel()
{
@@ -272,7 +293,20 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI
return shellResult;
}
-nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
+static UINT GetSizeInfoFlag(PRUint32 aDesiredImageSize)
+{
+ UINT infoFlag;
+#ifndef WINCE
+ if (aDesiredImageSize > 16)
+ infoFlag = SHGFI_SHELLICONSIZE;
+ else
+#endif
+ infoFlag = SHGFI_SMALLICON;
+
+ return infoFlag;
+}
+
+nsresult nsIconChannel::GetHIconFromFile(HICON *hIcon)
{
nsXPIDLCString contentType;
nsCString fileExt;
@@ -309,12 +343,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
if (!fileExists)
infoFlags |= SHGFI_USEFILEATTRIBUTES;
-#ifndef WINCE
- if (desiredImageSize > 16)
- infoFlags |= SHGFI_SHELLICONSIZE;
- else
-#endif
- infoFlags |= SHGFI_SMALLICON;
+ infoFlags |= GetSizeInfoFlag(desiredImageSize);
// if we have a content type... then use it! but for existing files, we want
// to show their real icon.
@@ -331,8 +360,6 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
filePath = NS_LITERAL_CSTRING(".") + defFileExt;
}
- rv = NS_ERROR_NOT_AVAILABLE;
-
// Is this the "Desktop" folder?
DWORD shellResult = GetSpecialFolderIcon(localFile, CSIDL_DESKTOP, &sfi, infoFlags);
if (!shellResult) {
@@ -351,10 +378,83 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
if (shellResult && sfi.hIcon)
+ *hIcon = sfi.hIcon;
+ else
+ rv = NS_ERROR_NOT_AVAILABLE;
+
+ return rv;
+}
+
+#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon)
+{
+ nsresult rv = NS_OK;
+
+ // We can only do this on Vista or above
+ HMODULE hShellDLL = ::LoadLibraryW(L"shell32.dll");
+ SHGetStockIconInfoPtr pSHGetStockIconInfo =
+ (SHGetStockIconInfoPtr) ::GetProcAddress(hShellDLL, "SHGetStockIconInfo");
+
+ if (pSHGetStockIconInfo)
+ {
+ PRUint32 desiredImageSize;
+ aIconURI->GetImageSize(&desiredImageSize);
+ nsCAutoString stockIcon;
+ aIconURI->GetStockIcon(stockIcon);
+
+ SHSTOCKICONID stockIconID = GetStockIconIDForName(stockIcon);
+ if (stockIconID == SIID_INVALID)
+ return NS_ERROR_NOT_AVAILABLE;
+
+ UINT infoFlags = SHGSI_ICON;
+ infoFlags |= GetSizeInfoFlag(desiredImageSize);
+
+ SHSTOCKICONINFO sii = {0};
+ sii.cbSize = sizeof(sii);
+ HRESULT hr = pSHGetStockIconInfo(stockIconID, infoFlags, &sii);
+
+ if (SUCCEEDED(hr))
+ *hIcon = sii.hIcon;
+ else
+ rv = NS_ERROR_FAILURE;
+ }
+ else
+ {
+ rv = NS_ERROR_NOT_AVAILABLE;
+ }
+
+ if (hShellDLL)
+ ::FreeLibrary(hShellDLL);
+
+ return rv;
+}
+#endif
+
+nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
+{
+ // Check whether the icon requested's a file icon or a stock icon
+ nsresult rv;
+ HICON hIcon = NULL;
+
+#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+ nsCOMPtr iconURI(do_QueryInterface(mUrl, &rv));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsCAutoString stockIcon;
+ iconURI->GetStockIcon(stockIcon);
+ if (!stockIcon.IsEmpty())
+ rv = GetStockHIcon(iconURI, &hIcon);
+ else
+#endif
+ rv = GetHIconFromFile(&hIcon);
+
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ if (hIcon)
{
// we got a handle to an icon. Now we want to get a bitmap for the icon using GetIconInfo....
ICONINFO iconInfo;
- if (GetIconInfo(sfi.hIcon, &iconInfo))
+ if (GetIconInfo(hIcon, &iconInfo))
{
// we got the bitmaps, first find out their size
HDC hDC = CreateCompatibleDC(NULL); // get a device context for the screen.
@@ -419,8 +519,8 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
DeleteObject(iconInfo.hbmColor);
DeleteObject(iconInfo.hbmMask);
} // if we got icon info
- DestroyIcon(sfi.hIcon);
- } // if we got sfi
+ DestroyIcon(hIcon);
+ } // if we got an hIcon
return rv;
}
diff --git a/modules/libpr0n/decoders/icon/win/nsIconChannel.h b/modules/libpr0n/decoders/icon/win/nsIconChannel.h
index a69ea61c0d87..97d41e322452 100644
--- a/modules/libpr0n/decoders/icon/win/nsIconChannel.h
+++ b/modules/libpr0n/decoders/icon/win/nsIconChannel.h
@@ -49,6 +49,9 @@
#include "nsIURI.h"
#include "nsIInputStreamPump.h"
#include "nsIStreamListener.h"
+#include "nsIIconURI.h"
+
+#include
class nsIFile;
@@ -78,7 +81,14 @@ protected:
nsCOMPtr mListener;
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension);
+ nsresult GetHIconFromFile(HICON *hIcon);
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
+
+ // Functions specific to Vista and above
+#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
+protected:
+ nsresult GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon);
+#endif
};
#endif /* nsIconChannel_h___ */
diff --git a/modules/libpr0n/public/imgIRequest.idl b/modules/libpr0n/public/imgIRequest.idl
index 11b32a02e46a..4443c5c282bf 100644
--- a/modules/libpr0n/public/imgIRequest.idl
+++ b/modules/libpr0n/public/imgIRequest.idl
@@ -104,5 +104,16 @@ interface imgIRequest : nsIRequest
* The principal gotten from the channel the image was loaded from.
*/
readonly attribute nsIPrincipal imagePrincipal;
+
+ /**
+ * Cancels this request as in nsIRequest::Cancel(); further, also nulls out
+ * decoderObserver so it gets no further notifications from us.
+ *
+ * NOTE: You should not use this in any new code; instead, use cancel(). Note
+ * that cancel() is asynchronous, which means that some time after you call
+ * it, the listener/observer will get an OnStopRequest(). This means that, if
+ * you're the observer, you can't call cancel() from your destructor.
+ */
+ void cancelAndForgetObserver(in nsresult aStatus);
};
diff --git a/modules/libpr0n/src/imgContainer.cpp b/modules/libpr0n/src/imgContainer.cpp
index 647d4c4b5aa5..f64a835025ba 100644
--- a/modules/libpr0n/src/imgContainer.cpp
+++ b/modules/libpr0n/src/imgContainer.cpp
@@ -1224,9 +1224,9 @@ imgContainer::sDiscardTimerCallback(nsITimer *aTimer, void *aClosure)
int old_frame_count = self->mFrames.Count();
+ // Don't discard animated images, because we don't handle that very well. (See bug 414259.)
if (self->mAnim) {
- delete self->mAnim;
- self->mAnim = nsnull;
+ return;
}
self->mFrames.Clear();
diff --git a/modules/libpr0n/src/imgLoader.cpp b/modules/libpr0n/src/imgLoader.cpp
index fa45064b66c1..d5a070141957 100644
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -255,7 +255,7 @@ void imgCacheEntry::TouchWithSize(PRInt32 diff)
if (!Evicted()) {
nsCOMPtr uri;
- mRequest->GetURI(getter_AddRefs(uri));
+ mRequest->GetKeyURI(getter_AddRefs(uri));
imgLoader::CacheEntriesChanged(uri, diff);
}
}
@@ -269,7 +269,7 @@ void imgCacheEntry::Touch(PRBool updateTime /* = PR_TRUE */)
if (!Evicted()) {
nsCOMPtr uri;
- mRequest->GetURI(getter_AddRefs(uri));
+ mRequest->GetKeyURI(getter_AddRefs(uri));
imgLoader::CacheEntriesChanged(uri);
}
}
@@ -909,7 +909,7 @@ PRBool imgLoader::RemoveFromCache(imgCacheEntry *entry)
nsRefPtr request(getter_AddRefs(entry->GetRequest()));
if (request) {
nsCOMPtr key;
- if (NS_SUCCEEDED(request->GetURI(getter_AddRefs(key))) && key)
+ if (NS_SUCCEEDED(request->GetKeyURI(getter_AddRefs(key))) && key)
ret = RemoveFromCache(key);
}
@@ -1012,8 +1012,8 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
// for correctly dealing with image load requests that are a result
// of post data.
imgCacheTable &cache = GetCache(aURI);
- nsCAutoString spec;
+ nsCAutoString spec;
aURI->GetSpec(spec);
if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
@@ -1061,12 +1061,12 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
newChannel->SetLoadGroup(loadGroup);
void *cacheId = NS_GetCurrentThread();
- request->Init(aURI, loadGroup, entry, cacheId, aCX);
+ request->Init(aURI, aURI, loadGroup, newChannel, entry, cacheId, aCX);
// create the proxy listener
ProxyListener *pl = new ProxyListener(static_cast(request.get()));
if (!pl) {
- request->Cancel(NS_ERROR_OUT_OF_MEMORY);
+ request->CancelAndAbort(NS_ERROR_OUT_OF_MEMORY);
return NS_ERROR_OUT_OF_MEMORY;
}
@@ -1083,7 +1083,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
PR_LOG(gImgLog, PR_LOG_DEBUG,
("[this=%p] imgLoader::LoadImage -- AsyncOpen() failed: 0x%x\n",
this, openRes));
- request->Cancel(openRes);
+ request->CancelAndAbort(openRes);
return openRes;
}
@@ -1193,19 +1193,12 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgIDecoderOb
*listener = nsnull; // give them back a null nsIStreamListener
} else {
-
- // Get the current Thread... This is used as a cacheId to prevent
- // sharing requests which are being loaded across multiple threads...
- nsIThread *thread = NS_GetCurrentThread();
-
NewRequestAndEntry(uri, getter_AddRefs(request), getter_AddRefs(entry));
- // XXX(darin): I'm not sure that using the original URI is correct here.
- // Perhaps we should use the same URI that indexes the cache? Or, perhaps
- // the cache should use the original URI? See bug 89419.
+ // We use originalURI here to fulfil the imgIRequest contract on GetURI.
nsCOMPtr originalURI;
channel->GetOriginalURI(getter_AddRefs(originalURI));
- request->Init(originalURI, channel, entry, thread, aCX);
+ request->Init(originalURI, uri, channel, channel, entry, NS_GetCurrentThread(), aCX);
ProxyListener *pl = new ProxyListener(static_cast(request.get()));
if (!pl)
@@ -1475,12 +1468,10 @@ NS_IMETHODIMP imgCacheValidator::OnStartRequest(nsIRequest *aRequest, nsISupport
if (!NewRequestAndEntry(uri, &request, getter_AddRefs(entry)))
return NS_ERROR_OUT_OF_MEMORY;
- // XXX(darin): I'm not sure that using the original URI is correct here.
- // Perhaps we should use the same URI that indexes the cache? Or, perhaps
- // the cache should use the original URI? See bug 89419.
+ // We use originalURI here to fulfil the imgIRequest contract on GetURI.
nsCOMPtr originalURI;
channel->GetOriginalURI(getter_AddRefs(originalURI));
- request->Init(originalURI, channel, entry, NS_GetCurrentThread(), mContext);
+ request->Init(originalURI, uri, channel, channel, entry, NS_GetCurrentThread(), mContext);
ProxyListener *pl = new ProxyListener(static_cast(request));
if (!pl) {
diff --git a/modules/libpr0n/src/imgRequest.cpp b/modules/libpr0n/src/imgRequest.cpp
index 3675cc63aa5c..db652dfbb065 100644
--- a/modules/libpr0n/src/imgRequest.cpp
+++ b/modules/libpr0n/src/imgRequest.cpp
@@ -58,6 +58,7 @@
#include "nsIHttpChannel.h"
#include "nsIComponentManager.h"
+#include "nsIInterfaceRequestorUtils.h"
#include "nsIProxyObjectManager.h"
#include "nsIServiceManager.h"
#include "nsISupportsPrimitives.h"
@@ -73,10 +74,12 @@
PRLogModuleInfo *gImgLog = PR_NewLogModule("imgRequest");
#endif
-NS_IMPL_ISUPPORTS6(imgRequest, imgILoad,
+NS_IMPL_ISUPPORTS8(imgRequest, imgILoad,
imgIDecoderObserver, imgIContainerObserver,
nsIStreamListener, nsIRequestObserver,
- nsISupportsWeakReference)
+ nsISupportsWeakReference,
+ nsIChannelEventSink,
+ nsIInterfaceRequestor)
imgRequest::imgRequest() :
mLoading(PR_FALSE), mProcessing(PR_FALSE), mHadLastPart(PR_FALSE),
@@ -93,7 +96,9 @@ imgRequest::~imgRequest()
}
nsresult imgRequest::Init(nsIURI *aURI,
+ nsIURI *aKeyURI,
nsIRequest *aRequest,
+ nsIChannel *aChannel,
imgCacheEntry *aCacheEntry,
void *aCacheId,
void *aLoadId)
@@ -103,13 +108,22 @@ nsresult imgRequest::Init(nsIURI *aURI,
NS_ASSERTION(!mImage, "Multiple calls to init");
NS_ASSERTION(aURI, "No uri");
NS_ASSERTION(aRequest, "No request");
+ NS_ASSERTION(aChannel, "No channel");
mProperties = do_CreateInstance("@mozilla.org/properties;1");
if (!mProperties)
return NS_ERROR_OUT_OF_MEMORY;
mURI = aURI;
+ mKeyURI = aKeyURI;
mRequest = aRequest;
+ mChannel = aChannel;
+ mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
+
+ NS_ASSERTION(mPrevChannelSink != this,
+ "Initializing with a channel that already calls back to us!");
+
+ mChannel->SetNotificationCallbacks(this);
/* set our loading flag to true here.
Setting it here lets checks to see if the load is in progress
@@ -294,8 +308,21 @@ void imgRequest::Cancel(nsresult aStatus)
RemoveFromCache();
}
- if (mRequest && mLoading)
- mRequest->Cancel(aStatus);
+ if (mChannel && mLoading)
+ mChannel->Cancel(aStatus);
+}
+
+void imgRequest::CancelAndAbort(nsresult aStatus)
+{
+ Cancel(aStatus);
+
+ // It's possible for the channel to fail to open after we've set our
+ // notification callbacks. In that case, make sure to break the cycle between
+ // the channel and us, because it won't.
+ if (mChannel) {
+ mChannel->SetNotificationCallbacks(mPrevChannelSink);
+ mPrevChannelSink = nsnull;
+ }
}
nsresult imgRequest::GetURI(nsIURI **aURI)
@@ -311,6 +338,19 @@ nsresult imgRequest::GetURI(nsIURI **aURI)
return NS_ERROR_FAILURE;
}
+nsresult imgRequest::GetKeyURI(nsIURI **aKeyURI)
+{
+ LOG_FUNC(gImgLog, "imgRequest::GetKeyURI");
+
+ if (mKeyURI) {
+ *aKeyURI = mKeyURI;
+ NS_ADDREF(*aKeyURI);
+ return NS_OK;
+ }
+
+ return NS_ERROR_FAILURE;
+}
+
nsresult imgRequest::GetPrincipal(nsIPrincipal **aPrincipal)
{
LOG_FUNC(gImgLog, "imgRequest::GetPrincipal");
@@ -737,15 +777,21 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt,
}
// XXXldb What if this is a non-last part of a multipart request?
- // xxx before we release our reference to mChannel, lets
+ // xxx before we release our reference to mRequest, lets
// save the last status that we saw so that the
// imgRequestProxy will have access to it.
- if (mRequest)
- {
+ if (mRequest) {
mRequest->GetStatus(&mNetworkStatus);
mRequest = nsnull; // we no longer need the request
}
+ // stop holding a ref to the channel, since we don't need it anymore
+ if (mChannel) {
+ mChannel->SetNotificationCallbacks(mPrevChannelSink);
+ mPrevChannelSink = nsnull;
+ mChannel = nsnull;
+ }
+
// If mImage is still null, we didn't properly load the image.
if (NS_FAILED(status) || !mImage) {
this->Cancel(status); // sets status, stops animations, removes from cache
@@ -957,3 +1003,47 @@ imgRequest::GetNetworkStatus()
return status;
}
+
+/** nsIInterfaceRequestor methods **/
+
+NS_IMETHODIMP
+imgRequest::GetInterface(const nsIID & aIID, void **aResult)
+{
+ if (!mPrevChannelSink || aIID.Equals(NS_GET_IID(nsIChannelEventSink)))
+ return QueryInterface(aIID, aResult);
+
+ NS_ASSERTION(mPrevChannelSink != this,
+ "Infinite recursion - don't keep track of channel sinks that are us!");
+ return mPrevChannelSink->GetInterface(aIID, aResult);
+}
+
+/** nsIChannelEventSink methods **/
+
+/* void onChannelRedirect (in nsIChannel oldChannel, in nsIChannel newChannel, in unsigned long flags); */
+NS_IMETHODIMP
+imgRequest::OnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, PRUint32 flags)
+{
+ NS_ASSERTION(mRequest && mChannel, "Got an OnChannelRedirect after we nulled out mRequest!");
+ NS_ASSERTION(mChannel == oldChannel, "Got a channel redirect for an unknown channel!");
+ NS_ASSERTION(newChannel, "Got a redirect to a NULL channel!");
+
+ nsresult rv = NS_OK;
+ nsCOMPtr sink(do_GetInterface(mPrevChannelSink));
+ if (sink) {
+ rv = sink->OnChannelRedirect(oldChannel, newChannel, flags);
+ if (NS_FAILED(rv))
+ return rv;
+ }
+
+ RemoveFromCache();
+
+ mChannel = newChannel;
+
+ newChannel->GetOriginalURI(getter_AddRefs(mKeyURI));
+
+ // If we don't still have a cache entry, we don't want to refresh the cache.
+ if (mKeyURI && mCacheEntry)
+ imgLoader::PutIntoCache(mKeyURI, mCacheEntry);
+
+ return rv;
+}
diff --git a/modules/libpr0n/src/imgRequest.h b/modules/libpr0n/src/imgRequest.h
index 3e2ca32c0fca..cc1b5d55d965 100644
--- a/modules/libpr0n/src/imgRequest.h
+++ b/modules/libpr0n/src/imgRequest.h
@@ -46,7 +46,9 @@
#include "imgIDecoder.h"
#include "imgIDecoderObserver.h"
+#include "nsIChannelEventSink.h"
#include "nsIContentSniffer.h"
+#include "nsIInterfaceRequestor.h"
#include "nsIRequest.h"
#include "nsIProperties.h"
#include "nsIStreamListener.h"
@@ -76,7 +78,9 @@ enum {
class imgRequest : public imgILoad,
public imgIDecoderObserver,
public nsIStreamListener,
- public nsSupportsWeakReference
+ public nsSupportsWeakReference,
+ public nsIChannelEventSink,
+ public nsIInterfaceRequestor
{
public:
imgRequest();
@@ -85,7 +89,9 @@ public:
NS_DECL_ISUPPORTS
nsresult Init(nsIURI *aURI,
+ nsIURI *aKeyURI,
nsIRequest *aRequest,
+ nsIChannel *aChannel,
imgCacheEntry *aCacheEntry,
void *aCacheId,
void *aLoadId);
@@ -108,6 +114,11 @@ public:
// internal nsIChannel.
nsresult GetNetworkStatus();
+ // Cancel, but also ensure that all work done in Init() is undone. Call this
+ // only when the channel has failed to open, and so calling Cancel() on it
+ // won't be sufficient.
+ void CancelAndAbort(nsresult aStatus);
+
private:
friend class imgCacheEntry;
friend class imgRequestProxy;
@@ -122,6 +133,7 @@ private:
inline nsresult GetResultFromImageStatus(PRUint32 aStatus) const;
void Cancel(nsresult aStatus);
nsresult GetURI(nsIURI **aURI);
+ nsresult GetKeyURI(nsIURI **aURI);
nsresult GetPrincipal(nsIPrincipal **aPrincipal);
nsresult GetSecurityInfo(nsISupports **aSecurityInfo);
void RemoveFromCache();
@@ -150,15 +162,22 @@ public:
NS_DECL_IMGICONTAINEROBSERVER
NS_DECL_NSISTREAMLISTENER
NS_DECL_NSIREQUESTOBSERVER
+ NS_DECL_NSICHANNELEVENTSINK
+ NS_DECL_NSIINTERFACEREQUESTOR
private:
nsCOMPtr mRequest;
+ // The original URI we were loaded with.
nsCOMPtr mURI;
+ // The URI we are keyed on in the cache.
+ nsCOMPtr mKeyURI;
nsCOMPtr mPrincipal;
nsCOMPtr mImage;
nsCOMPtr mDecoder;
nsCOMPtr mProperties;
nsCOMPtr mSecurityInfo;
+ nsCOMPtr mChannel;
+ nsCOMPtr mPrevChannelSink;
nsTObserverArray mObservers;
diff --git a/modules/libpr0n/src/imgRequestProxy.cpp b/modules/libpr0n/src/imgRequestProxy.cpp
index 0bebed2a0eba..3bf61de8a0a0 100644
--- a/modules/libpr0n/src/imgRequestProxy.cpp
+++ b/modules/libpr0n/src/imgRequestProxy.cpp
@@ -74,6 +74,7 @@ imgRequestProxy::~imgRequestProxy()
{
/* destructor code */
NS_PRECONDITION(!mListener, "Someone forgot to properly cancel this request!");
+
// Explicitly set mListener to null to ensure that the RemoveProxy
// call below can't send |this| to an arbitrary listener while |this|
// is being destroyed. This is all belt-and-suspenders in view of the
@@ -97,8 +98,6 @@ imgRequestProxy::~imgRequestProxy()
}
}
-
-
nsresult imgRequestProxy::Init(imgRequest *request, nsILoadGroup *aLoadGroup, imgIDecoderObserver *aObserver)
{
NS_PRECONDITION(!mOwner && !mListener, "imgRequestProxy is already initialized");
@@ -197,6 +196,8 @@ NS_IMETHODIMP imgRequestProxy::IsPending(PRBool *_retval)
/* readonly attribute nsresult status; */
NS_IMETHODIMP imgRequestProxy::GetStatus(nsresult *aStatus)
{
+ // XXXbz this is wrong... Canceling with a status should make that
+ // status the status of the request, generally.
if (!mOwner)
return NS_ERROR_FAILURE;
@@ -215,11 +216,35 @@ NS_IMETHODIMP imgRequestProxy::Cancel(nsresult status)
mCanceled = PR_TRUE;
+ nsCOMPtr ev = new imgCancelRunnable(this, status);
+ return NS_DispatchToCurrentThread(ev);
+}
+
+void
+imgRequestProxy::DoCancel(nsresult status)
+{
// Passing false to aNotify means that mListener will still get
// OnStopRequest, if needed.
mOwner->RemoveProxy(this, status, PR_FALSE);
NullOutListener();
+}
+
+/* void cancelAndForgetObserver (in nsresult aStatus); */
+NS_IMETHODIMP imgRequestProxy::CancelAndForgetObserver(nsresult aStatus)
+{
+ if (mCanceled || !mOwner)
+ return NS_ERROR_FAILURE;
+
+ LOG_SCOPE(gImgLog, "imgRequestProxy::CancelAndForgetObserver");
+
+ mCanceled = PR_TRUE;
+
+ // Passing false to aNotify means that mListener will still get
+ // OnStopRequest, if needed.
+ mOwner->RemoveProxy(this, aStatus, PR_FALSE);
+
+ NullOutListener();
return NS_OK;
}
@@ -400,7 +425,7 @@ void imgRequestProxy::FrameChanged(imgIContainer *container, gfxIImageFrame *new
{
LOG_FUNC(gImgLog, "imgRequestProxy::FrameChanged");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->FrameChanged(container, newframe, dirtyRect);
@@ -413,7 +438,7 @@ void imgRequestProxy::OnStartDecode()
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStartDecode");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStartDecode(this);
@@ -424,7 +449,7 @@ void imgRequestProxy::OnStartContainer(imgIContainer *image)
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStartContainer");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStartContainer(this, image);
@@ -435,7 +460,7 @@ void imgRequestProxy::OnStartFrame(gfxIImageFrame *frame)
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStartFrame");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStartFrame(this, frame);
@@ -446,7 +471,7 @@ void imgRequestProxy::OnDataAvailable(gfxIImageFrame *frame, const nsIntRect * r
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnDataAvailable");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnDataAvailable(this, frame, rect);
@@ -457,7 +482,7 @@ void imgRequestProxy::OnStopFrame(gfxIImageFrame *frame)
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStopFrame");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStopFrame(this, frame);
@@ -468,7 +493,7 @@ void imgRequestProxy::OnStopContainer(imgIContainer *image)
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStopContainer");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStopContainer(this, image);
@@ -479,7 +504,7 @@ void imgRequestProxy::OnStopDecode(nsresult status, const PRUnichar *statusArg)
{
LOG_FUNC(gImgLog, "imgRequestProxy::OnStopDecode");
- if (mListener) {
+ if (mListener && !mCanceled) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
mListener->OnStopDecode(this, status, statusArg);
@@ -496,6 +521,8 @@ void imgRequestProxy::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::OnStartRequest", "name", name.get());
#endif
+ // Notify even if mCanceled, since OnStartRequest is guaranteed by the
+ // nsIStreamListener contract so it makes sense to do the same here.
if (mListener) {
// Hold a ref to the listener while we call it, just in case.
nsCOMPtr kungFuDeathGrip(mListener);
diff --git a/modules/libpr0n/src/imgRequestProxy.h b/modules/libpr0n/src/imgRequestProxy.h
index 5f79e200bb45..727829e7668f 100644
--- a/modules/libpr0n/src/imgRequestProxy.h
+++ b/modules/libpr0n/src/imgRequestProxy.h
@@ -49,6 +49,7 @@
#include "nsISupportsPriority.h"
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
+#include "nsThreadUtils.h"
#include "imgRequest.h"
@@ -85,6 +86,28 @@ public:
protected:
friend class imgRequest;
+ class imgCancelRunnable;
+ friend class imgCancelRunnable;
+
+ class imgCancelRunnable : public nsRunnable
+ {
+ public:
+ imgCancelRunnable(imgRequestProxy* owner, nsresult status)
+ : mOwner(owner), mStatus(status)
+ {}
+
+ NS_IMETHOD Run() {
+ mOwner->DoCancel(mStatus);
+ return NS_OK;
+ }
+
+ private:
+ nsRefPtr mOwner;
+ nsresult mStatus;
+ };
+
+
+
/* non-virtual imgIDecoderObserver methods */
void OnStartDecode ();
void OnStartContainer(imgIContainer *aContainer);
@@ -105,6 +128,9 @@ protected:
return mListener != nsnull;
}
+ /* Finish up canceling ourselves */
+ void DoCancel(nsresult status);
+
/* Do the proper refcount management to null out mListener */
void NullOutListener();
diff --git a/modules/libpr0n/test/mochitest/Makefile.in b/modules/libpr0n/test/mochitest/Makefile.in
index 55e1af84b406..a49a2a9a3637 100644
--- a/modules/libpr0n/test/mochitest/Makefile.in
+++ b/modules/libpr0n/test/mochitest/Makefile.in
@@ -46,6 +46,9 @@ include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug399925.html \
bug399925.gif \
+ bug468160.sjs \
+ test_bug468160.html \
+ red.png \
$(NULL)
libs:: $(_TEST_FILES)
diff --git a/modules/libpr0n/test/mochitest/bug468160.sjs b/modules/libpr0n/test/mochitest/bug468160.sjs
new file mode 100644
index 000000000000..4a654216a57d
--- /dev/null
+++ b/modules/libpr0n/test/mochitest/bug468160.sjs
@@ -0,0 +1,6 @@
+function handleRequest(request, response)
+{
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", "red.png", false);
+ response.setHeader("Cache-Control", "no-cache", false);
+}
diff --git a/modules/libpr0n/test/mochitest/red.png b/modules/libpr0n/test/mochitest/red.png
new file mode 100644
index 000000000000..aa9ce252631e
Binary files /dev/null and b/modules/libpr0n/test/mochitest/red.png differ
diff --git a/modules/libpr0n/test/mochitest/test_bug468160.html b/modules/libpr0n/test/mochitest/test_bug468160.html
new file mode 100644
index 000000000000..331406e782fc
--- /dev/null
+++ b/modules/libpr0n/test/mochitest/test_bug468160.html
@@ -0,0 +1,30 @@
+
+
+
+
+ Test for Bug 468160
+
+
+
+
+
+Mozilla Bug 468160
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/libpr0n/test/reftest/generic/green.png b/modules/libpr0n/test/reftest/generic/green.png
index 447d9e301296..4718c00e62be 100644
Binary files a/modules/libpr0n/test/reftest/generic/green.png and b/modules/libpr0n/test/reftest/generic/green.png differ
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
index 8d5ffafd83cd..5ec8aa68fe11 100644
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -860,7 +860,7 @@ pref("intl.charsetmenu.browser.more2", "chrome://global/locale/intl.propert
pref("intl.charsetmenu.browser.more3", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more4", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.more5", "chrome://global/locale/intl.properties");
-pref("intl.charsetmenu.browser.unicode", "chrome://global/locale/intl.properties");
+pref("intl.charsetmenu.browser.unicode", "UTF-8, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE, UTF-32BE");
pref("intl.charsetmenu.mailedit", "chrome://global/locale/intl.properties");
pref("intl.charsetmenu.browser.cache", "");
pref("intl.charsetmenu.mailview.cache", "");
diff --git a/other-licenses/7zstub/sunbird/7zSD.sfx b/other-licenses/7zstub/sunbird/7zSD.sfx
index 05a47ad639cf..bddeb5438aed 100755
Binary files a/other-licenses/7zstub/sunbird/7zSD.sfx and b/other-licenses/7zstub/sunbird/7zSD.sfx differ
diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp
index 7ca22a82c9df..32db962f1e21 100644
--- a/parser/htmlparser/src/nsParser.cpp
+++ b/parser/htmlparser/src/nsParser.cpp
@@ -1704,6 +1704,13 @@ nsParser::ContinueParsing()
NS_IMETHODIMP
nsParser::ContinueInterruptedParsing()
{
+ // If there are scripts executing, then the content sink is jumping the gun
+ // (probably due to a synchronous XMLHttpRequest) and will re-enable us
+ // later, see bug 460706.
+ if (mScriptsExecuting) {
+ return NS_OK;
+ }
+
// If the stream has already finished, there's a good chance
// that we might start closing things down when the parser
// is reenabled. To make sure that we're not deleted across
diff --git a/security/manager/ssl/src/nsNSSCertHelper.cpp b/security/manager/ssl/src/nsNSSCertHelper.cpp
index fd7d488ce2ec..dcd4104993fb 100644
--- a/security/manager/ssl/src/nsNSSCertHelper.cpp
+++ b/security/manager/ssl/src/nsNSSCertHelper.cpp
@@ -1003,6 +1003,9 @@ ProcessGeneralName(PRArenaPool *arena,
nsXPIDLString value;
nsresult rv = NS_OK;
+ if (!current)
+ return NS_ERROR_NULL_POINTER;
+
switch (current->type) {
case certOtherName: {
SECOidTag oidTag = SECOID_FindOIDTag(¤t->name.OthName.oid);
diff --git a/testing/crashtest/crashtests.list b/testing/crashtest/crashtests.list
index c20eafb3792f..d983b2b79070 100644
--- a/testing/crashtest/crashtests.list
+++ b/testing/crashtest/crashtests.list
@@ -16,6 +16,7 @@ include ../../content/xslt/crashtests/crashtests.list
include ../../content/xul/content/crashtests/crashtests.list
include ../../content/xul/document/crashtests/crashtests.list
include ../../content/xul/templates/src/crashtests/crashtests.list
+include ../../content/mathml/content/crashtests/crashtests.list
include ../../docshell/base/crashtests/crashtests.list
diff --git a/testing/mochitest/ssltunnel/ssltunnel.cpp b/testing/mochitest/ssltunnel/ssltunnel.cpp
index eab2c5cdabeb..dce40a33272c 100644
--- a/testing/mochitest/ssltunnel/ssltunnel.cpp
+++ b/testing/mochitest/ssltunnel/ssltunnel.cpp
@@ -229,7 +229,6 @@ void HandleConnection(void* data)
{
connection_info_t* ci = static_cast(data);
PRIntervalTime connect_timeout = PR_SecondsToInterval(2);
- PRIntervalTime short_timeout = PR_MillisecondsToInterval(250);
AutoFD other_sock(PR_NewTCPSocket());
bool client_done = false;
@@ -489,7 +488,7 @@ char* password_func(PK11SlotInfo* slot, PRBool retry, void* arg)
if (retry)
return NULL;
- return "";
+ return PL_strdup("");
}
server_info_t* findServerInfo(int portnumber)
diff --git a/toolkit/components/places/src/nsPlacesDBFlush.js b/toolkit/components/places/src/nsPlacesDBFlush.js
index 1aa8cf2a1105..a28f3a095e29 100644
--- a/toolkit/components/places/src/nsPlacesDBFlush.js
+++ b/toolkit/components/places/src/nsPlacesDBFlush.js
@@ -90,6 +90,17 @@ function nsPlacesDBFlush()
// Create our timer to update everything
this._timer = this._newTimer();
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// Smart Getters
+
+ this.__defineGetter__("_db", function() {
+ delete this._db;
+ return this._db = Cc["@mozilla.org/browser/nav-history-service;1"].
+ getService(Ci.nsPIPlacesDatabase).
+ DBConnection;
+ });
+
}
nsPlacesDBFlush.prototype = {
@@ -312,16 +323,6 @@ nsPlacesDBFlush.prototype = {
])
};
-//////////////////////////////////////////////////////////////////////////////
-//// Smart Getters
-
-nsPlacesDBFlush.prototype.__defineGetter__("_db", function() {
- delete nsPlacesDBFlush._db;
- return nsPlacesDBFlush._db = Cc["@mozilla.org/browser/nav-history-service;1"].
- getService(Ci.nsPIPlacesDatabase).
- DBConnection;
-});
-
////////////////////////////////////////////////////////////////////////////////
//// Module Registration
diff --git a/toolkit/components/places/tests/chrome/Makefile.in b/toolkit/components/places/tests/chrome/Makefile.in
index 6699b19b285b..acbacf30a380 100644
--- a/toolkit/components/places/tests/chrome/Makefile.in
+++ b/toolkit/components/places/tests/chrome/Makefile.in
@@ -57,7 +57,6 @@ _CHROME_FILES = \
test_342484.xul \
test_341972a.xul \
test_381357.xul \
- test_423060.xul \
$(NULL)
libs:: $(_HTTP_FILES)
diff --git a/toolkit/components/places/tests/sync/test_database_sync_embed_visits.js b/toolkit/components/places/tests/sync/test_database_sync_embed_visits.js
index e1fcb829c00e..48f421d7d9bf 100644
--- a/toolkit/components/places/tests/sync/test_database_sync_embed_visits.js
+++ b/toolkit/components/places/tests/sync/test_database_sync_embed_visits.js
@@ -74,10 +74,7 @@ var observer = {
if (aTopic == kSyncFinished && this.visitId != -1) {
// remove the observer, we don't need to observe sync on quit
os.removeObserver(this, kSyncFinished);
- dump("\n\n");
- dump_table("moz_places_temp");
- dump_table("moz_places");
- dump("\n\n");
+
// Check that moz_places table has been correctly synced
var stmt = dbConn.createStatement(
"SELECT id FROM moz_places WHERE url = :url");
@@ -135,7 +132,7 @@ var observer = {
do_check_false(stmt.executeStep());
stmt.finalize();
- do_test_finished();
+ finish_test();
}
}
}
diff --git a/toolkit/content/tests/widgets/test_videocontrols.html b/toolkit/content/tests/widgets/test_videocontrols.html
index 93c526a81841..d78a392d00e2 100644
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -11,37 +11,27 @@
-
+