From 22588c1b7866ac12d582ab221b452635a3a9406f Mon Sep 17 00:00:00 2001
From: Oleg Romashin
Date: Fri, 2 Apr 2010 10:08:30 -0400
Subject: [PATCH 01/62] Bug 551666 - Provide possibility to compile and render
Qt port with QGLWidget backend. r=dougt
--HG--
extra : rebase_source : 00d53f71a00e71cf8b777779fc84ea45361256ea
---
configure.in | 4 ++--
widget/src/qt/mozqwidget.h | 4 ++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/configure.in b/configure.in
index 2f23b4738a10..d55697f2489e 100644
--- a/configure.in
+++ b/configure.in
@@ -5084,10 +5084,10 @@ then
[ QTDIR=$withval])
if test -z "$QTDIR"; then
- PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore)
+ PKG_CHECK_MODULES(MOZ_QT, QtGui QtNetwork QtCore QtOpenGL)
AC_CHECK_PROGS(HOST_MOC, moc, "")
else
- MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml"
+ MOZ_QT_LIBS="-L$QTDIR/lib/ -lQtGui -lQtNetwork -lQtCore -lQtDBus -lQtXml -lQtOpenGL"
MOZ_QT_CFLAGS="-DQT_SHARED"
MOZ_QT_CFLAGS="$MOZ_QT_CFLAGS -I$QTDIR/include"
diff --git a/widget/src/qt/mozqwidget.h b/widget/src/qt/mozqwidget.h
index 48839529f216..a4a4ba764d19 100644
--- a/widget/src/qt/mozqwidget.h
+++ b/widget/src/qt/mozqwidget.h
@@ -4,8 +4,10 @@
#include
#include
#include
+#include
#include "nsIWidget.h"
+#include "prenv.h"
class QEvent;
class QPixmap;
@@ -147,6 +149,8 @@ public:
: QGraphicsView (new QGraphicsScene(), aParent)
, mEventHandler(this, aTopLevel)
{
+ if (PR_GetEnv("MOZ_QT_GL"))
+ setViewport(new QGLWidget());
scene()->addItem(aTopLevel);
}
From c5ced7e57d9a5517bb77f7bb8ba32b581894b180 Mon Sep 17 00:00:00 2001
From: Oleg Romashin
Date: Fri, 2 Apr 2010 15:59:55 -0400
Subject: [PATCH 02/62] Bug 556718 - Enable WebGL for Qt builds.
r=ted.mielczarek
---
configure.in | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure.in b/configure.in
index d55697f2489e..8791dc36eebd 100644
--- a/configure.in
+++ b/configure.in
@@ -4976,6 +4976,8 @@ cairo-qt)
MOZ_WIDGET_TOOLKIT=qt
MOZ_ENABLE_QT=1
MOZ_ENABLE_XREMOTE=1
+ MOZ_WEBGL=1
+ MOZ_WEBGL_GLX=1
USE_ELF_DYNSTR_GC=
NS_PRINTING=
From b113991cf731f198e86014d27d6f4ed8a00dcfd1 Mon Sep 17 00:00:00 2001
From: Serge Gautherie
Date: Fri, 2 Apr 2010 18:25:13 +0200
Subject: [PATCH 03/62] Bug 541671 - [SeaMonkey 2.1] xpcshell:
test_bug519468.js fails; (Av1) Call checkForNewChrome(), s/TmpD/ProfD/.
r=benjamin.
---
chrome/test/unit/test_bug519468.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/chrome/test/unit/test_bug519468.js b/chrome/test/unit/test_bug519468.js
index 3e10d1f918c2..2d60ab07600d 100644
--- a/chrome/test/unit/test_bug519468.js
+++ b/chrome/test/unit/test_bug519468.js
@@ -56,8 +56,9 @@ else if (systemLocale == "fr-FR")
else
locales = [ "en-US", systemLocale, "fr-FR" ];
+do_get_profile();
var workingDir = Cc["@mozilla.org/file/directory_service;1"].
- getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile);
+ getService(Ci.nsIProperties).get("ProfD", Ci.nsIFile);
var manifest = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
manifest.initWithFile(workingDir);
manifest.append("test_bug519468.manifest");
@@ -78,6 +79,7 @@ registerManifests(MANIFESTS);
var chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry)
.QueryInterface(Ci.nsIToolkitChromeRegistry);
+chromeReg.checkForNewChrome();
var prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
@@ -116,5 +118,4 @@ function run_test()
test.package = "testmatchos";
test_locale(test);
}
- manifest.remove(false);
}
From 27fb414cc88e9a9de52610f1daf6a0821ade8d81 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 09:34:30 -0700
Subject: [PATCH 04/62] (no bug) Remove method-declaration for unused &
undefined function "UpdateValuesArray" in nsSMILAnimationFunction. (no
review; one-liner, removing unused code)
---
content/smil/nsSMILAnimationFunction.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/content/smil/nsSMILAnimationFunction.h b/content/smil/nsSMILAnimationFunction.h
index b2f61478e4af..6fcc3b07ceac 100644
--- a/content/smil/nsSMILAnimationFunction.h
+++ b/content/smil/nsSMILAnimationFunction.h
@@ -324,7 +324,6 @@ protected:
nsSMILValue& aResult, PRBool& aCanCacheSoFar) const;
nsresult GetValues(const nsISMILAttr& aSMILAttr,
nsSMILValueArray& aResult);
- void UpdateValuesArray();
void CheckKeyTimes(PRUint32 aNumValues);
void CheckKeySplines(PRUint32 aNumValues);
From 059379486c7e9260ef8bf00eb70425015f565a65 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 09:34:30 -0700
Subject: [PATCH 05/62] (no bug) Unset executable flag on a few .cpp & .h files
in /xpcom/tests. (no review; just a "chmod -x")
---
xpcom/tests/MoreTestingAtoms.cpp | 0
xpcom/tests/MoreTestingAtoms.h | 0
xpcom/tests/TestingAtoms.cpp | 0
xpcom/tests/TestingAtoms.h | 0
4 files changed, 0 insertions(+), 0 deletions(-)
mode change 100755 => 100644 xpcom/tests/MoreTestingAtoms.cpp
mode change 100755 => 100644 xpcom/tests/MoreTestingAtoms.h
mode change 100755 => 100644 xpcom/tests/TestingAtoms.cpp
mode change 100755 => 100644 xpcom/tests/TestingAtoms.h
diff --git a/xpcom/tests/MoreTestingAtoms.cpp b/xpcom/tests/MoreTestingAtoms.cpp
old mode 100755
new mode 100644
diff --git a/xpcom/tests/MoreTestingAtoms.h b/xpcom/tests/MoreTestingAtoms.h
old mode 100755
new mode 100644
diff --git a/xpcom/tests/TestingAtoms.cpp b/xpcom/tests/TestingAtoms.cpp
old mode 100755
new mode 100644
diff --git a/xpcom/tests/TestingAtoms.h b/xpcom/tests/TestingAtoms.h
old mode 100755
new mode 100644
From b5eb8254ec3409103b42a43d6775a296a140b522 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 09:34:31 -0700
Subject: [PATCH 06/62] Bug 556559: Fix unsigned/signed comparison warnings in
TestTArray.cpp. r=bsmedberg
---
xpcom/tests/TestTArray.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/xpcom/tests/TestTArray.cpp b/xpcom/tests/TestTArray.cpp
index 2d842d678951..adec1750810d 100644
--- a/xpcom/tests/TestTArray.cpp
+++ b/xpcom/tests/TestTArray.cpp
@@ -102,7 +102,7 @@ static PRBool test_basic_array(ElementType *data,
if (ary.BinaryIndexOf(ary[i]) != i)
return PR_FALSE;
}
- if (ary.BinaryIndexOf(extra) != -1)
+ if (ary.BinaryIndexOf(extra) != ary.NoIndex)
return PR_FALSE;
PRUint32 oldLen = ary.Length();
ary.RemoveElement(data[dataLen / 2]);
@@ -315,7 +315,7 @@ static PRBool test_string_array() {
if (strArray.BinaryIndexOf(strArray[i]) != i)
return PR_FALSE;
}
- if (strArray.BinaryIndexOf(EmptyCString()) != -1)
+ if (strArray.BinaryIndexOf(EmptyCString()) != strArray.NoIndex)
return PR_FALSE;
nsCString rawArray[NS_ARRAY_LENGTH(kdata)-1];
@@ -518,7 +518,7 @@ static PRBool test_indexof() {
array.AppendElement(5);
array.RemoveElementAt(1);
// we should not find the 5!
- return array.IndexOf(5, 1) == -1;
+ return array.IndexOf(5, 1) == array.NoIndex;
}
//----
From 3de1190d72610f57e33328a56c2cb12d16bd3342 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 09:34:31 -0700
Subject: [PATCH 07/62] Bug 556404: Put CSS parser in SVG mode when parsing
SMIL animation endpoints for XML attributes. r=roc r=dbaron
---
content/smil/nsSMILCSSProperty.cpp | 7 +++---
content/smil/nsSMILCSSValueType.cpp | 8 +++---
content/smil/nsSMILCSSValueType.h | 6 ++++-
content/smil/nsSMILMappedAttribute.cpp | 25 +++++++++++++++++--
content/smil/nsSMILMappedAttribute.h | 4 +++
.../anim-mapped-fontsize-1-from-to-no-no.svg | 17 +++++++++++++
.../anim-mapped-fontsize-1-from-to-no-px.svg | 17 +++++++++++++
.../anim-mapped-fontsize-1-from-to-px-no.svg | 17 +++++++++++++
layout/reftests/svg/smil/style/reftest.list | 5 ++++
layout/style/nsStyleAnimation.cpp | 24 ++++++++++--------
layout/style/nsStyleAnimation.h | 9 +++----
11 files changed, 114 insertions(+), 25 deletions(-)
create mode 100644 layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-no.svg
create mode 100644 layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-px.svg
create mode 100644 layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-px-no.svg
diff --git a/content/smil/nsSMILCSSProperty.cpp b/content/smil/nsSMILCSSProperty.cpp
index 60040a5b8ae2..9a69454b248c 100644
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -143,8 +143,8 @@ nsSMILCSSProperty::GetBaseValue() const
// (4) Populate our nsSMILValue from the computed style
if (didGetComputedVal) {
- nsSMILCSSValueType::ValueFromString(mPropID, mElement,
- computedStyleVal, baseValue);
+ nsSMILCSSValueType::ValueFromString(mPropID, mElement, computedStyleVal,
+ PR_FALSE, baseValue);
}
return baseValue;
}
@@ -157,7 +157,8 @@ nsSMILCSSProperty::ValueFromString(const nsAString& aStr,
{
NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
- nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr, aValue);
+ nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr,
+ PR_FALSE, aValue);
if (aValue.IsNull()) {
return NS_ERROR_FAILURE;
}
diff --git a/content/smil/nsSMILCSSValueType.cpp b/content/smil/nsSMILCSSValueType.cpp
index 5bdd30a8e5e9..a2b2d688203a 100644
--- a/content/smil/nsSMILCSSValueType.cpp
+++ b/content/smil/nsSMILCSSValueType.cpp
@@ -337,6 +337,7 @@ ValueFromStringHelper(nsCSSProperty aPropID,
nsIContent* aTargetElement,
nsPresContext* aPresContext,
const nsAString& aString,
+ PRBool aUseSVGMode,
nsStyleAnimation::Value& aStyleAnimValue)
{
// If value is negative, we'll strip off the "-" so the CSS parser won't
@@ -351,8 +352,8 @@ ValueFromStringHelper(nsCSSProperty aPropID,
subStringBegin = (PRUint32)absValuePos; // Start parsing after '-' sign
}
nsDependentSubstring subString(aString, subStringBegin);
- if (!nsStyleAnimation::ComputeValue(aPropID, aTargetElement,
- subString, aStyleAnimValue)) {
+ if (!nsStyleAnimation::ComputeValue(aPropID, aTargetElement, subString,
+ aUseSVGMode, aStyleAnimValue)) {
return PR_FALSE;
}
if (isNegative) {
@@ -375,6 +376,7 @@ void
nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
nsIContent* aTargetElement,
const nsAString& aString,
+ PRBool aUseSVGMode,
nsSMILValue& aValue)
{
NS_ABORT_IF_FALSE(aValue.IsNull(), "Outparam should be null-typed");
@@ -386,7 +388,7 @@ nsSMILCSSValueType::ValueFromString(nsCSSProperty aPropID,
nsStyleAnimation::Value parsedValue;
if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
- aString, parsedValue)) {
+ aString, aUseSVGMode, parsedValue)) {
sSingleton.Init(aValue);
aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue, presContext);
if (!aValue.mU.mPtr) {
diff --git a/content/smil/nsSMILCSSValueType.h b/content/smil/nsSMILCSSValueType.h
index 7c1387e7c7bc..aff95c57514a 100644
--- a/content/smil/nsSMILCSSValueType.h
+++ b/content/smil/nsSMILCSSValueType.h
@@ -92,6 +92,8 @@ public:
* @param aTargetElement The target element to whom the property/value
* setting applies.
* @param aString The string to be parsed as a CSS value.
+ * @param aUseSVGMode A flag to indicate whether we should parse
+ * |aString| in SVG mode.
* @param [out] aValue The nsSMILValue to be populated. Should
* initially be null-typed.
* @pre aValue.IsNull()
@@ -99,7 +101,9 @@ public:
*/
static void ValueFromString(nsCSSProperty aPropID,
nsIContent* aTargetElement,
- const nsAString& aString, nsSMILValue& aValue);
+ const nsAString& aString,
+ PRBool aUseSVGMode,
+ nsSMILValue& aValue);
/**
* Creates a string representation of the given nsSMILValue.
diff --git a/content/smil/nsSMILMappedAttribute.cpp b/content/smil/nsSMILMappedAttribute.cpp
index 809976224e3f..8eea7870a746 100644
--- a/content/smil/nsSMILMappedAttribute.cpp
+++ b/content/smil/nsSMILMappedAttribute.cpp
@@ -57,6 +57,27 @@ ReleaseStringBufferPropertyValue(void* aObject, /* unused */
buf->Release();
}
+
+nsresult
+nsSMILMappedAttribute::ValueFromString(const nsAString& aStr,
+ const nsISMILAnimationElement* aSrcElement,
+ nsSMILValue& aValue,
+ PRBool& aCanCache) const
+{
+ NS_ENSURE_TRUE(IsPropertyAnimatable(mPropID), NS_ERROR_FAILURE);
+
+ nsSMILCSSValueType::ValueFromString(mPropID, mElement, aStr,
+ PR_TRUE, aValue);
+ if (aValue.IsNull()) {
+ return NS_ERROR_FAILURE;
+ }
+
+ // XXXdholbert: For simplicity, just assume that all CSS values have to
+ // reparsed every sample. See note in nsSMILCSSProperty::ValueFromString.
+ aCanCache = PR_FALSE;
+ return NS_OK;
+}
+
nsSMILValue
nsSMILMappedAttribute::GetBaseValue() const
{
@@ -66,8 +87,8 @@ nsSMILMappedAttribute::GetBaseValue() const
baseStringValue);
nsSMILValue baseValue;
if (success) {
- nsSMILCSSValueType::ValueFromString(mPropID, mElement,
- baseStringValue, baseValue);
+ nsSMILCSSValueType::ValueFromString(mPropID, mElement, baseStringValue,
+ PR_TRUE, baseValue);
} else {
// Attribute is unset -- use computed value.
// FIRST: Temporarily clear animated value, to make sure it doesn't pollute
diff --git a/content/smil/nsSMILMappedAttribute.h b/content/smil/nsSMILMappedAttribute.h
index d95240308244..2d87a5dafdb8 100644
--- a/content/smil/nsSMILMappedAttribute.h
+++ b/content/smil/nsSMILMappedAttribute.h
@@ -70,6 +70,10 @@ public:
nsSMILCSSProperty(aPropID, aElement) {}
// nsISMILAttr methods
+ virtual nsresult ValueFromString(const nsAString& aStr,
+ const nsISMILAnimationElement* aSrcElement,
+ nsSMILValue& aValue,
+ PRBool& aCanCache) const;
virtual nsSMILValue GetBaseValue() const;
virtual nsresult SetAnimValue(const nsSMILValue& aValue);
virtual void ClearAnimValue();
diff --git a/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-no.svg b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-no.svg
new file mode 100644
index 000000000000..2583c2a7ce1c
--- /dev/null
+++ b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-no.svg
@@ -0,0 +1,17 @@
+
diff --git a/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-px.svg b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-px.svg
new file mode 100644
index 000000000000..4a487ece7a3d
--- /dev/null
+++ b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-no-px.svg
@@ -0,0 +1,17 @@
+
diff --git a/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-px-no.svg b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-px-no.svg
new file mode 100644
index 000000000000..689fd045d4c2
--- /dev/null
+++ b/layout/reftests/svg/smil/style/anim-mapped-fontsize-1-from-to-px-no.svg
@@ -0,0 +1,17 @@
+
diff --git a/layout/reftests/svg/smil/style/reftest.list b/layout/reftests/svg/smil/style/reftest.list
index 7ef343d6ed8e..80db15d193bb 100644
--- a/layout/reftests/svg/smil/style/reftest.list
+++ b/layout/reftests/svg/smil/style/reftest.list
@@ -72,6 +72,11 @@ fails == anim-css-fillopacity-3-clamp-big.svg anim-css-fillopacity-3-ref.svg
== anim-css-fontsize-1-from-by-px-px.svg anim-css-fontsize-1-ref.svg
== anim-css-fontsize-1-from-to-px-px.svg anim-css-fontsize-1-ref.svg
+# 'font-size' mapped attribute (accepts unitless values)
+== anim-mapped-fontsize-1-from-to-no-no.svg anim-css-fontsize-1-ref.svg
+== anim-mapped-fontsize-1-from-to-no-px.svg anim-css-fontsize-1-ref.svg
+== anim-mapped-fontsize-1-from-to-px-no.svg anim-css-fontsize-1-ref.svg
+
# 'font-size' property, from/by/to with percent values
== anim-css-fontsize-1-from-by-pct-pct.svg anim-css-fontsize-1-ref.svg
== anim-css-fontsize-1-from-by-pct-px.svg anim-css-fontsize-1-ref.svg
diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp
index 8954f5d56a7e..d869dacc9986 100644
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -927,7 +927,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
already_AddRefed
BuildStyleRule(nsCSSProperty aProperty,
nsIContent* aTargetElement,
- const nsAString& aSpecifiedValue)
+ const nsAString& aSpecifiedValue,
+ PRBool aUseSVGMode)
{
// Set up an empty CSS Declaration
nsCSSDeclaration* declaration = new nsCSSDeclaration();
@@ -942,6 +943,10 @@ BuildStyleRule(nsCSSProperty aProperty,
nsCOMPtr styleRule;
nsCSSParser parser(doc->CSSLoader());
+ if (aUseSVGMode) {
+ parser.SetSVGMode(PR_TRUE);
+ }
+
nsCSSProperty propertyToCheck = nsCSSProps::IsShorthand(aProperty) ?
nsCSSProps::SubpropertyEntryFor(aProperty)[0] : aProperty;
@@ -989,24 +994,21 @@ LookupStyleContext(nsIContent* aElement)
* If we fail to parse |aSpecifiedValue| for |aProperty|, this method will
* return nsnull.
*
- * NOTE: This method uses GetPrimaryShell() to access the style system,
- * so it should only be used for style that applies to all presentations,
- * rather than for style that only applies to a particular presentation.
- * XXX Once we get rid of multiple presentations, we can remove the above
- * note.
- *
* @param aProperty The property whose value we're customizing in the
* custom style context.
* @param aTargetElement The element whose style context we'll use as a
* sibling for our custom style context.
* @param aSpecifiedValue The value for |aProperty| in our custom style
* context.
+ * @param aUseSVGMode A flag to indicate whether we should parse
+ * |aSpecifiedValue| in SVG mode.
* @return The generated custom nsStyleContext, or nsnull on failure.
*/
already_AddRefed
StyleWithDeclarationAdded(nsCSSProperty aProperty,
nsIContent* aTargetElement,
- const nsAString& aSpecifiedValue)
+ const nsAString& aSpecifiedValue,
+ PRBool aUseSVGMode)
{
NS_ABORT_IF_FALSE(aTargetElement, "null target element");
NS_ABORT_IF_FALSE(aTargetElement->GetCurrentDoc(),
@@ -1021,7 +1023,7 @@ StyleWithDeclarationAdded(nsCSSProperty aProperty,
// Parse specified value into a temporary nsICSSStyleRule
nsCOMPtr styleRule =
- BuildStyleRule(aProperty, aTargetElement, aSpecifiedValue);
+ BuildStyleRule(aProperty, aTargetElement, aSpecifiedValue, aUseSVGMode);
if (!styleRule) {
return nsnull;
}
@@ -1043,6 +1045,7 @@ PRBool
nsStyleAnimation::ComputeValue(nsCSSProperty aProperty,
nsIContent* aTargetElement,
const nsAString& aSpecifiedValue,
+ PRBool aUseSVGMode,
Value& aComputedValue)
{
NS_ABORT_IF_FALSE(aTargetElement, "null target element");
@@ -1051,7 +1054,8 @@ nsStyleAnimation::ComputeValue(nsCSSProperty aProperty,
"are in a document");
nsRefPtr tmpStyleContext =
- StyleWithDeclarationAdded(aProperty, aTargetElement, aSpecifiedValue);
+ StyleWithDeclarationAdded(aProperty, aTargetElement,
+ aSpecifiedValue, aUseSVGMode);
if (!tmpStyleContext) {
return PR_FALSE;
}
diff --git a/layout/style/nsStyleAnimation.h b/layout/style/nsStyleAnimation.h
index bc3eaea0afa4..2767a59eee4f 100644
--- a/layout/style/nsStyleAnimation.h
+++ b/layout/style/nsStyleAnimation.h
@@ -161,23 +161,20 @@ public:
* specified value depends on inherited style or on the values of other
* properties.
*
- * NOTE: This method uses GetPrimaryShell() to access the style system,
- * so it should only be used for style that applies to all presentations,
- * rather than for style that only applies to a particular presentation.
- * XXX Once we get rid of multiple presentations, we can remove the above
- * note.
- *
* @param aProperty The property whose value we're computing.
* @param aTargetElement The content node to which our computed value is
* applicable.
* @param aSpecifiedValue The specified value, from which we'll build our
* computed value.
+ * @param aUseSVGMode A flag to indicate whether we should parse
+ * |aSpecifiedValue| in SVG mode.
* @param [out] aComputedValue The resulting computed value.
* @return PR_TRUE on success, PR_FALSE on failure.
*/
static PRBool ComputeValue(nsCSSProperty aProperty,
nsIContent* aElement,
const nsAString& aSpecifiedValue,
+ PRBool aUseSVGMode,
Value& aComputedValue);
/**
From 4de63f5137694d5f13467c759f253dd46437f776 Mon Sep 17 00:00:00 2001
From: Shawn Wilsher
Date: Fri, 2 Apr 2010 09:43:14 -0700
Subject: [PATCH 08/62] Fix comments on Get[ASCII|UTF]Origin. No bug. r=bz
---
content/base/public/nsContentUtils.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h
index 8a3ddd8ae19f..9dc6261a359d 100644
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1495,10 +1495,12 @@ public:
* origin is set to 'null'.
*
* The ASCII versions return a ASCII strings that are puny-code encoded,
- * suitable for for example header values. The UTF versions return strings
+ * suitable for, for example, header values. The UTF versions return strings
* containing international characters.
*
- * aPrincipal/aOrigin must not be null.
+ * @pre aPrincipal/aOrigin must not be null.
+ *
+ * @note this should be used for HTML5 origin determination.
*/
static nsresult GetASCIIOrigin(nsIPrincipal* aPrincipal,
nsCString& aOrigin);
From bca924d424cd35a69ea6685c0e9ecd6b2935f897 Mon Sep 17 00:00:00 2001
From: Taras Glek
Date: Fri, 26 Mar 2010 10:19:53 -0700
Subject: [PATCH 09/62] Bug 541828 - Do not crash on small invalid jar files
r=alfredkayser
--HG--
extra : rebase_source : c8dd6d99b4e86d60e85e08eab4100df74c629ad4
---
modules/libjar/nsZipArchive.cpp | 14 +++--
.../libjar/test/unit/data/test_corrupt2.zip | 1 +
.../libjar/test/unit/test_corrupt_541828.js | 57 +++++++++++++++++++
3 files changed, 66 insertions(+), 6 deletions(-)
create mode 100644 modules/libjar/test/unit/data/test_corrupt2.zip
create mode 100644 modules/libjar/test/unit/test_corrupt_541828.js
diff --git a/modules/libjar/nsZipArchive.cpp b/modules/libjar/nsZipArchive.cpp
index ee3edeadb2ca..6be3cff30bd8 100644
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -526,15 +526,17 @@ nsresult nsZipArchive::BuildFileList()
PRUint8* startp = mFd->mFileData;
PRUint8* endp = startp + mFd->mLen;
- for (buf = endp - ZIPEND_SIZE; xtolong(buf) != ENDSIG; buf--)
+ PRUint32 centralOffset = 0;
+ for (buf = endp - ZIPEND_SIZE; buf > startp; buf--)
{
- if (buf == startp) {
- // We're at the beginning of the file, and still no sign
- // of the end signature. File must be corrupted!
- return NS_ERROR_FILE_CORRUPTED;
+ if (xtolong(buf) == ENDSIG) {
+ centralOffset = xtolong(((ZipEnd *)buf)->offset_central_dir);
+ break;
}
}
- PRUint32 centralOffset = xtolong(((ZipEnd *)buf)->offset_central_dir);
+
+ if (!centralOffset)
+ return NS_ERROR_FILE_CORRUPTED;
//-- Read the central directory headers
buf = startp + centralOffset;
diff --git a/modules/libjar/test/unit/data/test_corrupt2.zip b/modules/libjar/test/unit/data/test_corrupt2.zip
new file mode 100644
index 000000000000..0cfbf08886fc
--- /dev/null
+++ b/modules/libjar/test/unit/data/test_corrupt2.zip
@@ -0,0 +1 @@
+2
diff --git a/modules/libjar/test/unit/test_corrupt_541828.js b/modules/libjar/test/unit/test_corrupt_541828.js
new file mode 100644
index 000000000000..1ad57dd83b0d
--- /dev/null
+++ b/modules/libjar/test/unit/test_corrupt_541828.js
@@ -0,0 +1,57 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2009
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Taras Glek
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+// Check that files can be read from after closing zipreader
+function run_test() {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+
+ // the build script have created the zip we can test on in the current dir.
+ var file = do_get_file("data/test_corrupt2.zip");
+
+ var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
+ createInstance(Ci.nsIZipReader);
+ var failed = false;
+ try {
+ zipreader.open(file);
+ // corrupt files should trigger an exception
+ } catch (ex) {
+ failed = true;
+ }
+ do_check_true(failed);
+}
+
From f4b0fe954ca6d6dfa48b89b37a8aae3d89d00eb0 Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 12:58:11 -0500
Subject: [PATCH 10/62] Bug 551254: Allow reviewed+approved STL headers to be
included through . ( and are provisionally in the
list because of their use in libpr0n, but need to be reviewed in followup bug
556700 and bug 556701). r=ehsan,ted,zwol
---
config/Makefile.in | 20 +++
config/autoconf.mk.in | 3 +
config/config.mk | 2 +-
config/gcc-stl-wrapper.template.h | 85 +++++++++
config/make-stl-wrappers.py | 87 ++++++++++
config/msvc-stl-wrapper.template.h | 96 ++++++++++
config/stl-headers | 19 ++
configure.in | 8 +
js/src/config/config.mk | 2 +-
testing/mochitest/ssltunnel/Makefile.in | 4 +
toolkit/crashreporter/client/Makefile.in | 4 +
.../src/client/windows/sender/Makefile.in | 1 +
.../src/common/windows/Makefile.in | 1 +
xpcom/glue/Makefile.in | 6 +
xpcom/glue/functexcept.h | 164 ++++++++++++++++++
15 files changed, 500 insertions(+), 2 deletions(-)
create mode 100644 config/gcc-stl-wrapper.template.h
create mode 100644 config/make-stl-wrappers.py
create mode 100644 config/msvc-stl-wrapper.template.h
create mode 100644 config/stl-headers
create mode 100644 xpcom/glue/functexcept.h
diff --git a/config/Makefile.in b/config/Makefile.in
index 04b03d424849..9d491a76e74f 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -137,6 +137,26 @@ export::
GARBAGE_DIRS += system_wrappers
endif
+ifdef WRAP_STL_INCLUDES
+ifdef GCC_VERSION
+stl_compiler = gcc
+else
+stl_compiler = msvc
+endif
+endif
+
+ifdef stl_compiler
+stl-wrappers-sentinel: $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
+ $(PYTHON) $(srcdir)/make-stl-wrappers.py stl_wrappers $(stl_compiler) $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers
+ $(PYTHON) $(srcdir)/nsinstall.py stl_wrappers $(DIST)
+ touch stl-wrappers-sentinel
+
+export:: stl-wrappers-sentinel
+
+GARBAGE += stl-wrappers-sentinel
+GARBAGE_DIRS += stl_wrappers
+endif
+
install::
$(SYSINSTALL) $(IFLAGS1) $(DEPTH)/mozilla-config.h $(DESTDIR)$(includedir)
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
index fc95db2c7462..1908cfd73cab 100644
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -359,6 +359,9 @@ HAVE_GCC3_ABI = @HAVE_GCC3_ABI@
INTEL_CC = @INTEL_CC@
INTEL_CXX = @INTEL_CXX@
+STL_FLAGS = @STL_FLAGS@
+WRAP_STL_INCLUDES = @WRAP_STL_INCLUDES@
+
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
diff --git a/config/config.mk b/config/config.mk
index f1525fa8d516..3e354b92dadf 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
new file mode 100644
index 000000000000..739f66518214
--- /dev/null
+++ b/config/gcc-stl-wrapper.template.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=8 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at:
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_${HEADER}_h
+#define mozilla_${HEADER}_h
+
+#if __EXCEPTIONS
+# error "STL code can only be used with -fno-exceptions"
+#endif
+
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include // to give mozalloc std::bad_alloc
+# include // to give mozalloc malloc/free decls
+# include
+# include "mozilla/mozalloc.h"
+#else
+# error "STL code can only be used with infallible ::operator new()"
+#endif
+
+#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
+// Enable checked iterators and other goodies
+//
+// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
+// Figure out how to resolve this with -fno-rtti. Maybe build with
+// -frtti in DEBUG builds?
+//
+// # define _GLIBCXX_DEBUG 1
+#endif
+
+#pragma GCC visibility push(default)
+#include_next <${HEADER}>
+#pragma GCC visibility pop
+
+// gcc calls a __throw_*() function from bits/functexcept.h when it
+// wants to "throw an exception". functexcept exists nominally to
+// support -fno-exceptions, but since we'll always use the system
+// libstdc++, and it's compiled with exceptions, then in practice
+// these __throw_*() functions will always throw exceptions (shades of
+// -fshort-wchar). We don't want that and so define our own inlined
+// __throw_*().
+#ifndef mozilla_functexcept_h
+# include "mozilla/functexcept.h"
+#endif
+
+#endif // if mozilla_${HEADER}_h
diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py
new file mode 100644
index 000000000000..106dbd6547bc
--- /dev/null
+++ b/config/make-stl-wrappers.py
@@ -0,0 +1,87 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# The Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Chris Jones
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+import os, re, string, sys
+
+def find_in_path(file, searchpath):
+ for dir in searchpath.split(os.pathsep):
+ f = os.path.join(dir, file)
+ if os.path.exists(f):
+ return f
+ return ''
+
+def header_path(header, compiler):
+ if compiler == 'gcc':
+ # we use include_next on gcc
+ return header
+ elif compiler == 'msvc':
+ return find_in_path(header, os.environ.get('INCLUDE', ''))
+ else:
+ # hope someone notices this ...
+ raise NotImplementedError, compiler
+
+def is_comment(line):
+ return re.match(r'\s*#.*', line)
+
+def main(outdir, compiler, template_file, header_list_file):
+ if not os.path.isdir(outdir):
+ os.mkdir(outdir)
+
+ template = open(template_file, 'r').read()
+
+ for header in open(header_list_file, 'r'):
+ header = header.rstrip()
+ if 0 == len(header) or is_comment(header):
+ continue
+
+ path = header_path(header, compiler)
+ try:
+ f = open(os.path.join(outdir, header), 'w')
+ f.write(string.Template(template).substitute(HEADER=header,
+ HEADER_PATH=path))
+ finally:
+ f.close()
+
+
+if __name__ == '__main__':
+ if 5 != len(sys.argv):
+ print >>sys.stderr, """Usage:
+ python %s OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
+"""% (sys.argv[0])
+ sys.exit(1)
+
+ main(*sys.argv[1:])
diff --git a/config/msvc-stl-wrapper.template.h b/config/msvc-stl-wrapper.template.h
new file mode 100644
index 000000000000..97d45c617c8a
--- /dev/null
+++ b/config/msvc-stl-wrapper.template.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=8 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at:
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_${HEADER}_h
+#define mozilla_${HEADER}_h
+
+#if _HAS_EXCEPTIONS
+# error "STL code can only be used with -fno-exceptions"
+#endif
+
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include // to give mozalloc std::bad_alloc
+# include // to give mozalloc malloc/free decls
+# include
+# include "mozilla/mozalloc.h"
+#else
+# error "STL code can only be used with infallible ::operator new()"
+#endif
+
+#ifdef DEBUG
+// From
+// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
+// and
+// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
+// there appear to be two types of STL container checking. The
+// former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
+// looks to be full generation/mutation checked iterators as done by
+// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
+// is enabled by the following macros. It appears that the _DEBUG
+// iterators subsume _SECURE_SCL, and the following settings are
+// default anyway, so we'll just leave this commented out.
+//# define _SECURE_SCL 1
+//# define _SECURE_SCL_THROWS 0
+#else
+// Note: _SECURE_SCL iterators are on by default in opt builds. We
+// could leave them on, but since gcc doesn't, we might as well
+// preserve that behavior for perf reasons. nsTArray is in the same
+// camp as gcc. Can revisit later.
+//
+// FIXME/bug 551254: because we're not wrapping all the STL headers we
+// use, undefining this here can cause some headers to be built with
+// iterator checking and others not. Turning this off until we have a
+// better plan.
+//# undef _SECURE_SCL
+#endif
+
+// We know that code won't be able to catch exceptions, but that's OK
+// because we're not throwing them.
+#pragma warning( push )
+#pragma warning( disable : 4530 )
+
+#include <${HEADER_PATH}>
+
+#pragma warning( pop )
+
+#endif // if mozilla_${HEADER}_h
diff --git a/config/stl-headers b/config/stl-headers
new file mode 100644
index 000000000000..69790c9a1ebb
--- /dev/null
+++ b/config/stl-headers
@@ -0,0 +1,19 @@
+#
+# This file contains a list the of STL headers that have been reviewed
+# for exception safety and approved. See
+#
+# https://bugzilla.mozilla.org/show_bug.cgi?id=551254
+#
+# At build time, each header listed here is converted into a "wrapper
+# header" that is installed into dist/stl_includes.
+#
+# If you would like to request a new STL header be added, please
+# file a Core:XPCOM bug with a title like "STL: Review exception
+# safety of for gcc and MSVC".
+#
+
+# FIXME: these headers haven't been reviewed yet, but we use them
+# unsafely in modules/libpr0n, so we might as well prevent it from
+# throwing exceptions
+algorithm
+vector
diff --git a/configure.in b/configure.in
index 8791dc36eebd..83c05e49f675 100644
--- a/configure.in
+++ b/configure.in
@@ -759,6 +759,9 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
+
+ STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
+ WRAP_STL_INCLUDES=1
;;
esac
@@ -807,6 +810,9 @@ AC_SUBST(GNU_CXX)
AC_SUBST(INTEL_CC)
AC_SUBST(INTEL_CXX)
+AC_SUBST(STL_FLAGS)
+AC_SUBST(WRAP_STL_INCLUDES)
+
dnl ========================================================
dnl Checks for programs.
dnl ========================================================
@@ -3126,6 +3132,8 @@ EOF
"$ac_cv_have_visibility_class_bug" = "no"; then
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
WRAP_SYSTEM_INCLUDES=1
+ STL_FLAGS='-I$(DIST)/stl_wrappers'
+ WRAP_STL_INCLUDES=1
else
VISIBILITY_FLAGS='-fvisibility=hidden'
fi # have visibility pragma bug
diff --git a/js/src/config/config.mk b/js/src/config/config.mk
index f1525fa8d516..3e354b92dadf 100644
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/testing/mochitest/ssltunnel/Makefile.in b/testing/mochitest/ssltunnel/Makefile.in
index 71a3d9495678..160b97fc8e18 100644
--- a/testing/mochitest/ssltunnel/Makefile.in
+++ b/testing/mochitest/ssltunnel/Makefile.in
@@ -43,6 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+# This isn't XPCOM code, but it wants to use STL, so disable the STL
+# wrappers
+STL_FLAGS =
+
PROGRAM = ssltunnel$(BIN_SUFFIX)
CPPSRCS = ssltunnel.cpp
diff --git a/toolkit/crashreporter/client/Makefile.in b/toolkit/crashreporter/client/Makefile.in
index f16b8baa235a..f62d3b32cbf5 100644
--- a/toolkit/crashreporter/client/Makefile.in
+++ b/toolkit/crashreporter/client/Makefile.in
@@ -44,6 +44,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+# Don't use the STL wrappers in the crashreporter clients; they don't
+# link with -lmozalloc, and it really doesn't matter here anyway.
+STL_FLAGS =
+
PROGRAM = crashreporter$(BIN_SUFFIX)
DIST_PROGRAM = crashreporter$(BIN_SUFFIX)
diff --git a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
index 7d7eafe50881..3f86440940d1 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
@@ -46,6 +46,7 @@ LIBRARY_NAME = crash_report_sender_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
DEFINES += -DUNICODE -D_UNICODE
+STL_FLAGS =
CPPSRCS = \
crash_report_sender.cc \
diff --git a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
index ff74819a30af..1aeebf784352 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
@@ -46,6 +46,7 @@ LIBRARY_NAME = breakpad_windows_common_s
LOCAL_INCLUDES = -I$(srcdir)/../..
DEFINES += -DUNICODE -D_UNICODE
+STL_FLAGS =
CPPSRCS = \
guid_string.cc \
diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
index 5db33876c0e9..5b64237f6bec 100644
--- a/xpcom/glue/Makefile.in
+++ b/xpcom/glue/Makefile.in
@@ -134,6 +134,12 @@ EXPORTS_mozilla = \
SSE.h \
$(NULL)
+ifdef WRAP_STL_INCLUDES
+ifdef GCC_VERSION
+EXPORTS_mozilla += functexcept.h
+endif
+endif
+
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)
diff --git a/xpcom/glue/functexcept.h b/xpcom/glue/functexcept.h
new file mode 100644
index 000000000000..5492f8dd7373
--- /dev/null
+++ b/xpcom/glue/functexcept.h
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_functexcept_h
+#define mozilla_functexcept_h
+
+#include
+#include
+#include
+
+// For gcc, we define these inline to abort so that we're absolutely
+// certain that (i) no exceptions are thrown from Gecko; (ii) these
+// errors are always terminal and caught by breakpad.
+
+// NB: It would be nice to #include "nsDebug.h" and use
+// NS_RUNTIMEABORT(), but because this file is used within chromium,
+// and nsDebug pulls in nscore, and nscore pulls in prtypes, and
+// chromium can't build with prtypes being included before
+// base/basictypes, then we have to roll our own aborting impl.
+
+// Assume that if we're building with gcc, we're on a platform where
+// abort() is fatal and triggers breakpad.
+#define MOZ_FE_ABORT(_msg) \
+ do { \
+ fputs(_msg, stderr); \
+ fputs("\n", stderr); \
+ abort(); \
+ } while (0)
+
+namespace std {
+
+inline void NS_NORETURN
+__throw_bad_exception(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_exception");
+}
+
+inline void NS_NORETURN
+__throw_bad_alloc(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_alloc");
+}
+
+inline void NS_NORETURN
+__throw_bad_cast(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_cast");
+}
+
+inline void NS_NORETURN
+__throw_bad_typeid(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_typeid");
+}
+
+inline void NS_NORETURN
+__throw_logic_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_domain_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_invalid_argument(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_length_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_out_of_range(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_runtime_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_range_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_overflow_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_underflow_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_ios_failure(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_system_error(int err)
+{
+ char error[128];
+ snprintf(error, sizeof(error)-1,
+ "fatal: STL threw system_error: %s (%d)", strerror(err), err);
+ MOZ_FE_ABORT(error);
+}
+
+} // namespace std
+
+#endif // mozilla_functexcept_h
From 23b3beae10a49f319d67edcdacbb8804d4c5043f Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 12:58:12 -0500
Subject: [PATCH 11/62] Bug 551254: Simple (disabled) test that the STL
wrappers work correctly.
---
xpcom/tests/Makefile.in | 4 ++++
xpcom/tests/TestSTLWrappers.cpp | 35 +++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
create mode 100644 xpcom/tests/TestSTLWrappers.cpp
diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in
index 55e7d6bb39e1..e66e9b30f09a 100644
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -73,6 +73,10 @@ CPPSRCS = \
TestUnicodeArguments.cpp \
$(NULL)
+ifdef WRAP_STL_INCLUDES
+CPPSRCS += TestSTLWrappers.cpp
+endif
+
SIMPLE_PROGRAMS := $(CPPSRCS:.cpp=$(BIN_SUFFIX))
CPP_UNIT_TESTS = \
diff --git a/xpcom/tests/TestSTLWrappers.cpp b/xpcom/tests/TestSTLWrappers.cpp
new file mode 100644
index 000000000000..017959c5dfdc
--- /dev/null
+++ b/xpcom/tests/TestSTLWrappers.cpp
@@ -0,0 +1,35 @@
+#include
+
+#include
+#ifndef mozilla_algorithm_h
+# error "failed to wrap "
+#endif
+
+#include
+#ifndef mozilla_vector_h
+# error "failed to wrap "
+#endif
+
+// gcc errors out if we |try ... catch| with -fno-exceptions, but we
+// can still test on windows
+#ifdef XP_WIN
+# define TRY try
+# define CATCH(e) catch (e)
+#else
+# define TRY
+# define CATCH(e) if (0)
+#endif
+
+int main() {
+ std::vector v;
+
+ TRY {
+ // this should abort; NOT throw an exception
+ int unused = v.at(1);
+ } CATCH(const std::out_of_range& e) {
+ fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception!\n",
+ stderr);
+ }
+
+ return 0;
+}
From 2c7c7d9fa93011e992f3dcd8d5e255090153dcfb Mon Sep 17 00:00:00 2001
From: Doug Turner
Date: Fri, 2 Apr 2010 11:11:31 -0700
Subject: [PATCH 12/62] Fix Qt Gfx build bustage when using shared image
surfaces. No bug
---
gfx/thebes/src/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gfx/thebes/src/Makefile.in b/gfx/thebes/src/Makefile.in
index 27afb2c73644..4200b07080d7 100644
--- a/gfx/thebes/src/Makefile.in
+++ b/gfx/thebes/src/Makefile.in
@@ -140,7 +140,7 @@ CPPSRCS += gfxDirectFBSurface.cpp
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
-CPPSRCS += gfxQtPlatform.cpp gfxQPainterSurface.cpp
+CPPSRCS += gfxQtPlatform.cpp gfxQPainterSurface.cpp gfxSharedImageSurface.cpp
CPPSRCS += gfxXlibSurface.cpp gfxQtNativeRenderer.cpp
ifdef MOZ_PANGO
CPPSRCS += gfxPangoFonts.cpp
From a6d985aeaaf8668f78943119503c00afdf33c7c4 Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 13:19:24 -0500
Subject: [PATCH 13/62] Backed out changeset ac5cbcb2feb2
---
xpcom/tests/Makefile.in | 4 ----
xpcom/tests/TestSTLWrappers.cpp | 35 ---------------------------------
2 files changed, 39 deletions(-)
delete mode 100644 xpcom/tests/TestSTLWrappers.cpp
diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in
index e66e9b30f09a..55e7d6bb39e1 100644
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -73,10 +73,6 @@ CPPSRCS = \
TestUnicodeArguments.cpp \
$(NULL)
-ifdef WRAP_STL_INCLUDES
-CPPSRCS += TestSTLWrappers.cpp
-endif
-
SIMPLE_PROGRAMS := $(CPPSRCS:.cpp=$(BIN_SUFFIX))
CPP_UNIT_TESTS = \
diff --git a/xpcom/tests/TestSTLWrappers.cpp b/xpcom/tests/TestSTLWrappers.cpp
deleted file mode 100644
index 017959c5dfdc..000000000000
--- a/xpcom/tests/TestSTLWrappers.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include
-
-#include
-#ifndef mozilla_algorithm_h
-# error "failed to wrap "
-#endif
-
-#include
-#ifndef mozilla_vector_h
-# error "failed to wrap "
-#endif
-
-// gcc errors out if we |try ... catch| with -fno-exceptions, but we
-// can still test on windows
-#ifdef XP_WIN
-# define TRY try
-# define CATCH(e) catch (e)
-#else
-# define TRY
-# define CATCH(e) if (0)
-#endif
-
-int main() {
- std::vector v;
-
- TRY {
- // this should abort; NOT throw an exception
- int unused = v.at(1);
- } CATCH(const std::out_of_range& e) {
- fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception!\n",
- stderr);
- }
-
- return 0;
-}
From d17ed699f32e6af92e9aa5380bc97e64945e6d08 Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 13:20:22 -0500
Subject: [PATCH 14/62] Backed out changeset cec7b12eb5e3
---
config/Makefile.in | 20 ---
config/autoconf.mk.in | 3 -
config/config.mk | 2 +-
config/gcc-stl-wrapper.template.h | 85 ---------
config/make-stl-wrappers.py | 87 ----------
config/msvc-stl-wrapper.template.h | 96 ----------
config/stl-headers | 19 --
configure.in | 8 -
js/src/config/config.mk | 2 +-
testing/mochitest/ssltunnel/Makefile.in | 4 -
toolkit/crashreporter/client/Makefile.in | 4 -
.../src/client/windows/sender/Makefile.in | 1 -
.../src/common/windows/Makefile.in | 1 -
xpcom/glue/Makefile.in | 6 -
xpcom/glue/functexcept.h | 164 ------------------
15 files changed, 2 insertions(+), 500 deletions(-)
delete mode 100644 config/gcc-stl-wrapper.template.h
delete mode 100644 config/make-stl-wrappers.py
delete mode 100644 config/msvc-stl-wrapper.template.h
delete mode 100644 config/stl-headers
delete mode 100644 xpcom/glue/functexcept.h
diff --git a/config/Makefile.in b/config/Makefile.in
index 9d491a76e74f..04b03d424849 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -137,26 +137,6 @@ export::
GARBAGE_DIRS += system_wrappers
endif
-ifdef WRAP_STL_INCLUDES
-ifdef GCC_VERSION
-stl_compiler = gcc
-else
-stl_compiler = msvc
-endif
-endif
-
-ifdef stl_compiler
-stl-wrappers-sentinel: $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
- $(PYTHON) $(srcdir)/make-stl-wrappers.py stl_wrappers $(stl_compiler) $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers
- $(PYTHON) $(srcdir)/nsinstall.py stl_wrappers $(DIST)
- touch stl-wrappers-sentinel
-
-export:: stl-wrappers-sentinel
-
-GARBAGE += stl-wrappers-sentinel
-GARBAGE_DIRS += stl_wrappers
-endif
-
install::
$(SYSINSTALL) $(IFLAGS1) $(DEPTH)/mozilla-config.h $(DESTDIR)$(includedir)
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
index 1908cfd73cab..fc95db2c7462 100644
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -359,9 +359,6 @@ HAVE_GCC3_ABI = @HAVE_GCC3_ABI@
INTEL_CC = @INTEL_CC@
INTEL_CXX = @INTEL_CXX@
-STL_FLAGS = @STL_FLAGS@
-WRAP_STL_INCLUDES = @WRAP_STL_INCLUDES@
-
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
diff --git a/config/config.mk b/config/config.mk
index 3e354b92dadf..f1525fa8d516 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
deleted file mode 100644
index 739f66518214..000000000000
--- a/config/gcc-stl-wrapper.template.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Code.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Chris Jones
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_${HEADER}_h
-#define mozilla_${HEADER}_h
-
-#if __EXCEPTIONS
-# error "STL code can only be used with -fno-exceptions"
-#endif
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include // to give mozalloc std::bad_alloc
-# include // to give mozalloc malloc/free decls
-# include
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
-#endif
-
-#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
-// Enable checked iterators and other goodies
-//
-// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
-// Figure out how to resolve this with -fno-rtti. Maybe build with
-// -frtti in DEBUG builds?
-//
-// # define _GLIBCXX_DEBUG 1
-#endif
-
-#pragma GCC visibility push(default)
-#include_next <${HEADER}>
-#pragma GCC visibility pop
-
-// gcc calls a __throw_*() function from bits/functexcept.h when it
-// wants to "throw an exception". functexcept exists nominally to
-// support -fno-exceptions, but since we'll always use the system
-// libstdc++, and it's compiled with exceptions, then in practice
-// these __throw_*() functions will always throw exceptions (shades of
-// -fshort-wchar). We don't want that and so define our own inlined
-// __throw_*().
-#ifndef mozilla_functexcept_h
-# include "mozilla/functexcept.h"
-#endif
-
-#endif // if mozilla_${HEADER}_h
diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py
deleted file mode 100644
index 106dbd6547bc..000000000000
--- a/config/make-stl-wrappers.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# The Mozilla Foundation
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Chris Jones
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-import os, re, string, sys
-
-def find_in_path(file, searchpath):
- for dir in searchpath.split(os.pathsep):
- f = os.path.join(dir, file)
- if os.path.exists(f):
- return f
- return ''
-
-def header_path(header, compiler):
- if compiler == 'gcc':
- # we use include_next on gcc
- return header
- elif compiler == 'msvc':
- return find_in_path(header, os.environ.get('INCLUDE', ''))
- else:
- # hope someone notices this ...
- raise NotImplementedError, compiler
-
-def is_comment(line):
- return re.match(r'\s*#.*', line)
-
-def main(outdir, compiler, template_file, header_list_file):
- if not os.path.isdir(outdir):
- os.mkdir(outdir)
-
- template = open(template_file, 'r').read()
-
- for header in open(header_list_file, 'r'):
- header = header.rstrip()
- if 0 == len(header) or is_comment(header):
- continue
-
- path = header_path(header, compiler)
- try:
- f = open(os.path.join(outdir, header), 'w')
- f.write(string.Template(template).substitute(HEADER=header,
- HEADER_PATH=path))
- finally:
- f.close()
-
-
-if __name__ == '__main__':
- if 5 != len(sys.argv):
- print >>sys.stderr, """Usage:
- python %s OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
-"""% (sys.argv[0])
- sys.exit(1)
-
- main(*sys.argv[1:])
diff --git a/config/msvc-stl-wrapper.template.h b/config/msvc-stl-wrapper.template.h
deleted file mode 100644
index 97d45c617c8a..000000000000
--- a/config/msvc-stl-wrapper.template.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at:
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Code.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Chris Jones
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_${HEADER}_h
-#define mozilla_${HEADER}_h
-
-#if _HAS_EXCEPTIONS
-# error "STL code can only be used with -fno-exceptions"
-#endif
-
-// See if we're in code that can use mozalloc. NB: this duplicates
-// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
-// can't build with that being included before base/basictypes.h.
-#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
-# include // to give mozalloc std::bad_alloc
-# include // to give mozalloc malloc/free decls
-# include
-# include "mozilla/mozalloc.h"
-#else
-# error "STL code can only be used with infallible ::operator new()"
-#endif
-
-#ifdef DEBUG
-// From
-// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
-// and
-// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
-// there appear to be two types of STL container checking. The
-// former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
-// looks to be full generation/mutation checked iterators as done by
-// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
-// is enabled by the following macros. It appears that the _DEBUG
-// iterators subsume _SECURE_SCL, and the following settings are
-// default anyway, so we'll just leave this commented out.
-//# define _SECURE_SCL 1
-//# define _SECURE_SCL_THROWS 0
-#else
-// Note: _SECURE_SCL iterators are on by default in opt builds. We
-// could leave them on, but since gcc doesn't, we might as well
-// preserve that behavior for perf reasons. nsTArray is in the same
-// camp as gcc. Can revisit later.
-//
-// FIXME/bug 551254: because we're not wrapping all the STL headers we
-// use, undefining this here can cause some headers to be built with
-// iterator checking and others not. Turning this off until we have a
-// better plan.
-//# undef _SECURE_SCL
-#endif
-
-// We know that code won't be able to catch exceptions, but that's OK
-// because we're not throwing them.
-#pragma warning( push )
-#pragma warning( disable : 4530 )
-
-#include <${HEADER_PATH}>
-
-#pragma warning( pop )
-
-#endif // if mozilla_${HEADER}_h
diff --git a/config/stl-headers b/config/stl-headers
deleted file mode 100644
index 69790c9a1ebb..000000000000
--- a/config/stl-headers
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# This file contains a list the of STL headers that have been reviewed
-# for exception safety and approved. See
-#
-# https://bugzilla.mozilla.org/show_bug.cgi?id=551254
-#
-# At build time, each header listed here is converted into a "wrapper
-# header" that is installed into dist/stl_includes.
-#
-# If you would like to request a new STL header be added, please
-# file a Core:XPCOM bug with a title like "STL: Review exception
-# safety of for gcc and MSVC".
-#
-
-# FIXME: these headers haven't been reviewed yet, but we use them
-# unsafely in modules/libpr0n, so we might as well prevent it from
-# throwing exceptions
-algorithm
-vector
diff --git a/configure.in b/configure.in
index 83c05e49f675..8791dc36eebd 100644
--- a/configure.in
+++ b/configure.in
@@ -759,9 +759,6 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
-
- STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
- WRAP_STL_INCLUDES=1
;;
esac
@@ -810,9 +807,6 @@ AC_SUBST(GNU_CXX)
AC_SUBST(INTEL_CC)
AC_SUBST(INTEL_CXX)
-AC_SUBST(STL_FLAGS)
-AC_SUBST(WRAP_STL_INCLUDES)
-
dnl ========================================================
dnl Checks for programs.
dnl ========================================================
@@ -3132,8 +3126,6 @@ EOF
"$ac_cv_have_visibility_class_bug" = "no"; then
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
WRAP_SYSTEM_INCLUDES=1
- STL_FLAGS='-I$(DIST)/stl_wrappers'
- WRAP_STL_INCLUDES=1
else
VISIBILITY_FLAGS='-fvisibility=hidden'
fi # have visibility pragma bug
diff --git a/js/src/config/config.mk b/js/src/config/config.mk
index 3e354b92dadf..f1525fa8d516 100644
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/testing/mochitest/ssltunnel/Makefile.in b/testing/mochitest/ssltunnel/Makefile.in
index 160b97fc8e18..71a3d9495678 100644
--- a/testing/mochitest/ssltunnel/Makefile.in
+++ b/testing/mochitest/ssltunnel/Makefile.in
@@ -43,10 +43,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-# This isn't XPCOM code, but it wants to use STL, so disable the STL
-# wrappers
-STL_FLAGS =
-
PROGRAM = ssltunnel$(BIN_SUFFIX)
CPPSRCS = ssltunnel.cpp
diff --git a/toolkit/crashreporter/client/Makefile.in b/toolkit/crashreporter/client/Makefile.in
index f62d3b32cbf5..f16b8baa235a 100644
--- a/toolkit/crashreporter/client/Makefile.in
+++ b/toolkit/crashreporter/client/Makefile.in
@@ -44,10 +44,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
-# Don't use the STL wrappers in the crashreporter clients; they don't
-# link with -lmozalloc, and it really doesn't matter here anyway.
-STL_FLAGS =
-
PROGRAM = crashreporter$(BIN_SUFFIX)
DIST_PROGRAM = crashreporter$(BIN_SUFFIX)
diff --git a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
index 3f86440940d1..7d7eafe50881 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
@@ -46,7 +46,6 @@ LIBRARY_NAME = crash_report_sender_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
DEFINES += -DUNICODE -D_UNICODE
-STL_FLAGS =
CPPSRCS = \
crash_report_sender.cc \
diff --git a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
index 1aeebf784352..ff74819a30af 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
@@ -46,7 +46,6 @@ LIBRARY_NAME = breakpad_windows_common_s
LOCAL_INCLUDES = -I$(srcdir)/../..
DEFINES += -DUNICODE -D_UNICODE
-STL_FLAGS =
CPPSRCS = \
guid_string.cc \
diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
index 5b64237f6bec..5db33876c0e9 100644
--- a/xpcom/glue/Makefile.in
+++ b/xpcom/glue/Makefile.in
@@ -134,12 +134,6 @@ EXPORTS_mozilla = \
SSE.h \
$(NULL)
-ifdef WRAP_STL_INCLUDES
-ifdef GCC_VERSION
-EXPORTS_mozilla += functexcept.h
-endif
-endif
-
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)
diff --git a/xpcom/glue/functexcept.h b/xpcom/glue/functexcept.h
deleted file mode 100644
index 5492f8dd7373..000000000000
--- a/xpcom/glue/functexcept.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 et :
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Mozilla Code
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Chris Jones
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#ifndef mozilla_functexcept_h
-#define mozilla_functexcept_h
-
-#include
-#include
-#include
-
-// For gcc, we define these inline to abort so that we're absolutely
-// certain that (i) no exceptions are thrown from Gecko; (ii) these
-// errors are always terminal and caught by breakpad.
-
-// NB: It would be nice to #include "nsDebug.h" and use
-// NS_RUNTIMEABORT(), but because this file is used within chromium,
-// and nsDebug pulls in nscore, and nscore pulls in prtypes, and
-// chromium can't build with prtypes being included before
-// base/basictypes, then we have to roll our own aborting impl.
-
-// Assume that if we're building with gcc, we're on a platform where
-// abort() is fatal and triggers breakpad.
-#define MOZ_FE_ABORT(_msg) \
- do { \
- fputs(_msg, stderr); \
- fputs("\n", stderr); \
- abort(); \
- } while (0)
-
-namespace std {
-
-inline void NS_NORETURN
-__throw_bad_exception(void)
-{
- MOZ_FE_ABORT("fatal: STL threw bad_exception");
-}
-
-inline void NS_NORETURN
-__throw_bad_alloc(void)
-{
- MOZ_FE_ABORT("fatal: STL threw bad_alloc");
-}
-
-inline void NS_NORETURN
-__throw_bad_cast(void)
-{
- MOZ_FE_ABORT("fatal: STL threw bad_cast");
-}
-
-inline void NS_NORETURN
-__throw_bad_typeid(void)
-{
- MOZ_FE_ABORT("fatal: STL threw bad_typeid");
-}
-
-inline void NS_NORETURN
-__throw_logic_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_domain_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_invalid_argument(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_length_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_out_of_range(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_runtime_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_range_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_overflow_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_underflow_error(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_ios_failure(const char* msg)
-{
- MOZ_FE_ABORT(msg);
-}
-
-inline void NS_NORETURN
-__throw_system_error(int err)
-{
- char error[128];
- snprintf(error, sizeof(error)-1,
- "fatal: STL threw system_error: %s (%d)", strerror(err), err);
- MOZ_FE_ABORT(error);
-}
-
-} // namespace std
-
-#endif // mozilla_functexcept_h
From dc57b86c7314c1ac2311b18da7ea363e5492fbe5 Mon Sep 17 00:00:00 2001
From: Michael Wu
Date: Fri, 2 Apr 2010 11:32:38 -0700
Subject: [PATCH 15/62] Bug 553121 - Use resource URIs instead of file URIs for
DTDs, r+sr=jst
---
parser/htmlparser/src/nsExpatDriver.cpp | 50 +++++++------------------
1 file changed, 13 insertions(+), 37 deletions(-)
diff --git a/parser/htmlparser/src/nsExpatDriver.cpp b/parser/htmlparser/src/nsExpatDriver.cpp
index 262056cabb5f..bb651258d159 100644
--- a/parser/htmlparser/src/nsExpatDriver.cpp
+++ b/parser/htmlparser/src/nsExpatDriver.cpp
@@ -316,14 +316,12 @@ LookupCatalogData(const PRUnichar* aPublicID)
return nsnull;
}
-// aCatalogData can be null. If not null, it provides a hook to additional
-// built-in knowledge on the resource that we are trying to load. Returns true
-// if the local DTD specified in the catalog data exists or if the filename
-// contained within the url exists in the special DTD directory. If either of
-// this exists, aResult is set to the file: url that points to the DTD file
-// found in the local DTD directory.
-static PRBool
-IsLoadableDTD(const nsCatalogData* aCatalogData, nsIURI* aDTD,
+// This function provides a resource URI to a local DTD
+// in resource://gre/res/dtd/ which may or may not exist.
+// If aCatalogData is provided, it is used to remap the
+// DTD instead of taking the filename from the URI.
+static void
+GetLocalDTDURI(const nsCatalogData* aCatalogData, nsIURI* aDTD,
nsIURI** aResult)
{
NS_ASSERTION(aDTD, "Null parameter.");
@@ -341,41 +339,18 @@ IsLoadableDTD(const nsCatalogData* aCatalogData, nsIURI* aDTD,
// special DTD directory and it will be picked.
nsCOMPtr dtdURL = do_QueryInterface(aDTD);
if (!dtdURL) {
- return PR_FALSE;
+ return;
}
dtdURL->GetFileName(fileName);
if (fileName.IsEmpty()) {
- return PR_FALSE;
+ return;
}
}
- nsCOMPtr dtdPath;
- NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(dtdPath));
- if (!dtdPath) {
- return PR_FALSE;
- }
-
- nsCOMPtr lfile = do_QueryInterface(dtdPath);
-
- // append res/dtd/
- // can't do AppendRelativeNativePath("res/dtd/" + fileName)
- // as that won't work on all platforms.
- lfile->AppendNative(NS_LITERAL_CSTRING("res"));
- lfile->AppendNative(NS_LITERAL_CSTRING("dtd"));
- lfile->AppendNative(fileName);
-
- PRBool exists;
- dtdPath->Exists(&exists);
- if (!exists) {
- return PR_FALSE;
- }
-
- // The DTD was found in the local DTD directory.
- // Set aDTD to a file: url pointing to the local DTD
- NS_NewFileURI(aResult, dtdPath);
-
- return *aResult != nsnull;
+ nsCAutoString respath("resource://gre/res/dtd/");
+ respath += fileName;
+ NS_NewURI(aResult, respath);
}
/***************************** END CATALOG UTILS *****************************/
@@ -795,7 +770,8 @@ nsExpatDriver::OpenInputStreamFromExternalDTD(const PRUnichar* aFPIStr,
}
nsCOMPtr localURI;
- if (!IsLoadableDTD(mCatalogData, uri, getter_AddRefs(localURI))) {
+ GetLocalDTDURI(mCatalogData, uri, getter_AddRefs(localURI));
+ if (!localURI) {
return NS_ERROR_NOT_IMPLEMENTED;
}
From a8c5a07cbb40ee008908648a69660e0b84249592 Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 12:58:11 -0500
Subject: [PATCH 16/62] Bug 551254: Allow reviewed+approved STL headers to be
included through . ( and are provisionally in the
list because of their use in libpr0n, but need to be reviewed in followup bug
556700 and bug 556701). r=ehsan,ted,zwol
---
config/Makefile.in | 20 +++
config/autoconf.mk.in | 3 +
config/config.mk | 2 +-
config/gcc-stl-wrapper.template.h | 85 +++++++++
config/make-stl-wrappers.py | 87 ++++++++++
config/msvc-stl-wrapper.template.h | 96 ++++++++++
config/stl-headers | 19 ++
configure.in | 8 +
js/src/config/config.mk | 2 +-
testing/mochitest/ssltunnel/Makefile.in | 4 +
toolkit/crashreporter/client/Makefile.in | 4 +
.../src/client/windows/sender/Makefile.in | 1 +
.../src/common/windows/Makefile.in | 1 +
tools/trace-malloc/lib/Makefile.in | 1 +
xpcom/glue/Makefile.in | 6 +
xpcom/glue/functexcept.h | 164 ++++++++++++++++++
16 files changed, 501 insertions(+), 2 deletions(-)
create mode 100644 config/gcc-stl-wrapper.template.h
create mode 100644 config/make-stl-wrappers.py
create mode 100644 config/msvc-stl-wrapper.template.h
create mode 100644 config/stl-headers
create mode 100644 xpcom/glue/functexcept.h
diff --git a/config/Makefile.in b/config/Makefile.in
index 04b03d424849..9d491a76e74f 100644
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -137,6 +137,26 @@ export::
GARBAGE_DIRS += system_wrappers
endif
+ifdef WRAP_STL_INCLUDES
+ifdef GCC_VERSION
+stl_compiler = gcc
+else
+stl_compiler = msvc
+endif
+endif
+
+ifdef stl_compiler
+stl-wrappers-sentinel: $(srcdir)/make-stl-wrappers.py $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers $(GLOBAL_DEPS)
+ $(PYTHON) $(srcdir)/make-stl-wrappers.py stl_wrappers $(stl_compiler) $(srcdir)/$(stl_compiler)-stl-wrapper.template.h $(srcdir)/stl-headers
+ $(PYTHON) $(srcdir)/nsinstall.py stl_wrappers $(DIST)
+ touch stl-wrappers-sentinel
+
+export:: stl-wrappers-sentinel
+
+GARBAGE += stl-wrappers-sentinel
+GARBAGE_DIRS += stl_wrappers
+endif
+
install::
$(SYSINSTALL) $(IFLAGS1) $(DEPTH)/mozilla-config.h $(DESTDIR)$(includedir)
diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in
index fc95db2c7462..1908cfd73cab 100644
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -359,6 +359,9 @@ HAVE_GCC3_ABI = @HAVE_GCC3_ABI@
INTEL_CC = @INTEL_CC@
INTEL_CXX = @INTEL_CXX@
+STL_FLAGS = @STL_FLAGS@
+WRAP_STL_INCLUDES = @WRAP_STL_INCLUDES@
+
HOST_CC = @HOST_CC@
HOST_CXX = @HOST_CXX@
HOST_CFLAGS = @HOST_CFLAGS@
diff --git a/config/config.mk b/config/config.mk
index f1525fa8d516..3e354b92dadf 100644
--- a/config/config.mk
+++ b/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/config/gcc-stl-wrapper.template.h b/config/gcc-stl-wrapper.template.h
new file mode 100644
index 000000000000..739f66518214
--- /dev/null
+++ b/config/gcc-stl-wrapper.template.h
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=8 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at:
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_${HEADER}_h
+#define mozilla_${HEADER}_h
+
+#if __EXCEPTIONS
+# error "STL code can only be used with -fno-exceptions"
+#endif
+
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include // to give mozalloc std::bad_alloc
+# include // to give mozalloc malloc/free decls
+# include
+# include "mozilla/mozalloc.h"
+#else
+# error "STL code can only be used with infallible ::operator new()"
+#endif
+
+#if defined(DEBUG) && !defined(_GLIBCXX_DEBUG)
+// Enable checked iterators and other goodies
+//
+// FIXME/bug 551254: gcc's debug STL implementation requires -frtti.
+// Figure out how to resolve this with -fno-rtti. Maybe build with
+// -frtti in DEBUG builds?
+//
+// # define _GLIBCXX_DEBUG 1
+#endif
+
+#pragma GCC visibility push(default)
+#include_next <${HEADER}>
+#pragma GCC visibility pop
+
+// gcc calls a __throw_*() function from bits/functexcept.h when it
+// wants to "throw an exception". functexcept exists nominally to
+// support -fno-exceptions, but since we'll always use the system
+// libstdc++, and it's compiled with exceptions, then in practice
+// these __throw_*() functions will always throw exceptions (shades of
+// -fshort-wchar). We don't want that and so define our own inlined
+// __throw_*().
+#ifndef mozilla_functexcept_h
+# include "mozilla/functexcept.h"
+#endif
+
+#endif // if mozilla_${HEADER}_h
diff --git a/config/make-stl-wrappers.py b/config/make-stl-wrappers.py
new file mode 100644
index 000000000000..106dbd6547bc
--- /dev/null
+++ b/config/make-stl-wrappers.py
@@ -0,0 +1,87 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# The Mozilla Foundation
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Chris Jones
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+import os, re, string, sys
+
+def find_in_path(file, searchpath):
+ for dir in searchpath.split(os.pathsep):
+ f = os.path.join(dir, file)
+ if os.path.exists(f):
+ return f
+ return ''
+
+def header_path(header, compiler):
+ if compiler == 'gcc':
+ # we use include_next on gcc
+ return header
+ elif compiler == 'msvc':
+ return find_in_path(header, os.environ.get('INCLUDE', ''))
+ else:
+ # hope someone notices this ...
+ raise NotImplementedError, compiler
+
+def is_comment(line):
+ return re.match(r'\s*#.*', line)
+
+def main(outdir, compiler, template_file, header_list_file):
+ if not os.path.isdir(outdir):
+ os.mkdir(outdir)
+
+ template = open(template_file, 'r').read()
+
+ for header in open(header_list_file, 'r'):
+ header = header.rstrip()
+ if 0 == len(header) or is_comment(header):
+ continue
+
+ path = header_path(header, compiler)
+ try:
+ f = open(os.path.join(outdir, header), 'w')
+ f.write(string.Template(template).substitute(HEADER=header,
+ HEADER_PATH=path))
+ finally:
+ f.close()
+
+
+if __name__ == '__main__':
+ if 5 != len(sys.argv):
+ print >>sys.stderr, """Usage:
+ python %s OUT_DIR ('msvc'|'gcc') TEMPLATE_FILE HEADER_LIST_FILE
+"""% (sys.argv[0])
+ sys.exit(1)
+
+ main(*sys.argv[1:])
diff --git a/config/msvc-stl-wrapper.template.h b/config/msvc-stl-wrapper.template.h
new file mode 100644
index 000000000000..97d45c617c8a
--- /dev/null
+++ b/config/msvc-stl-wrapper.template.h
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=8 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at:
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code.
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_${HEADER}_h
+#define mozilla_${HEADER}_h
+
+#if _HAS_EXCEPTIONS
+# error "STL code can only be used with -fno-exceptions"
+#endif
+
+// See if we're in code that can use mozalloc. NB: this duplicates
+// code in nscore.h because nscore.h pulls in prtypes.h, and chromium
+// can't build with that being included before base/basictypes.h.
+#if !defined(XPCOM_GLUE) && !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
+# include // to give mozalloc std::bad_alloc
+# include // to give mozalloc malloc/free decls
+# include
+# include "mozilla/mozalloc.h"
+#else
+# error "STL code can only be used with infallible ::operator new()"
+#endif
+
+#ifdef DEBUG
+// From
+// http://msdn.microsoft.com/en-us/library/aa985982%28VS.80%29.aspx
+// and
+// http://msdn.microsoft.com/en-us/library/aa985965%28VS.80%29.aspx
+// there appear to be two types of STL container checking. The
+// former is enabled by -D_DEBUG (which is implied by -DDEBUG), and
+// looks to be full generation/mutation checked iterators as done by
+// _GLIBCXX_DEBUG. The latter appears to just be bounds checking, and
+// is enabled by the following macros. It appears that the _DEBUG
+// iterators subsume _SECURE_SCL, and the following settings are
+// default anyway, so we'll just leave this commented out.
+//# define _SECURE_SCL 1
+//# define _SECURE_SCL_THROWS 0
+#else
+// Note: _SECURE_SCL iterators are on by default in opt builds. We
+// could leave them on, but since gcc doesn't, we might as well
+// preserve that behavior for perf reasons. nsTArray is in the same
+// camp as gcc. Can revisit later.
+//
+// FIXME/bug 551254: because we're not wrapping all the STL headers we
+// use, undefining this here can cause some headers to be built with
+// iterator checking and others not. Turning this off until we have a
+// better plan.
+//# undef _SECURE_SCL
+#endif
+
+// We know that code won't be able to catch exceptions, but that's OK
+// because we're not throwing them.
+#pragma warning( push )
+#pragma warning( disable : 4530 )
+
+#include <${HEADER_PATH}>
+
+#pragma warning( pop )
+
+#endif // if mozilla_${HEADER}_h
diff --git a/config/stl-headers b/config/stl-headers
new file mode 100644
index 000000000000..69790c9a1ebb
--- /dev/null
+++ b/config/stl-headers
@@ -0,0 +1,19 @@
+#
+# This file contains a list the of STL headers that have been reviewed
+# for exception safety and approved. See
+#
+# https://bugzilla.mozilla.org/show_bug.cgi?id=551254
+#
+# At build time, each header listed here is converted into a "wrapper
+# header" that is installed into dist/stl_includes.
+#
+# If you would like to request a new STL header be added, please
+# file a Core:XPCOM bug with a title like "STL: Review exception
+# safety of for gcc and MSVC".
+#
+
+# FIXME: these headers haven't been reviewed yet, but we use them
+# unsafely in modules/libpr0n, so we might as well prevent it from
+# throwing exceptions
+algorithm
+vector
diff --git a/configure.in b/configure.in
index 8791dc36eebd..83c05e49f675 100644
--- a/configure.in
+++ b/configure.in
@@ -759,6 +759,9 @@ EOF
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
+
+ STL_FLAGS='-D_HAS_EXCEPTIONS=0 -I$(DIST)/stl_wrappers'
+ WRAP_STL_INCLUDES=1
;;
esac
@@ -807,6 +810,9 @@ AC_SUBST(GNU_CXX)
AC_SUBST(INTEL_CC)
AC_SUBST(INTEL_CXX)
+AC_SUBST(STL_FLAGS)
+AC_SUBST(WRAP_STL_INCLUDES)
+
dnl ========================================================
dnl Checks for programs.
dnl ========================================================
@@ -3126,6 +3132,8 @@ EOF
"$ac_cv_have_visibility_class_bug" = "no"; then
VISIBILITY_FLAGS='-I$(DIST)/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h'
WRAP_SYSTEM_INCLUDES=1
+ STL_FLAGS='-I$(DIST)/stl_wrappers'
+ WRAP_STL_INCLUDES=1
else
VISIBILITY_FLAGS='-fvisibility=hidden'
fi # have visibility pragma bug
diff --git a/js/src/config/config.mk b/js/src/config/config.mk
index f1525fa8d516..3e354b92dadf 100644
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -526,7 +526,7 @@ OS_COMPILE_CMMFLAGS += -fobjc-exceptions
endif
COMPILE_CFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CFLAGS)
-COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
+COMPILE_CXXFLAGS = $(VISIBILITY_FLAGS) $(STL_FLAGS) $(DEFINES) $(INCLUDES) $(DSO_CFLAGS) $(DSO_PIC_CFLAGS) $(CXXFLAGS) $(RTL_FLAGS) $(OS_COMPILE_CXXFLAGS)
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS)
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS)
diff --git a/testing/mochitest/ssltunnel/Makefile.in b/testing/mochitest/ssltunnel/Makefile.in
index 71a3d9495678..160b97fc8e18 100644
--- a/testing/mochitest/ssltunnel/Makefile.in
+++ b/testing/mochitest/ssltunnel/Makefile.in
@@ -43,6 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+# This isn't XPCOM code, but it wants to use STL, so disable the STL
+# wrappers
+STL_FLAGS =
+
PROGRAM = ssltunnel$(BIN_SUFFIX)
CPPSRCS = ssltunnel.cpp
diff --git a/toolkit/crashreporter/client/Makefile.in b/toolkit/crashreporter/client/Makefile.in
index f16b8baa235a..f62d3b32cbf5 100644
--- a/toolkit/crashreporter/client/Makefile.in
+++ b/toolkit/crashreporter/client/Makefile.in
@@ -44,6 +44,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
+# Don't use the STL wrappers in the crashreporter clients; they don't
+# link with -lmozalloc, and it really doesn't matter here anyway.
+STL_FLAGS =
+
PROGRAM = crashreporter$(BIN_SUFFIX)
DIST_PROGRAM = crashreporter$(BIN_SUFFIX)
diff --git a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
index 7d7eafe50881..3f86440940d1 100644
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/sender/Makefile.in
@@ -46,6 +46,7 @@ LIBRARY_NAME = crash_report_sender_s
LOCAL_INCLUDES = -I$(srcdir)/../../..
DEFINES += -DUNICODE -D_UNICODE
+STL_FLAGS =
CPPSRCS = \
crash_report_sender.cc \
diff --git a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
index ff74819a30af..1aeebf784352 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/common/windows/Makefile.in
@@ -46,6 +46,7 @@ LIBRARY_NAME = breakpad_windows_common_s
LOCAL_INCLUDES = -I$(srcdir)/../..
DEFINES += -DUNICODE -D_UNICODE
+STL_FLAGS =
CPPSRCS = \
guid_string.cc \
diff --git a/tools/trace-malloc/lib/Makefile.in b/tools/trace-malloc/lib/Makefile.in
index 33b890396ce6..fe91cb63b57d 100644
--- a/tools/trace-malloc/lib/Makefile.in
+++ b/tools/trace-malloc/lib/Makefile.in
@@ -51,6 +51,7 @@ FORCE_STATIC_LIB = 1
LIBXUL_LIBRARY = 1
+STL_FLAGS =
CSRCS = \
nsTraceMalloc.c \
diff --git a/xpcom/glue/Makefile.in b/xpcom/glue/Makefile.in
index 5db33876c0e9..5b64237f6bec 100644
--- a/xpcom/glue/Makefile.in
+++ b/xpcom/glue/Makefile.in
@@ -134,6 +134,12 @@ EXPORTS_mozilla = \
SSE.h \
$(NULL)
+ifdef WRAP_STL_INCLUDES
+ifdef GCC_VERSION
+EXPORTS_mozilla += functexcept.h
+endif
+endif
+
SDK_LIBRARY = \
$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
$(NULL)
diff --git a/xpcom/glue/functexcept.h b/xpcom/glue/functexcept.h
new file mode 100644
index 000000000000..5492f8dd7373
--- /dev/null
+++ b/xpcom/glue/functexcept.h
@@ -0,0 +1,164 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: sw=2 ts=2 et :
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Mozilla Code
+ *
+ * The Initial Developer of the Original Code is
+ * The Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Chris Jones
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef mozilla_functexcept_h
+#define mozilla_functexcept_h
+
+#include
+#include
+#include
+
+// For gcc, we define these inline to abort so that we're absolutely
+// certain that (i) no exceptions are thrown from Gecko; (ii) these
+// errors are always terminal and caught by breakpad.
+
+// NB: It would be nice to #include "nsDebug.h" and use
+// NS_RUNTIMEABORT(), but because this file is used within chromium,
+// and nsDebug pulls in nscore, and nscore pulls in prtypes, and
+// chromium can't build with prtypes being included before
+// base/basictypes, then we have to roll our own aborting impl.
+
+// Assume that if we're building with gcc, we're on a platform where
+// abort() is fatal and triggers breakpad.
+#define MOZ_FE_ABORT(_msg) \
+ do { \
+ fputs(_msg, stderr); \
+ fputs("\n", stderr); \
+ abort(); \
+ } while (0)
+
+namespace std {
+
+inline void NS_NORETURN
+__throw_bad_exception(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_exception");
+}
+
+inline void NS_NORETURN
+__throw_bad_alloc(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_alloc");
+}
+
+inline void NS_NORETURN
+__throw_bad_cast(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_cast");
+}
+
+inline void NS_NORETURN
+__throw_bad_typeid(void)
+{
+ MOZ_FE_ABORT("fatal: STL threw bad_typeid");
+}
+
+inline void NS_NORETURN
+__throw_logic_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_domain_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_invalid_argument(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_length_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_out_of_range(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_runtime_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_range_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_overflow_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_underflow_error(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_ios_failure(const char* msg)
+{
+ MOZ_FE_ABORT(msg);
+}
+
+inline void NS_NORETURN
+__throw_system_error(int err)
+{
+ char error[128];
+ snprintf(error, sizeof(error)-1,
+ "fatal: STL threw system_error: %s (%d)", strerror(err), err);
+ MOZ_FE_ABORT(error);
+}
+
+} // namespace std
+
+#endif // mozilla_functexcept_h
From 732c02bb3124123b1477e02313b62ab734b5a09f Mon Sep 17 00:00:00 2001
From: Chris Jones
Date: Fri, 2 Apr 2010 12:58:12 -0500
Subject: [PATCH 17/62] Bug 551254: Simple (disabled) test that the STL
wrappers work correctly.
---
xpcom/tests/Makefile.in | 4 ++++
xpcom/tests/TestSTLWrappers.cpp | 35 +++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
create mode 100644 xpcom/tests/TestSTLWrappers.cpp
diff --git a/xpcom/tests/Makefile.in b/xpcom/tests/Makefile.in
index 55e7d6bb39e1..e66e9b30f09a 100644
--- a/xpcom/tests/Makefile.in
+++ b/xpcom/tests/Makefile.in
@@ -73,6 +73,10 @@ CPPSRCS = \
TestUnicodeArguments.cpp \
$(NULL)
+ifdef WRAP_STL_INCLUDES
+CPPSRCS += TestSTLWrappers.cpp
+endif
+
SIMPLE_PROGRAMS := $(CPPSRCS:.cpp=$(BIN_SUFFIX))
CPP_UNIT_TESTS = \
diff --git a/xpcom/tests/TestSTLWrappers.cpp b/xpcom/tests/TestSTLWrappers.cpp
new file mode 100644
index 000000000000..017959c5dfdc
--- /dev/null
+++ b/xpcom/tests/TestSTLWrappers.cpp
@@ -0,0 +1,35 @@
+#include
+
+#include
+#ifndef mozilla_algorithm_h
+# error "failed to wrap "
+#endif
+
+#include
+#ifndef mozilla_vector_h
+# error "failed to wrap "
+#endif
+
+// gcc errors out if we |try ... catch| with -fno-exceptions, but we
+// can still test on windows
+#ifdef XP_WIN
+# define TRY try
+# define CATCH(e) catch (e)
+#else
+# define TRY
+# define CATCH(e) if (0)
+#endif
+
+int main() {
+ std::vector v;
+
+ TRY {
+ // this should abort; NOT throw an exception
+ int unused = v.at(1);
+ } CATCH(const std::out_of_range& e) {
+ fputs("TEST-FAIL | TestSTLWrappers.cpp | caught an exception!\n",
+ stderr);
+ }
+
+ return 0;
+}
From 71d714f46580adb6aed3a089befe823a21499c32 Mon Sep 17 00:00:00 2001
From: Ted Mielczarek
Date: Fri, 2 Apr 2010 15:06:20 -0500
Subject: [PATCH 18/62] Bug 554188: 534919-1.html is known to fail on 10.6,
working on it. test only, no-r=
---
layout/reftests/bugs/reftest.list | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list
index 26b08b684b82..1add7dc824f1 100644
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1399,7 +1399,7 @@ fails HTTP(..) == 518172-2b.html 518172-b-ref.html # bug 518172
== 534526-1b.html 534526-1-ref.html
== 534808-1.html 534808-1-ref.html
== 534808-2.html 534808-2-ref.html
-== 534919-1.html 534919-1-ref.html
+random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 534919-1.html 534919-1-ref.html # fails on 10.6, bug 554188
== 537507-1.xul 537507-1-ref.xul
== 537507-2.html 537507-2-ref.html
== 537471-1.html 537471-1-ref.html
From e697e2f577d0643570e48d7d7cedf8d3ab88816b Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 14:49:38 -0700
Subject: [PATCH 19/62] Bug 556860: Fix unsigned/signed warnings in
nsGeolocation.cpp. r=dougt
---
dom/src/geolocation/nsGeolocation.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dom/src/geolocation/nsGeolocation.cpp b/dom/src/geolocation/nsGeolocation.cpp
index 6d07f66aa71a..59ab79a3a4c9 100644
--- a/dom/src/geolocation/nsGeolocation.cpp
+++ b/dom/src/geolocation/nsGeolocation.cpp
@@ -273,7 +273,9 @@ nsGeolocationRequest::Allow()
}
}
- if (lastPosition && maximumAge > 0 && ( (PR_Now() / PR_USEC_PER_MSEC ) - maximumAge <= cachedPositionTime) ) {
+ if (lastPosition && maximumAge > 0 &&
+ ( (PR_Now() / PR_USEC_PER_MSEC) - maximumAge <=
+ PRTime(cachedPositionTime) )) {
// okay, we can return a cached position
mAllowed = PR_TRUE;
@@ -922,7 +924,7 @@ NS_IMETHODIMP
nsGeolocation::ClearWatch(PRInt32 aWatchId)
{
PRUint32 count = mWatchingCallbacks.Length();
- if (aWatchId < 0 || count == 0 || aWatchId > count)
+ if (aWatchId < 0 || count == 0 || PRUint32(aWatchId) > count)
return NS_OK;
mWatchingCallbacks[aWatchId]->MarkCleared();
From 3949f4e154fd27f22d0855addb7acaee500eb03b Mon Sep 17 00:00:00 2001
From: Michael Wu
Date: Fri, 2 Apr 2010 15:09:05 -0700
Subject: [PATCH 20/62] Bug 542146 - Add support for building JS on Android.
patch by vlad, bcombee, and me. r=ted
---
js/src/Makefile.in | 3 +-
js/src/configure.in | 118 ++++++++++++++++++++++++++++++++++++++------
js/src/jscpucfg.cpp | 6 +--
js/src/jsnum.cpp | 6 +++
js/src/jstracer.cpp | 10 ++++
5 files changed, 123 insertions(+), 20 deletions(-)
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index dd42a433fd5f..27a86f8822a2 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -60,7 +60,8 @@ DIRS += shell
endif
# FIXME: bug 515383 covers getting these working on wince
-ifndef WINCE
+# bug 530688 covers Android
+ifneq (,$(filter-out WINCE ANDROID,$(OS_ARCH)))
ifdef ENABLE_TESTS
DIRS += jsapi-tests
endif
diff --git a/js/src/configure.in b/js/src/configure.in
index ff3fbe382fe9..ce61cf1d07af 100644
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -206,6 +206,72 @@ MOZ_ARG_ENABLE_BOOL(compile-environment,
COMPILE_ENVIRONMENT=1,
COMPILE_ENVIRONMENT= )
+dnl ========================================================
+dnl = Android uses a very custom (hacky) toolchain; we need to do this
+dnl = here, so that the compiler checks can succeed
+dnl ========================================================
+
+MOZ_ARG_WITH_STRING(android-ndk,
+[ --with-android-ndk=DIR
+ location where the Android NDK can be found],
+ android_ndk=$withval)
+
+MOZ_ARG_WITH_STRING(android-toolchain,
+[ --with-android-toolchain=DIR
+ location of the android toolchain, default NDK/build/prebuilt/HOST/arm-eabi-4.4.0],
+ android_toolchain=$withval)
+
+MOZ_ARG_WITH_STRING(android-platform,
+[ --with-android-platform=DIR
+ location of platform dir, default NDK/build/platforms/android-5/arch-arm],
+ android_platform=$withval)
+
+if test "$target" = "arm-android-eabi" ; then
+ if test -z "$android_ndk" ; then
+ AC_MSG_ERROR([You must specify --with-android-ndk=/path/to/ndk when targeting Android.])
+ fi
+
+ if test -z "$android_toolchain" ; then
+ android_toolchain="$android_ndk"/build/prebuilt/`uname -s | tr "[[:upper:]]" "[[:lower:]]"`-x86/arm-eabi-4.4.0
+ fi
+
+ if test -z "$android_platform" ; then
+ android_platform="$android_ndk"/build/platforms/android-5/arch-arm
+ fi
+
+ dnl set up compilers
+ AS="$android_toolchain"/bin/arm-eabi-as
+ CC="$android_toolchain"/bin/arm-eabi-gcc
+ CXX="$android_toolchain"/bin/arm-eabi-g++
+ CPP="$android_toolchain"/bin/arm-eabi-cpp
+ LD="$android_toolchain"/bin/arm-eabi-ld
+ AR="$android_toolchain"/bin/arm-eabi-ar
+ RANLIB="$android_toolchain"/bin/arm-eabi-ranlib
+ STRIP="$android_toolchain"/bin/arm-eabi-strip
+
+ CPPFLAGS="-I$android_platform/usr/include $CPPFLAGS"
+ CFLAGS="-mandroid -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CFLAGS"
+ CXXFLAGS="-mandroid -std=gnu++0x -I$android_platform/usr/include -msoft-float -fno-short-enums -fno-exceptions -march=armv5te -mthumb-interwork $CXXFLAGS"
+ LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS"
+
+ dnl prevent cross compile section from using these flags as host flags
+ if test -z "$HOST_CPPFLAGS" ; then
+ HOST_CPPFLAGS=" "
+ fi
+ if test -z "$HOST_CFLAGS" ; then
+ HOST_CFLAGS=" "
+ fi
+ if test -z "$HOST_CXXFLAGS" ; then
+ HOST_CXXFLAGS=" "
+ fi
+ if test -z "$HOST_LDFLAGS" ; then
+ HOST_LDFLAGS=" "
+ fi
+
+ AC_DEFINE(ANDROID)
+ AC_DEFINE(FORCE_LITTLE_ENDIAN)
+fi
+
dnl ========================================================
dnl Checks for compilers.
dnl ========================================================
@@ -1204,9 +1270,7 @@ x86_64 | ia64)
;;
arm)
- if test "$OS_ARCH" = "WINCE"; then
- CPU_ARCH="$OS_TEST"
- fi
+ CPU_ARCH=arm
;;
esac
@@ -1248,8 +1312,8 @@ if test "$GNU_CC"; then
if test -z "$INTEL_CC"; then
# Don't use -Wcast-align with ICC
case "$CPU_ARCH" in
- # And don't use it on hppa, ia64, sparc, since it's noisy there
- hppa | ia64 | sparc)
+ # And don't use it on hppa, ia64, sparc, or arm since it's noisy there
+ hppa | ia64 | sparc | arm)
;;
*)
_WARNINGS_CFLAGS="${_WARNINGS_CFLAGS} -Wcast-align"
@@ -1311,8 +1375,8 @@ if test "$GNU_CXX"; then
if test -z "$INTEL_CC"; then
# Don't use -Wcast-align with ICC
case "$CPU_ARCH" in
- # And don't use it on hppa, ia64, sparc, since it's noisy there
- hppa | ia64 | sparc)
+ # And don't use it on hppa, ia64, sparc, or arm since it's noisy there
+ hppa | ia64 | sparc | arm)
;;
*)
_WARNINGS_CXXFLAGS="${_WARNINGS_CXXFLAGS} -Wcast-align"
@@ -2529,24 +2593,24 @@ sparc-*)
;;
esac
-case "$target_os" in
-linux*)
+case "$target" in
+*-linux*|*-android-eabi)
AC_DEFINE(AVMPLUS_UNIX)
AC_DEFINE(AVMPLUS_LINUX)
;;
-darwin*)
+*-darwin*)
AC_DEFINE(AVMPLUS_UNIX)
;;
-solaris*)
+*-solaris*)
AC_DEFINE(AVMPLUS_UNIX)
;;
-freebsd*|kfreebsd*)
+*-freebsd*|*-kfreebsd*)
AC_DEFINE(AVMPLUS_UNIX)
;;
-*cygwin*|*mingw*|*mks*|*msvc*|*wince|*winmo)
+*-cygwin*|*-mingw*|*-mks*|*-msvc*|*-wince|*-winmo)
AC_DEFINE(AVMPLUS_WIN32)
;;
-*os2*)
+*-os2*)
AC_DEFINE(AVMPLUS_OS2)
;;
*)
@@ -3476,8 +3540,29 @@ dnl Put your C++ language/feature checks below
dnl ========================================================
AC_LANG_CPLUSPLUS
+ARM_ABI_PREFIX=
HAVE_GCC3_ABI=
if test "$GNU_CC"; then
+ if test "$CPU_ARCH" = "arm" ; then
+ AC_CACHE_CHECK(for ARM EABI,
+ ac_cv_gcc_arm_eabi,
+ [AC_TRY_COMPILE([],
+ [
+#if defined(__ARM_EABI__)
+ return 0;
+#else
+#error Not ARM EABI.
+#endif
+ ],
+ ac_cv_gcc_arm_eabi="yes",
+ ac_cv_gcc_arm_eabi="no")])
+ if test "$ac_cv_gcc_arm_eabi" = "yes"; then
+ ARM_ABI_PREFIX=eabi-
+ else
+ ARM_ABI_PREFIX=oabi-
+ fi
+ fi
+
AC_CACHE_CHECK(for gcc 3.0 ABI,
ac_cv_gcc_three_abi,
[AC_TRY_COMPILE([],
@@ -3491,10 +3576,10 @@ if test "$GNU_CC"; then
ac_cv_gcc_three_abi="yes",
ac_cv_gcc_three_abi="no")])
if test "$ac_cv_gcc_three_abi" = "yes"; then
- TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc3}"
+ TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc3}"
HAVE_GCC3_ABI=1
else
- TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-gcc2}"
+ TARGET_COMPILER_ABI="${TARGET_COMPILER_ABI-${ARM_ABI_PREFIX}gcc2}"
fi
fi
AC_SUBST(HAVE_GCC3_ABI)
@@ -5071,6 +5156,7 @@ dnl JavaScript shell
dnl ========================================================
AC_HAVE_FUNCS(setlocale)
+AC_HAVE_FUNCS(localeconv)
dnl ========================================================
dnl Use cygwin wrapper for win32 builds, except MSYS/MinGW
diff --git a/js/src/jscpucfg.cpp b/js/src/jscpucfg.cpp
index c52d9b8102dd..be4bf296c58c 100644
--- a/js/src/jscpucfg.cpp
+++ b/js/src/jscpucfg.cpp
@@ -44,7 +44,7 @@
#include
#include
-#ifdef CROSS_COMPILE
+#if defined(CROSS_COMPILE) && !defined(FORCE_BIG_ENDIAN) && !defined(FORCE_LITTLE_ENDIAN)
#include
#endif
@@ -91,10 +91,10 @@ int main(int argc, char **argv)
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n");
printf("#endif\n\n");
-#elif defined(IS_LITTLE_ENDIAN)
+#elif defined(IS_LITTLE_ENDIAN) || defined(FORCE_LITTLE_ENDIAN)
printf("#define IS_LITTLE_ENDIAN 1\n");
printf("#undef IS_BIG_ENDIAN\n\n");
-#elif defined(IS_BIG_ENDIAN)
+#elif defined(IS_BIG_ENDIAN) || defined(FORCE_BIG_ENDIAN)
printf("#undef IS_LITTLE_ENDIAN\n");
printf("#define IS_BIG_ENDIAN 1\n\n");
#else
diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp
index 059fb3f33e65..9e21ed3b3cdd 100644
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -729,6 +729,11 @@ js_InitRuntimeNumberState(JSContext *cx)
u.s.lo = 1;
number_constants[NC_MIN_VALUE].dval = u.d;
+#ifndef HAVE_LOCALECONV
+ rt->thousandsSeparator = JS_strdup(cx, "'");
+ rt->decimalSeparator = JS_strdup(cx, ".");
+ rt->numGrouping = JS_strdup(cx, "\3\0");
+#else
struct lconv *locale = localeconv();
rt->thousandsSeparator =
JS_strdup(cx, locale->thousands_sep ? locale->thousands_sep : "'");
@@ -736,6 +741,7 @@ js_InitRuntimeNumberState(JSContext *cx)
JS_strdup(cx, locale->decimal_point ? locale->decimal_point : ".");
rt->numGrouping =
JS_strdup(cx, locale->grouping ? locale->grouping : "\3\0");
+#endif
return rt->thousandsSeparator && rt->decimalSeparator && rt->numGrouping;
}
diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp
index 1081773beab7..cc73b1aae4ba 100644
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -7253,6 +7253,16 @@ static bool arm_has_neon = false;
static bool arm_has_iwmmxt = false;
static bool arm_tests_initialized = false;
+#ifdef ANDROID
+// android doesn't have Elf32_auxv_t defined in elf.h, but it does have /proc/self/auxv
+typedef struct {
+ uint32_t a_type;
+ union {
+ uint32_t a_val;
+ } a_un;
+} Elf32_auxv_t;
+#endif
+
static void
arm_read_auxv()
{
From f60313c3a420e57735fc7a9e952f4523b4b97f77 Mon Sep 17 00:00:00 2001
From: Vivien Nicolas <21@vingtetun.org>
Date: Fri, 2 Apr 2010 18:25:40 -0400
Subject: [PATCH 21/62] Bug 461843: Backout changes to avoid assertions but
broke scrollbar margin support [r=roc]
---
layout/generic/nsFrame.cpp | 11 +++++----
layout/generic/nsGfxScrollFrame.cpp | 35 ++++++++++++++---------------
2 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index cbe4a9a2f7d8..29fc3705be25 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6004,10 +6004,13 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
// When clicked on, the selection position within the element
// will be enough to make them keyboard scrollable.
nsIScrollableFrame *scrollFrame = do_QueryFrame(this);
- if (scrollFrame && scrollFrame->GetScrollbarVisibility() != 0) {
- // Scroll bars will be used for overflow
- isFocusable = PR_TRUE;
- tabIndex = 0;
+ if (scrollFrame) {
+ nsMargin margin = scrollFrame->GetActualScrollbarSizes();
+ if (margin.top || margin.right || margin.bottom || margin.left) {
+ // Scroll bars will be used for overflow
+ isFocusable = PR_TRUE;
+ tabIndex = 0;
+ }
}
}
}
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index 69e1c9f77a5f..12007b2ccad1 100644
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -291,10 +291,12 @@ GetScrollbarMetrics(nsBoxLayoutState& aState, nsIBox* aBox, nsSize* aMin,
if (aMin) {
*aMin = aBox->GetMinSize(aState);
+ nsBox::AddMargin(aBox, *aMin);
}
if (aPref) {
*aPref = aBox->GetPrefSize(aState);
+ nsBox::AddMargin(aBox, *aPref);
}
}
@@ -939,6 +941,7 @@ nsMargin nsGfxScrollFrameInner::GetDesiredScrollbarSizes(nsBoxLayoutState* aStat
if (mVScrollbarBox) {
nsSize size = mVScrollbarBox->GetPrefSize(*aState);
+ nsBox::AddMargin(mVScrollbarBox, size);
if (IsScrollbarOnRight())
result.left = size.width;
else
@@ -947,6 +950,7 @@ nsMargin nsGfxScrollFrameInner::GetDesiredScrollbarSizes(nsBoxLayoutState* aStat
if (mHScrollbarBox) {
nsSize size = mHScrollbarBox->GetPrefSize(*aState);
+ nsBox::AddMargin(mHScrollbarBox, size);
// We don't currently support any scripts that would require a scrollbar
// at the top. (Are there any?)
result.bottom = size.height;
@@ -1086,12 +1090,14 @@ nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState)
if (mInner.mVScrollbarBox &&
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
nsSize vSize = mInner.mVScrollbarBox->GetPrefSize(aState);
+ nsBox::AddMargin(mInner.mVScrollbarBox, vSize);
pref.width += vSize.width;
}
if (mInner.mHScrollbarBox &&
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
nsSize hSize = mInner.mHScrollbarBox->GetPrefSize(aState);
+ nsBox::AddMargin(mInner.mHScrollbarBox, hSize);
pref.height += hSize.height;
}
@@ -1115,6 +1121,7 @@ nsXULScrollFrame::GetMinSize(nsBoxLayoutState& aState)
if (mInner.mVScrollbarBox &&
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
nsSize vSize = mInner.mVScrollbarBox->GetMinSize(aState);
+ AddMargin(mInner.mVScrollbarBox, vSize);
min.width += vSize.width;
if (min.height < vSize.height)
min.height = vSize.height;
@@ -1123,6 +1130,7 @@ nsXULScrollFrame::GetMinSize(nsBoxLayoutState& aState)
if (mInner.mHScrollbarBox &&
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
nsSize hSize = mInner.mHScrollbarBox->GetMinSize(aState);
+ AddMargin(mInner.mHScrollbarBox, hSize);
min.height += hSize.height;
if (min.width < hSize.width)
min.width = hSize.width;
@@ -2498,6 +2506,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
return PR_FALSE;
nsSize hSize = mInner.mHScrollbarBox->GetPrefSize(aState);
+ nsBox::AddMargin(mInner.mHScrollbarBox, hSize);
mInner.SetScrollbarVisibility(mInner.mHScrollbarBox, aAdd);
@@ -2516,6 +2525,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState,
return PR_FALSE;
nsSize vSize = mInner.mVScrollbarBox->GetPrefSize(aState);
+ nsBox::AddMargin(mInner.mVScrollbarBox, vSize);
mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, aAdd);
@@ -3124,11 +3134,9 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
nsRect vRect(mScrollPort);
vRect.width = aContentArea.width - mScrollPort.width;
vRect.x = scrollbarOnLeft ? aContentArea.x : mScrollPort.XMost();
-#ifdef DEBUG
nsMargin margin;
mVScrollbarBox->GetMargin(margin);
- NS_ASSERTION(margin == nsMargin(0,0,0,0), "Scrollbar margin not supported");
-#endif
+ vRect.Deflate(margin);
AdjustScrollbarRectForResizer(mOuter, presContext, vRect, hasResizer, PR_TRUE);
LayoutAndInvalidate(aState, mVScrollbarBox, vRect);
}
@@ -3138,11 +3146,9 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
nsRect hRect(mScrollPort);
hRect.height = aContentArea.height - mScrollPort.height;
hRect.y = PR_TRUE ? mScrollPort.YMost() : aContentArea.y;
-#ifdef DEBUG
nsMargin margin;
mHScrollbarBox->GetMargin(margin);
- NS_ASSERTION(margin == nsMargin(0,0,0,0), "Scrollbar margin not supported");
-#endif
+ hRect.Deflate(margin);
AdjustScrollbarRectForResizer(mOuter, presContext, hRect, hasResizer, PR_FALSE);
LayoutAndInvalidate(aState, mHScrollbarBox, hRect);
}
@@ -3239,18 +3245,11 @@ nsGfxScrollFrameInner::GetScrolledRectInternal(const nsRect& aScrolledFrameOverf
nsMargin
nsGfxScrollFrameInner::GetActualScrollbarSizes() const
{
- nsMargin result(0, 0, 0, 0);
- if (mVScrollbarBox) {
- if (IsScrollbarOnRight()) {
- result.right = mVScrollbarBox->GetRect().width;
- } else {
- result.left = mVScrollbarBox->GetRect().width;
- }
- }
- if (mHScrollbarBox) {
- result.bottom = mHScrollbarBox->GetRect().height;
- }
- return result;
+ nsRect r = mOuter->GetPaddingRect() - mOuter->GetPosition();
+
+ return nsMargin(mScrollPort.x - r.x, mScrollPort.y - r.y,
+ r.XMost() - mScrollPort.XMost(),
+ r.YMost() - mScrollPort.YMost());
}
void
From ef8f4acfc5c1595bffb5fa3fa2921b873e152493 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 16:47:15 -0700
Subject: [PATCH 22/62] Bug 556897: Fix GCC warnings "FOO will be initialized
after BAR when initialized here" in content/media/ogg/. r=cpearce
---
content/media/ogg/nsOggDecoder.cpp | 2 +-
content/media/ogg/nsOggReader.h | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/content/media/ogg/nsOggDecoder.cpp b/content/media/ogg/nsOggDecoder.cpp
index b4ba4dcc7b62..afd11c320b48 100644
--- a/content/media/ogg/nsOggDecoder.cpp
+++ b/content/media/ogg/nsOggDecoder.cpp
@@ -89,7 +89,6 @@ float nsOggDecoder::GetDuration()
}
nsOggDecoder::nsOggDecoder() :
- mMonitor("media.decoder"),
mDecoderPosition(0),
mPlaybackPosition(0),
mCurrentTime(0.0),
@@ -97,6 +96,7 @@ nsOggDecoder::nsOggDecoder() :
mRequestedSeekTime(-1.0),
mDuration(-1),
mSeekable(PR_TRUE),
+ mMonitor("media.decoder"),
mPlayState(PLAY_STATE_PAUSED),
mNextState(PLAY_STATE_PAUSED),
mResourceLoaded(PR_FALSE),
diff --git a/content/media/ogg/nsOggReader.h b/content/media/ogg/nsOggReader.h
index 4ee945c49d69..64ca5e872524 100644
--- a/content/media/ogg/nsOggReader.h
+++ b/content/media/ogg/nsOggReader.h
@@ -70,8 +70,8 @@ public:
: mTime(aTime),
mDuration(aDuration),
mSamples(aSamples),
- mAudioData(aData),
- mChannels(aChannels)
+ mChannels(aChannels),
+ mAudioData(aData)
{
MOZ_COUNT_CTOR(SoundData);
}
@@ -83,8 +83,8 @@ public:
: mTime(-1),
mDuration(aDuration),
mSamples(aSamples),
- mAudioData(aData),
- mChannels(aChannels)
+ mChannels(aChannels),
+ mAudioData(aData)
{
MOZ_COUNT_CTOR(SoundData);
}
From 17c090d9ff476c5b6fe7a21074d1bfc2842044f2 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Fri, 2 Apr 2010 16:47:18 -0700
Subject: [PATCH 23/62] Bug 556900: Fix GCC warnings in
nsOggPlayStateMachine.cpp. r=cpearce
---
content/media/ogg/nsOggPlayStateMachine.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/content/media/ogg/nsOggPlayStateMachine.cpp b/content/media/ogg/nsOggPlayStateMachine.cpp
index 558a74d5328b..bc89c45f7dec 100644
--- a/content/media/ogg/nsOggPlayStateMachine.cpp
+++ b/content/media/ogg/nsOggPlayStateMachine.cpp
@@ -1021,9 +1021,9 @@ void nsOggPlayStateMachine::RenderVideoFrame(VideoData* aData)
PRUint32 picXLimit;
PRUint32 picYLimit;
if (!AddOverflow(mInfo.mPicture.x, mInfo.mPicture.width, picXLimit) ||
- picXLimit > PR_ABS(aData->mBuffer[0].stride) ||
+ picXLimit > PRUint32(PR_ABS(aData->mBuffer[0].stride)) ||
!AddOverflow(mInfo.mPicture.y, mInfo.mPicture.height, picYLimit) ||
- picYLimit > PR_ABS(aData->mBuffer[0].height))
+ picYLimit > PRUint32(PR_ABS(aData->mBuffer[0].height)))
{
// The specified picture dimensions can't be contained inside the video
// frame, we'll stomp memory if we try to copy it. Fail.
@@ -1049,10 +1049,9 @@ void nsOggPlayStateMachine::RenderVideoFrame(VideoData* aData)
unsigned char* cr = cb + (cbCrStride * PR_ABS(aData->mBuffer[1].height));
unsigned char* p = y;
- unsigned yStride = mInfo.mPicture.width;
unsigned char* q = aData->mBuffer[0].data + mInfo.mPicture.x +
aData->mBuffer[0].stride * mInfo.mPicture.y;
- for(unsigned i=0; i < mInfo.mPicture.height; ++i) {
+ for(PRInt32 i=0; i < mInfo.mPicture.height; ++i) {
NS_ASSERTION(q + mInfo.mPicture.width <
aData->mBuffer[0].data + aData->mBuffer[0].stride * aData->mBuffer[0].height,
"Y read must be in bounds");
From 9afe5059b5c30254b4b981ce159fe1548e261c68 Mon Sep 17 00:00:00 2001
From: Chris Pearce
Date: Fri, 2 Apr 2010 17:03:12 -0700
Subject: [PATCH 24/62] Bug 531340 - Bustage fix on comm-central. r=bustage-fix
---
content/media/ogg/nsOggHacks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/content/media/ogg/nsOggHacks.h b/content/media/ogg/nsOggHacks.h
index a56d897a107c..8f019a8799f4 100644
--- a/content/media/ogg/nsOggHacks.h
+++ b/content/media/ogg/nsOggHacks.h
@@ -69,7 +69,7 @@ namespace mozilla {
*
* MUCH PREFERRED to bare calls to Monitor.Exit and Enter.
*/
-class NS_COM_GLUE NS_STACK_CLASS MonitorAutoExit
+class MonitorAutoExit
{
public:
/**
From 9994fdbfbf9b6c52c918f2a2adb96d19c33b80ff Mon Sep 17 00:00:00 2001
From: Josh Aas
Date: Fri, 2 Apr 2010 20:19:31 -0500
Subject: [PATCH 25/62] Bug 555234: Enable OOPP for x86 OS X and don't export
mochitests conditional on MOZ_IPC. r=bsmedberg,ted
---
browser/installer/package-manifest.in | 3 +-
configure.in | 3 --
ipc/app/fake/Makefile.in | 46 +++++++++++++++++++
ipc/app/fake/mozilla-runtime.cpp | 45 ++++++++++++++++++
modules/plugin/test/mochitest/Makefile.in | 18 ++------
.../plugin/test/mochitest/test_GCrace.html | 16 ++++++-
toolkit/toolkit-makefiles.sh | 1 +
toolkit/toolkit-tiers.mk | 5 ++
8 files changed, 118 insertions(+), 19 deletions(-)
create mode 100644 ipc/app/fake/Makefile.in
create mode 100644 ipc/app/fake/mozilla-runtime.cpp
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index 6505ed935b14..5c1e2b7bc7a4 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -48,12 +48,13 @@
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
#ifdef XP_MACOSX
@BINPATH@/XUL
+@BINPATH@/mozilla-runtime@BIN_SUFFIX@
#else
@BINPATH@/@DLL_PREFIX@xul@DLL_SUFFIX@
-#endif
#ifdef MOZ_IPC
@BINPATH@/mozilla-runtime@BIN_SUFFIX@
#endif
+#endif
#ifdef WINCE
@BINPATH@/mozce_shunt.dll
#elifdef XP_WIN32
diff --git a/configure.in b/configure.in
index 83c05e49f675..81b19ec18f5b 100644
--- a/configure.in
+++ b/configure.in
@@ -5485,9 +5485,6 @@ case "${target}" in
powerpc-apple-darwin*)
MOZ_IPC=
;;
-i386-apple-darwin*)
- MOZ_IPC=
- ;;
*-wince*)
MOZ_IPC=
;;
diff --git a/ipc/app/fake/Makefile.in b/ipc/app/fake/Makefile.in
new file mode 100644
index 000000000000..631703a42489
--- /dev/null
+++ b/ipc/app/fake/Makefile.in
@@ -0,0 +1,46 @@
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# Mozilla Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH = ../../..
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+SIMPLE_PROGRAMS = mozilla-runtime
+
+include $(topsrcdir)/config/rules.mk
diff --git a/ipc/app/fake/mozilla-runtime.cpp b/ipc/app/fake/mozilla-runtime.cpp
new file mode 100644
index 000000000000..e9dbf4a58ab8
--- /dev/null
+++ b/ipc/app/fake/mozilla-runtime.cpp
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * vim: sw=4 ts=4 et :
+ * ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Fake Mozilla Plugin App.
+ *
+ * The Initial Developer of the Original Code is
+ * Josh Aas .
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include
+
+int main()
+{
+ printf ("All your process are belong to us.\n");
+ return 0;
+}
diff --git a/modules/plugin/test/mochitest/Makefile.in b/modules/plugin/test/mochitest/Makefile.in
index 0186bfe1b9d1..ba2d9d49189f 100644
--- a/modules/plugin/test/mochitest/Makefile.in
+++ b/modules/plugin/test/mochitest/Makefile.in
@@ -80,19 +80,14 @@ _MOCHITEST_FILES = \
test_streamatclose.html \
neverending.sjs \
test_newstreamondestroy.html \
- $(NULL)
-
-# test_npruntime_npnsetexception.html \ Disabled for e10s
-
-ifdef MOZ_IPC
-_MOCHITEST_FILES += \
test_crashing.html \
test_crashing2.html \
test_hanging.html \
crashing_subpage.html \
test_GCrace.html \
$(NULL)
-endif
+
+# test_npruntime_npnsetexception.html \ Disabled for e10s
ifeq ($(OS_ARCH),WINNT)
_MOCHITEST_FILES += \
@@ -102,6 +97,8 @@ endif
_MOCHICHROME_FILES = \
test_bug479979.xul \
+ test_crash_notify.xul \
+ test_crash_notify_no_report.xul \
test_npruntime.xul \
test_privatemode.xul \
test_wmode.xul \
@@ -119,13 +116,6 @@ _MOCHITEST_FILES += \
$(NULL)
endif
-ifdef MOZ_IPC
-_MOCHICHROME_FILES += \
- test_crash_notify.xul \
- test_crash_notify_no_report.xul \
- $(NULL)
-endif
-
libs:: $(_MOCHICHROME_FILES)
$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
diff --git a/modules/plugin/test/mochitest/test_GCrace.html b/modules/plugin/test/mochitest/test_GCrace.html
index 40e4f04e14df..37a1830fab33 100644
--- a/modules/plugin/test/mochitest/test_GCrace.html
+++ b/modules/plugin/test/mochitest/test_GCrace.html
@@ -7,7 +7,7 @@
src="/tests/SimpleTest/SimpleTest.js">
-
+
@@ -15,6 +15,20 @@
+
+
+link
diff --git a/toolkit/components/places/tests/mochitest/test_bug_461710.html b/toolkit/components/places/tests/mochitest/test_bug_461710.html
index 39ca52941392..12ff91b38cd4 100644
--- a/toolkit/components/places/tests/mochitest/test_bug_461710.html
+++ b/toolkit/components/places/tests/mochitest/test_bug_461710.html
@@ -112,6 +112,13 @@ function loadNextTest() {
iframe.src = prefix + subtests[testNum-1];
}
+function getColor(doc, win, id) {
+ var elem = doc.getElementById(id);
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIDOMWindowUtils);
+ return utils.getVisitedDependentComputedStyle(elem, "", "color");
+}
function checkTest() {
switch (testNum) {
@@ -123,24 +130,21 @@ function checkTest() {
// run outside of private mode, link should appear as visited
var doc = iframe.contentDocument;
var win = doc.defaultView;
- var style = win.getComputedStyle(doc.getElementById("link"), "");
- is(style.getPropertyValue("color"), kRed, "Visited link coloring should work outside of private mode");
+ is(getColor(doc, win, "link"), kRed, "Visited link coloring should work outside of private mode");
break;
case 3:
// run inside of private mode, link should appear as not visited
var doc = iframe.contentDocument;
var win = doc.defaultView;
- var style = win.getComputedStyle(doc.getElementById("link"), "");
- is(style.getPropertyValue("color"), kBlue, "Visited link coloring should not work inside of private mode");
+ is(getColor(doc, win, "link"), kBlue, "Visited link coloring should not work inside of private mode");
break;
case 4:
// run outside of private mode, link should appear as visited
var doc = iframe.contentDocument;
var win = doc.defaultView;
- var style = win.getComputedStyle(doc.getElementById("link"), "");
- is(style.getPropertyValue("color"), kRed, "Visited link coloring should work outside of private mode");
+ is(getColor(doc, win, "link"), kRed, "Visited link coloring should work outside of private mode");
break;
default:
From a35f4b2aacd6fb40bb0096584d3a3664a397525e Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:25 -0700
Subject: [PATCH 31/62] Use the appropriate color based on visitedness for the
'color' property. (Bug 147777) r=roc
---
layout/generic/nsBulletFrame.cpp | 4 +---
layout/generic/nsHTMLContainerFrame.cpp | 4 ++--
layout/generic/nsTextFrameThebes.cpp | 15 +++++++--------
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp
index ff906480b5be..2418e3003121 100644
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -247,10 +247,8 @@ nsBulletFrame::PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
}
}
- const nsStyleColor* myColor = GetStyleColor();
-
nsCOMPtr fm;
- aRenderingContext.SetColor(myColor->mColor);
+ aRenderingContext.SetColor(GetVisitedDependentColor(eCSSProperty_color));
mTextIsRTL = PR_FALSE;
diff --git a/layout/generic/nsHTMLContainerFrame.cpp b/layout/generic/nsHTMLContainerFrame.cpp
index b10ccd5e75ac..03dd99669b2a 100644
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -450,7 +450,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
aDecorations = this->GetStyleTextReset()->mTextDecoration &
NS_STYLE_TEXT_DECORATION_LINES_MASK;
if (aDecorations) {
- nscolor color = this->GetStyleColor()->mColor;
+ nscolor color = this->GetVisitedDependentColor(eCSSProperty_color);
aUnderColor = color;
aOverColor = color;
aStrikeColor = color;
@@ -470,7 +470,7 @@ nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext,
PRUint8 decors = frame->GetStyleTextReset()->mTextDecoration & decorMask;
if (decors) {
// A *new* text-decoration is found.
- nscolor color = frame->GetStyleColor()->mColor;
+ nscolor color = frame->GetVisitedDependentColor(eCSSProperty_color);
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & decors) {
aUnderColor = color;
diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp
index 72af465d0119..6280b7d6cee1 100644
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -108,7 +108,6 @@
#include "nsIAccessibilityService.h"
#endif
#include "nsAutoPtr.h"
-#include "nsStyleSet.h"
#include "nsBidiFrames.h"
#include "nsBidiPresUtils.h"
@@ -3006,7 +3005,7 @@ nsTextPaintStyle::EnsureSufficientContrast(nscolor *aForeColor, nscolor *aBackCo
nscolor
nsTextPaintStyle::GetTextColor()
{
- nscolor color = mFrame->GetStyleColor()->mColor;
+ nscolor color = mFrame->GetVisitedDependentColor(eCSSProperty_color);
if (ShouldDarkenColors(mPresContext)) {
color = DarkenColor(color);
}
@@ -3169,7 +3168,7 @@ nsTextPaintStyle::InitSelectionColors()
if (sc) {
const nsStyleBackground* bg = sc->GetStyleBackground();
mSelectionBGColor = bg->mBackgroundColor;
- mSelectionTextColor = sc->GetStyleColor()->mColor;
+ mSelectionTextColor = sc->GetVisitedDependentColor(eCSSProperty_color);
return PR_TRUE;
}
}
@@ -3199,8 +3198,8 @@ nsTextPaintStyle::InitSelectionColors()
// On MacOS X, we don't exchange text color and BG color.
if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
- mSelectionTextColor = EnsureDifferentColors(mFrame->GetStyleColor()->mColor,
- mSelectionBGColor);
+ nscoord frameColor = mFrame->GetVisitedDependentColor(eCSSProperty_color);
+ mSelectionTextColor = EnsureDifferentColors(frameColor, mSelectionBGColor);
} else {
EnsureSufficientContrast(&mSelectionTextColor, &mSelectionBGColor);
}
@@ -4004,13 +4003,13 @@ nsTextFrame::GetTextDecorations(nsPresContext* aPresContext)
// This handles the La
// la la case. The link underline should be green.
useOverride = PR_TRUE;
- overrideColor = context->GetStyleColor()->mColor;
+ overrideColor = context->GetVisitedDependentColor(eCSSProperty_color);
}
PRUint8 useDecorations = decorMask & styleText->mTextDecoration;
if (useDecorations) {// a decoration defined here
- nscolor color = context->GetStyleColor()->mColor;
-
+ nscolor color = context->GetVisitedDependentColor(eCSSProperty_color);
+
if (NS_STYLE_TEXT_DECORATION_UNDERLINE & useDecorations) {
decorations.mUnderColor = useOverride ? overrideColor : color;
decorMask &= ~NS_STYLE_TEXT_DECORATION_UNDERLINE;
From 109a546aaab21bdd014ed4f61943e4e790221ee8 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 32/62] Make PaintBackgroundWithSC and related methods operate
on nsStyleContext* rather than const nsStyleBackground*. (Bug 147777)
r=zweinberg
---
layout/base/nsCSSFrameConstructor.cpp | 4 +-
layout/base/nsCSSRendering.cpp | 52 ++++++++++---------
layout/base/nsCSSRendering.h | 14 ++---
layout/base/nsDisplayList.cpp | 16 +++---
layout/base/nsLayoutUtils.cpp | 5 +-
layout/base/nsPresShell.cpp | 4 +-
layout/generic/nsCanvasFrame.cpp | 3 +-
layout/generic/nsFrame.cpp | 4 +-
layout/mathml/nsMathMLChar.cpp | 4 +-
layout/tables/nsTableCellFrame.cpp | 2 +-
layout/tables/nsTableFrame.cpp | 6 +--
layout/tables/nsTablePainter.cpp | 25 +++++----
layout/tables/nsTablePainter.h | 4 +-
.../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 3 +-
14 files changed, 77 insertions(+), 69 deletions(-)
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index e93260b27e32..eea8c3790c94 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -7233,8 +7233,8 @@ ApplyRenderingChangeToTree(nsPresContext* aPresContext,
// If the frame's background is propagated to an ancestor, walk up to
// that ancestor.
- const nsStyleBackground *bg;
- while (!nsCSSRendering::FindBackground(aPresContext, aFrame, &bg)) {
+ nsStyleContext *bgSC;
+ while (!nsCSSRendering::FindBackground(aPresContext, aFrame, &bgSC)) {
aFrame = aFrame->GetParent();
NS_ASSERTION(aFrame, "root frame must paint");
}
diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp
index 0d812c47353f..972b0c343177 100644
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1022,22 +1022,22 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
* the resulting style context to use for the background information
* will be filled in to |aBackground|.
*/
-const nsStyleBackground*
+nsStyleContext*
nsCSSRendering::FindRootFrameBackground(nsIFrame* aForFrame)
{
- return FindBackgroundStyleFrame(aForFrame)->GetStyleBackground();
+ return FindBackgroundStyleFrame(aForFrame)->GetStyleContext();
}
inline PRBool
FindElementBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
- const nsStyleBackground** aBackground)
+ nsStyleContext** aBackgroundSC)
{
if (aForFrame == aRootElementFrame) {
// We must have propagated our background to the viewport or canvas. Abort.
return PR_FALSE;
}
- *aBackground = aForFrame->GetStyleBackground();
+ *aBackgroundSC = aForFrame->GetStyleContext();
// Return true unless the frame is for a BODY element whose background
// was propagated to the viewport.
@@ -1074,15 +1074,15 @@ FindElementBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
PRBool
nsCSSRendering::FindBackground(nsPresContext* aPresContext,
nsIFrame* aForFrame,
- const nsStyleBackground** aBackground)
+ nsStyleContext** aBackgroundSC)
{
nsIFrame* rootElementFrame =
aPresContext->PresShell()->FrameConstructor()->GetRootElementStyleFrame();
if (IsCanvasFrame(aForFrame)) {
- *aBackground = FindCanvasBackground(aForFrame, rootElementFrame);
+ *aBackgroundSC = FindCanvasBackground(aForFrame, rootElementFrame);
return PR_TRUE;
} else {
- return FindElementBackground(aForFrame, rootElementFrame, aBackground);
+ return FindElementBackground(aForFrame, rootElementFrame, aBackgroundSC);
}
}
@@ -1387,8 +1387,8 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
NS_PRECONDITION(aForFrame,
"Frame is expected to be provided to PaintBackground");
- const nsStyleBackground *background;
- if (!FindBackground(aPresContext, aForFrame, &background)) {
+ nsStyleContext *sc;
+ if (!FindBackground(aPresContext, aForFrame, &sc)) {
// We don't want to bail out if moz-appearance is set on a root
// node. If it has a parent content node, bail because it's not
// a root, other wise keep going in order to let the theme stuff
@@ -1403,11 +1403,11 @@ nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
return;
}
- background = aForFrame->GetStyleBackground();
+ sc = aForFrame->GetStyleContext();
}
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
- aDirtyRect, aBorderArea, *background,
+ aDirtyRect, aBorderArea, sc,
*aForFrame->GetStyleBorder(), aFlags,
aBGClipRect);
}
@@ -1548,7 +1548,7 @@ SetupBackgroundClip(gfxContext *aCtx, PRUint8 aBackgroundClip,
static nscolor
DetermineBackgroundColorInternal(nsPresContext* aPresContext,
- const nsStyleBackground& aBackground,
+ nsStyleContext* aStyleContext,
nsIFrame* aFrame,
PRBool& aDrawBackgroundImage,
PRBool& aDrawBackgroundColor)
@@ -1562,8 +1562,9 @@ DetermineBackgroundColorInternal(nsPresContext* aPresContext,
}
nscolor bgColor;
+ const nsStyleBackground *bg = aStyleContext->GetStyleBackground();
if (aDrawBackgroundColor) {
- bgColor = aBackground.mBackgroundColor;
+ bgColor = bg->mBackgroundColor;
if (NS_GET_A(bgColor) == 0)
aDrawBackgroundColor = PR_FALSE;
} else {
@@ -1572,7 +1573,7 @@ DetermineBackgroundColorInternal(nsPresContext* aPresContext,
// transparent, but we are expected to use white instead of whatever
// color was specified.
bgColor = NS_RGB(255, 255, 255);
- if (aDrawBackgroundImage || !aBackground.IsTransparent())
+ if (aDrawBackgroundImage || !bg->IsTransparent())
aDrawBackgroundColor = PR_TRUE;
else
bgColor = NS_RGBA(0,0,0,0);
@@ -1583,13 +1584,13 @@ DetermineBackgroundColorInternal(nsPresContext* aPresContext,
nscolor
nsCSSRendering::DetermineBackgroundColor(nsPresContext* aPresContext,
- const nsStyleBackground& aBackground,
+ nsStyleContext* aStyleContext,
nsIFrame* aFrame)
{
PRBool drawBackgroundImage;
PRBool drawBackgroundColor;
return DetermineBackgroundColorInternal(aPresContext,
- aBackground,
+ aStyleContext,
aFrame,
drawBackgroundImage,
drawBackgroundColor);
@@ -2062,7 +2063,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBackground& aBackground,
+ nsStyleContext* aBackgroundSC,
const nsStyleBorder& aBorder,
PRUint32 aFlags,
nsRect* aBGClipRect)
@@ -2098,7 +2099,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
PRBool drawBackgroundColor;
nscolor bgColor = DetermineBackgroundColorInternal(aPresContext,
- aBackground,
+ aBackgroundSC,
aForFrame,
drawBackgroundImage,
drawBackgroundColor);
@@ -2132,6 +2133,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// SetupCurrentBackgroundClip. (Arguably it should be the
// intersection, but that breaks the table painter -- in particular,
// taking the intersection breaks reftests/bugs/403249-1[ab].)
+ const nsStyleBackground *bg = aBackgroundSC->GetStyleBackground();
nsRect bgClipArea, dirtyRect;
gfxRect dirtyRectGfx;
PRUint8 currentBackgroundClip;
@@ -2150,7 +2152,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// radii as the border code will.
// The background-color is drawn based on the bottom
// background-clip.
- currentBackgroundClip = aBackground.BottomLayer().mClip;
+ currentBackgroundClip = bg->BottomLayer().mClip;
isSolidBorder =
(aFlags & PAINTBG_WILL_PAINT_BORDER) && IsOpaqueBorder(aBorder);
if (isSolidBorder)
@@ -2180,12 +2182,12 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
// Ensure we get invalidated for loads of the image. We need to do
// this here because this might be the only code that knows about the
// association of the style data with the frame.
- aPresContext->SetupBackgroundImageLoaders(aForFrame, &aBackground);
+ aPresContext->SetupBackgroundImageLoaders(aForFrame, bg);
// We can skip painting the background color if a background image is opaque.
if (drawBackgroundColor &&
- aBackground.BottomLayer().mRepeat == NS_STYLE_BG_REPEAT_XY &&
- aBackground.BottomLayer().mImage.IsOpaque())
+ bg->BottomLayer().mRepeat == NS_STYLE_BG_REPEAT_XY &&
+ bg->BottomLayer().mImage.IsOpaque())
drawBackgroundColor = PR_FALSE;
// The background color is rendered over the entire dirty area,
@@ -2199,8 +2201,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
}
if (drawBackgroundImage) {
- NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, &aBackground) {
- const nsStyleBackground::Layer &layer = aBackground.mLayers[i];
+ NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
+ const nsStyleBackground::Layer &layer = bg->mLayers[i];
if (!aBGClipRect) {
PRUint8 newBackgroundClip =
isSolidBorder ? NS_STYLE_BG_CLIP_PADDING : layer.mClip;
@@ -2214,7 +2216,7 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
}
if (!dirtyRectGfx.IsEmpty()) {
PaintBackgroundLayer(aPresContext, aRenderingContext, aForFrame, aFlags,
- dirtyRect, aBorderArea, bgClipArea, aBackground,
+ dirtyRect, aBorderArea, bgClipArea, *bg,
layer);
}
}
diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h
index 027cca08ab24..b6af7521fb67 100644
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -152,21 +152,21 @@ struct nsCSSRendering {
static PRBool IsCanvasFrame(nsIFrame* aFrame);
/**
- * Fill in an nsStyleBackground to be used to paint the background
+ * Fill in an aBackgroundSC to be used to paint the background
* for an element. This applies the rules for propagating
* backgrounds between BODY, the root element, and the canvas.
* @return PR_TRUE if there is some meaningful background.
*/
static PRBool FindBackground(nsPresContext* aPresContext,
nsIFrame* aForFrame,
- const nsStyleBackground** aBackground);
+ nsStyleContext** aBackgroundSC);
/**
* As FindBackground, but the passed-in frame is known to be a root frame
* (returned from nsCSSFrameConstructor::GetRootElementStyleFrame())
* and there is always some meaningful background returned.
*/
- static const nsStyleBackground* FindRootFrameBackground(nsIFrame* aForFrame);
+ static nsStyleContext* FindRootFrameBackground(nsIFrame* aForFrame);
/**
* Returns background style information for the canvas.
@@ -179,7 +179,7 @@ struct nsCSSRendering {
* @param aBackground
* contains background style information for the canvas on return
*/
- static const nsStyleBackground*
+ static nsStyleContext*
FindCanvasBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame)
{
NS_ABORT_IF_FALSE(IsCanvasFrame(aForFrame), "not a canvas frame");
@@ -189,7 +189,7 @@ struct nsCSSRendering {
// This should always give transparent, so we'll fill it in with the
// default color if needed. This seems to happen a bit while a page is
// being loaded.
- return aForFrame->GetStyleBackground();
+ return aForFrame->GetStyleContext();
}
/**
@@ -210,7 +210,7 @@ struct nsCSSRendering {
*/
static nscolor
DetermineBackgroundColor(nsPresContext* aPresContext,
- const nsStyleBackground& aBackground,
+ nsStyleContext* aStyleContext,
nsIFrame* aFrame);
/**
@@ -248,7 +248,7 @@ struct nsCSSRendering {
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBackground& aBackground,
+ nsStyleContext *aStyleContext,
const nsStyleBorder& aBorder,
PRUint32 aFlags,
nsRect* aBGClipRect = nsnull);
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 48e588935e08..3c0de4108f22 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1072,10 +1072,10 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
if (mIsThemed)
return PR_FALSE;
- const nsStyleBackground* bg;
-
- if (!nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg))
+ nsStyleContext *bgSC;
+ if (!nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC))
return PR_FALSE;
+ const nsStyleBackground* bg = bgSC->GetStyleBackground();
const nsStyleBackground::Layer& bottomLayer = bg->BottomLayer();
@@ -1098,11 +1098,12 @@ nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder) {
if (mIsThemed)
return PR_FALSE;
- const nsStyleBackground* bg;
+ nsStyleContext *bgSC;
PRBool hasBG =
- nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg);
+ nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC);
if (!hasBG)
return PR_TRUE;
+ const nsStyleBackground* bg = bgSC->GetStyleBackground();
if (bg->BottomLayer().mImage.IsEmpty() &&
bg->mImageCount == 1 &&
!nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()->mBorderRadius) &&
@@ -1118,11 +1119,12 @@ nsDisplayBackground::IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuild
"IsVaryingRelativeToMovingFrame called on non-moving frame!");
nsPresContext* presContext = mFrame->PresContext();
- const nsStyleBackground* bg;
+ nsStyleContext *bgSC;
PRBool hasBG =
- nsCSSRendering::FindBackground(presContext, mFrame, &bg);
+ nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC);
if (!hasBG)
return PR_FALSE;
+ const nsStyleBackground* bg = bgSC->GetStyleBackground();
if (!bg->HasFixedBackground())
return PR_FALSE;
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index d38ca84f8d4a..b2d7cebb7b4b 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3259,11 +3259,12 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
return eTransparencyOpaque;
}
- const nsStyleBackground* bg;
+ nsStyleContext* bgSC;
if (!nsCSSRendering::FindBackground(aBackgroundFrame->PresContext(),
- aBackgroundFrame, &bg)) {
+ aBackgroundFrame, &bgSC)) {
return eTransparencyTransparent;
}
+ const nsStyleBackground* bg = bgSC->GetStyleBackground();
if (NS_GET_A(bg->mBackgroundColor) < 255 ||
// bottom layer's clip is used for the color
bg->BottomLayer().mClip != NS_STYLE_BG_CLIP_BORDER)
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index f979f209b849..73cbe6671df6 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -5584,14 +5584,14 @@ void PresShell::UpdateCanvasBackground()
// cache of that color.
nsIFrame* rootFrame = FrameConstructor()->GetRootElementStyleFrame();
if (rootFrame) {
- const nsStyleBackground* bgStyle =
+ nsStyleContext* bgStyle =
nsCSSRendering::FindRootFrameBackground(rootFrame);
// XXX We should really be passing the canvasframe, not the root element
// style frame but we don't have access to the canvasframe here. It isn't
// a problem because only a few frames can return something other than true
// and none of them would be a canvas frame or root element style frame.
mCanvasBackgroundColor =
- nsCSSRendering::DetermineBackgroundColor(GetPresContext(), *bgStyle,
+ nsCSSRendering::DetermineBackgroundColor(GetPresContext(), bgStyle,
rootFrame);
}
diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp
index d534147f7003..581b91c28ba1 100644
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -586,8 +586,9 @@ nsCanvasFrame::Reflow(nsPresContext* aPresContext,
if (nsSize(aDesiredSize.width, aDesiredSize.height) != GetSize()) {
nsIFrame* rootElementFrame =
aPresContext->PresShell()->FrameConstructor()->GetRootElementStyleFrame();
- const nsStyleBackground* bg =
+ nsStyleContext* bgSC =
nsCSSRendering::FindCanvasBackground(this, rootElementFrame);
+ const nsStyleBackground* bg = bgSC->GetStyleBackground();
if (!bg->IsTransparent()) {
NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
const nsStyleBackground::Layer& layer = bg->mLayers[i];
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 29fc3705be25..5bf7af188585 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3992,8 +3992,8 @@ nsFrame::CheckInvalidateSizeChange(nsHTMLReflowMetrics& aNewDesiredSize)
static void
InvalidateRectForFrameSizeChange(nsIFrame* aFrame, const nsRect& aRect)
{
- const nsStyleBackground* bg;
- if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg)) {
+ nsStyleContext *bgSC;
+ if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bgSC)) {
nsIFrame* rootFrame =
aFrame->PresContext()->PresShell()->FrameManager()->GetRootFrame();
rootFrame->Invalidate(nsRect(nsPoint(0, 0), rootFrame->GetSize()));
diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp
index 8afe032c38af..56fbb2679301 100644
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1933,10 +1933,10 @@ void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx)
{
const nsStyleBorder* border = mStyleContext->GetStyleBorder();
- const nsStyleBackground* backg = mStyleContext->GetStyleBackground();
nsRect rect(mRect + aBuilder->ToReferenceFrame(mFrame));
nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
- mVisibleRect, rect, *backg, *border,
+ mVisibleRect, rect,
+ mStyleContext, *border,
aBuilder->GetBackgroundPaintFlags());
}
diff --git a/layout/tables/nsTableCellFrame.cpp b/layout/tables/nsTableCellFrame.cpp
index ca767acc91c4..8df343e2e954 100644
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -1181,6 +1181,6 @@ nsBCTableCellFrame::PaintBackground(nsIRenderingContext& aRenderingContext,
// of frame cannot be used for the root element
nsCSSRendering::PaintBackgroundWithSC(PresContext(), aRenderingContext, this,
aDirtyRect, rect,
- *GetStyleBackground(), myBorder,
+ GetStyleContext(), myBorder,
aFlags, nsnull);
}
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 033a8ee69201..b7a0e64bf790 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1119,10 +1119,10 @@ nsDisplayTableItem::IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilde
/* static */ void
nsDisplayTableItem::UpdateForFrameBackground(nsIFrame* aFrame)
{
- const nsStyleBackground* bg;
- if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bg))
+ nsStyleContext *bgSC;
+ if (!nsCSSRendering::FindBackground(aFrame->PresContext(), aFrame, &bgSC))
return;
- if (!bg->HasFixedBackground())
+ if (!bgSC->GetStyleBackground()->HasFixedBackground())
return;
mPartHasFixedBackground = PR_TRUE;
diff --git a/layout/tables/nsTablePainter.cpp b/layout/tables/nsTablePainter.cpp
index 378f5da23c70..763a0fad36f7 100644
--- a/layout/tables/nsTablePainter.cpp
+++ b/layout/tables/nsTablePainter.cpp
@@ -135,7 +135,7 @@
TableBackgroundPainter::TableBackgroundData::TableBackgroundData()
: mFrame(nsnull),
- mBackground(nsnull),
+ mVisible(PR_FALSE),
mBorder(nsnull),
mSynthBorder(nsnull)
{
@@ -164,7 +164,7 @@ TableBackgroundPainter::TableBackgroundData::Clear()
mRect.Empty();
mFrame = nsnull;
mBorder = nsnull;
- mBackground = nsnull;
+ mVisible = PR_FALSE;
}
void
@@ -180,7 +180,7 @@ TableBackgroundPainter::TableBackgroundData::SetData()
{
NS_PRECONDITION(mFrame, "null frame");
if (mFrame->IsVisibleForPainting()) {
- mBackground = mFrame->GetStyleBackground();
+ mVisible = PR_TRUE;
mBorder = mFrame->GetStyleBorder();
}
}
@@ -197,12 +197,13 @@ inline PRBool
TableBackgroundPainter::TableBackgroundData::ShouldSetBCBorder()
{
/* we only need accurate border data when positioning background images*/
- if (!mBackground) {
+ if (!mVisible) {
return PR_FALSE;
}
- NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, mBackground) {
- if (!mBackground->mLayers[i].mImage.IsEmpty())
+ const nsStyleBackground *bg = mFrame->GetStyleBackground();
+ NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i, bg) {
+ if (!bg->mLayers[i].mImage.IsEmpty())
return PR_TRUE;
}
return PR_FALSE;
@@ -324,7 +325,7 @@ TableBackgroundPainter::PaintTableFrame(nsTableFrame* aTableFrame,
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
tableData.mFrame, mDirtyRect,
tableData.mRect + mRenderPt,
- *tableData.mBackground,
+ tableData.mFrame->GetStyleContext(),
*tableData.mBorder,
mBGPaintFlags);
}
@@ -633,7 +634,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
mCols[colIndex].mColGroup->mFrame, mDirtyRect,
mCols[colIndex].mColGroup->mRect + mRenderPt,
- *mCols[colIndex].mColGroup->mBackground,
+ mCols[colIndex].mColGroup->mFrame->GetStyleContext(),
*mCols[colIndex].mColGroup->mBorder,
mBGPaintFlags, &mCellRect);
}
@@ -643,7 +644,7 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
mCols[colIndex].mCol.mFrame, mDirtyRect,
mCols[colIndex].mCol.mRect + mRenderPt,
- *mCols[colIndex].mCol.mBackground,
+ mCols[colIndex].mCol.mFrame->GetStyleContext(),
*mCols[colIndex].mCol.mBorder,
mBGPaintFlags, &mCellRect);
}
@@ -653,7 +654,8 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
mRowGroup.mFrame, mDirtyRect,
mRowGroup.mRect + mRenderPt,
- *mRowGroup.mBackground, *mRowGroup.mBorder,
+ mRowGroup.mFrame->GetStyleContext(),
+ *mRowGroup.mBorder,
mBGPaintFlags, &mCellRect);
}
@@ -662,7 +664,8 @@ TableBackgroundPainter::PaintCell(nsTableCellFrame* aCell,
nsCSSRendering::PaintBackgroundWithSC(mPresContext, mRenderingContext,
mRow.mFrame, mDirtyRect,
mRow.mRect + mRenderPt,
- *mRow.mBackground, *mRow.mBorder,
+ mRow.mFrame->GetStyleContext(),
+ *mRow.mBorder,
mBGPaintFlags, &mCellRect);
}
diff --git a/layout/tables/nsTablePainter.h b/layout/tables/nsTablePainter.h
index cf042b3464ae..aea0bdbacad3 100644
--- a/layout/tables/nsTablePainter.h
+++ b/layout/tables/nsTablePainter.h
@@ -183,11 +183,11 @@ class TableBackgroundPainter
nsIFrame* mFrame;
/** mRect is the rect of mFrame in the current coordinate system */
nsRect mRect;
- const nsStyleBackground* mBackground;
+ PRBool mVisible;
const nsStyleBorder* mBorder;
/** Data is valid & frame is visible */
- PRBool IsVisible() const { return mBackground != nsnull; }
+ PRBool IsVisible() const { return mVisible; }
/** Constructor */
TableBackgroundData();
diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
index a67fcc551cbc..34a74b297654 100644
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -3900,13 +3900,12 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
const nsRect& aRect,
const nsRect& aDirtyRect)
{
- const nsStyleBackground* myColor = aStyleContext->GetStyleBackground();
const nsStyleBorder* myBorder = aStyleContext->GetStyleBorder();
const nsStyleOutline* myOutline = aStyleContext->GetStyleOutline();
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
this, aDirtyRect, aRect,
- *myColor, *myBorder,
+ aStyleContext, *myBorder,
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
From 15a5fe036b5008240b4b797b5018b69d2093ea55 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 33/62] Use the appropriate color based on visitedness for the
'background-color' property. (Bug 147777) r=zweinberg
---
layout/base/nsCSSRendering.cpp | 23 ++++++++++++++++-------
layout/generic/nsObjectFrame.cpp | 7 ++++---
layout/generic/nsTextFrameThebes.cpp | 10 +++++-----
3 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp
index 972b0c343177..02cfa2592f00 100644
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -575,7 +575,8 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
// for determining the background color
nsStyleContext* bgContext = nsCSSRendering::FindNonTransparentBackground
(aStyleContext, compatMode == eCompatibility_NavQuirks ? PR_TRUE : PR_FALSE);
- const nsStyleBackground* bgColor = bgContext->GetStyleBackground();
+ nscolor bgColor =
+ bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
border = aStyleBorder.GetComputedBorder();
if ((0 == border.left) && (0 == border.right) &&
@@ -659,7 +660,7 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
borderColors,
compositeColors,
aSkipSides,
- bgColor->mBackgroundColor);
+ bgColor);
br.DrawBorders();
ctx->Restore();
@@ -702,7 +703,8 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
nsStyleContext* bgContext = nsCSSRendering::FindNonTransparentBackground
(aStyleContext, PR_FALSE);
- const nsStyleBackground* bgColor = bgContext->GetStyleBackground();
+ nscolor bgColor =
+ bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
// get the radius for our outline
GetBorderRadiusTwips(aOutlineStyle.mOutlineRadius, aBorderArea.width,
@@ -800,7 +802,7 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
outlineRadii,
outlineColors,
nsnull, 0,
- bgColor->mBackgroundColor);
+ bgColor);
br.DrawBorders();
ctx->Restore();
@@ -926,6 +928,8 @@ nsCSSRendering::FindNonTransparentBackground(nsStyleContext* aContext,
while (context) {
const nsStyleBackground* bg = context->GetStyleBackground();
+ // No need to call GetVisitedDependentColor because it always uses
+ // this alpha component anyway.
if (NS_GET_A(bg->mBackgroundColor) > 0)
break;
@@ -1562,9 +1566,9 @@ DetermineBackgroundColorInternal(nsPresContext* aPresContext,
}
nscolor bgColor;
- const nsStyleBackground *bg = aStyleContext->GetStyleBackground();
if (aDrawBackgroundColor) {
- bgColor = bg->mBackgroundColor;
+ bgColor =
+ aStyleContext->GetVisitedDependentColor(eCSSProperty_background_color);
if (NS_GET_A(bgColor) == 0)
aDrawBackgroundColor = PR_FALSE;
} else {
@@ -1573,7 +1577,8 @@ DetermineBackgroundColorInternal(nsPresContext* aPresContext,
// transparent, but we are expected to use white instead of whatever
// color was specified.
bgColor = NS_RGB(255, 255, 255);
- if (aDrawBackgroundImage || !bg->IsTransparent())
+ if (aDrawBackgroundImage ||
+ !aStyleContext->GetStyleBackground()->IsTransparent())
aDrawBackgroundColor = PR_TRUE;
else
bgColor = NS_RGBA(0,0,0,0);
@@ -3016,6 +3021,8 @@ nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext& aContext,
nscoord endBevel = (aEndBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, PR_TRUE) : 0;
PRUint8 ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
+ // FIXME: In theory, this should use the visited-dependent
+ // background color, but I don't care.
aContext.SetColor (
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
nsRect rect(aBorder);
@@ -3049,6 +3056,8 @@ nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext& aContext,
rect = aBorder;
ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
+ // FIXME: In theory, this should use the visited-dependent
+ // background color, but I don't care.
aContext.SetColor (
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
if (horizontal) {
diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp
index 50b140218973..34a318374d71 100644
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -753,9 +753,10 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
// Sometimes, a frame doesn't have a background color or is transparent. In this
// case, walk up the frame tree until we do find a frame with a background color
for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {
- const nsStyleBackground* background = frame->GetStyleBackground();
- if (!background->IsTransparent()) { // make sure we got an actual color
- mWidget->SetBackgroundColor(background->mBackgroundColor);
+ nscolor bgcolor =
+ frame->GetVisitedDependentColor(eCSSProperty_background_color);
+ if (NS_GET_A(bgcolor) > 0) { // make sure we got an actual color
+ mWidget->SetBackgroundColor(bgcolor);
break;
}
}
diff --git a/layout/generic/nsTextFrameThebes.cpp b/layout/generic/nsTextFrameThebes.cpp
index 6280b7d6cee1..a6d2746dc1c8 100644
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3092,11 +3092,11 @@ nsTextPaintStyle::InitCommonColors()
nsStyleContext* bgContext =
nsCSSRendering::FindNonTransparentBackground(sc);
NS_ASSERTION(bgContext, "Cannot find NonTransparentBackground.");
- const nsStyleBackground* bg = bgContext->GetStyleBackground();
+ nscolor bgColor =
+ bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
nscolor defaultBgColor = mPresContext->DefaultBackgroundColor();
- mFrameBackgroundColor = NS_ComposeColors(defaultBgColor,
- bg->mBackgroundColor);
+ mFrameBackgroundColor = NS_ComposeColors(defaultBgColor, bgColor);
if (bgContext->GetStyleDisplay()->mAppearance) {
// Assume a native widget has sufficient contrast always
@@ -3166,8 +3166,8 @@ nsTextPaintStyle::InitSelectionColors()
mFrame->GetStyleContext());
// Use -moz-selection pseudo class.
if (sc) {
- const nsStyleBackground* bg = sc->GetStyleBackground();
- mSelectionBGColor = bg->mBackgroundColor;
+ mSelectionBGColor =
+ sc->GetVisitedDependentColor(eCSSProperty_background_color);
mSelectionTextColor = sc->GetVisitedDependentColor(eCSSProperty_color);
return PR_TRUE;
}
From f27c596c76992a61d3667b27931142ed0b277bc1 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 34/62] Prerequisite comments for using the appropriate color
for border colors. (Bug 147777) r=zweinberg
---
layout/style/nsCSSProps.cpp | 6 ++++++
layout/style/nsStyleContext.h | 3 +++
2 files changed, 9 insertions(+)
diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp
index 41a7247236cd..2bab8fb60209 100644
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -53,6 +53,7 @@
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsStaticNameTable.h"
+#include "prlog.h" // for PR_STATIC_ASSERT
// required to make the symbol external, so that TestCSSPropertyLookup.cpp can link with it
extern const char* const kCSSRawProperties[];
@@ -1629,8 +1630,13 @@ static const nsCSSProperty gBorderBottomSubpropTable[] = {
eCSSProperty_UNKNOWN
};
+PR_STATIC_ASSERT(NS_SIDE_TOP == 0);
+PR_STATIC_ASSERT(NS_SIDE_RIGHT == 1);
+PR_STATIC_ASSERT(NS_SIDE_BOTTOM == 2);
+PR_STATIC_ASSERT(NS_SIDE_LEFT == 3);
static const nsCSSProperty gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.
+ // Code relies on these matching the NS_SIDE_* constants.
eCSSProperty_border_top_color,
eCSSProperty_border_right_color_value,
eCSSProperty_border_bottom_color,
diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h
index 8bddf174f494..469472ff5ddb 100644
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -255,6 +255,9 @@ public:
* aProperty must be a color-valued property that nsStyleAnimation
* knows how to extract. It must also be a property that we know to
* do change handling for in nsStyleContext::CalcDifference.
+ *
+ * Note that if aProperty is eCSSProperty_border_*_color, this
+ * function handles -moz-use-text-color.
*/
NS_HIDDEN_(nscolor) GetVisitedDependentColor(nsCSSProperty aProperty);
From 712030c86e78a591fbd5a071ea4d23ab42f9bf46 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 35/62] Use the appropriate color based on visitedness for
nsCSSRendering::PaintBorder users of the 'border-*-color' properties. (Bug
147777) r=zweinberg
---
layout/base/nsCSSRendering.cpp | 34 ++++++++++++++++++-
layout/base/nsCSSRendering.h | 15 +++++++-
layout/base/nsDisplayList.cpp | 1 -
layout/forms/nsButtonFrameRenderer.cpp | 10 ++----
layout/forms/nsFieldSetFrame.cpp | 11 +++---
layout/generic/nsColumnSetFrame.cpp | 8 ++---
layout/generic/nsImageFrame.cpp | 5 +--
layout/mathml/nsMathMLChar.cpp | 3 +-
layout/tables/nsTableFrame.cpp | 4 +--
layout/xul/base/src/nsGroupBoxFrame.cpp | 11 +++---
.../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 5 +--
11 files changed, 70 insertions(+), 37 deletions(-)
diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp
index 02cfa2592f00..c9774b9add5f 100644
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -78,6 +78,7 @@
#include "gfxImageSurface.h"
#include "nsStyleStructInlines.h"
#include "nsCSSFrameConstructor.h"
+#include "nsCSSProps.h"
#include "nsCSSRenderingBorders.h"
@@ -542,9 +543,40 @@ nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBorder& aStyleBorder,
nsStyleContext* aStyleContext,
PRIntn aSkipSides)
+{
+ nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
+ const nsStyleBorder *styleBorder = aStyleContext->GetStyleBorder();
+ // Don't check RelevantLinkVisited here, since we want to take the
+ // same amount of time whether or not it's true.
+ if (!styleIfVisited) {
+ PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
+ aDirtyRect, aBorderArea, *styleBorder,
+ aStyleContext, aSkipSides);
+ return;
+ }
+
+ nsStyleBorder newStyleBorder(*styleBorder);
+ NS_FOR_CSS_SIDES(side) {
+ newStyleBorder.SetBorderColor(side,
+ aStyleContext->GetVisitedDependentColor(
+ nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[side]));
+ }
+ PaintBorderWithStyleBorder(aPresContext, aRenderingContext, aForFrame,
+ aDirtyRect, aBorderArea, newStyleBorder,
+ aStyleContext, aSkipSides);
+}
+
+void
+nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
+ nsIRenderingContext& aRenderingContext,
+ nsIFrame* aForFrame,
+ const nsRect& aDirtyRect,
+ const nsRect& aBorderArea,
+ const nsStyleBorder& aStyleBorder,
+ nsStyleContext* aStyleContext,
+ PRIntn aSkipSides)
{
nsMargin border;
nscoord twipsRadii[8];
diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h
index b6af7521fb67..ced76eaeca84 100644
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -95,10 +95,23 @@ struct nsCSSRendering {
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBorder& aBorderStyle,
nsStyleContext* aStyleContext,
PRIntn aSkipSides = 0);
+ /**
+ * Like PaintBorder, but taking an nsStyleBorder argument instead of
+ * getting it from aStyleContext.
+ */
+ static void PaintBorderWithStyleBorder(nsPresContext* aPresContext,
+ nsIRenderingContext& aRenderingContext,
+ nsIFrame* aForFrame,
+ const nsRect& aDirtyRect,
+ const nsRect& aBorderArea,
+ const nsStyleBorder& aBorderStyle,
+ nsStyleContext* aStyleContext,
+ PRIntn aSkipSides = 0);
+
+
/**
* Render the outline for an element using css rendering rules
* for borders. aSkipSides is a bitmask of the sides to skip
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 3c0de4108f22..1bc31166a58d 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1253,7 +1253,6 @@ nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect,
nsRect(offset, mFrame->GetSize()),
- *mFrame->GetStyleBorder(),
mFrame->GetStyleContext(),
mFrame->GetSkipSides());
}
diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp
index ef655c3e0f1d..f9600c80546d 100644
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -234,9 +234,8 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
GetButtonOuterFocusRect(aRect, rect);
- const nsStyleBorder* border = mOuterFocusStyle->GetStyleBorder();
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
- aDirtyRect, rect, *border, mOuterFocusStyle);
+ aDirtyRect, rect, mOuterFocusStyle);
}
if (mInnerFocusStyle) {
@@ -244,9 +243,8 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
GetButtonInnerFocusRect(aRect, rect);
- const nsStyleBorder* border = mInnerFocusStyle->GetStyleBorder();
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
- aDirtyRect, rect, *border, mInnerFocusStyle);
+ aDirtyRect, rect, mInnerFocusStyle);
}
}
@@ -265,14 +263,12 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
nsStyleContext* context = mFrame->GetStyleContext();
- const nsStyleBorder* border = context->GetStyleBorder();
-
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
aDirtyRect, buttonRect, aBGFlags);
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
mFrame, buttonRect, aDirtyRect);
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
- aDirtyRect, buttonRect, *border, context);
+ aDirtyRect, buttonRect, context);
}
diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp
index dbea8cc62ab2..1fff3ec7036c 100644
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -306,8 +306,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyle, mStyleContext,
- skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
@@ -321,8 +320,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyle, mStyleContext,
- skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
@@ -335,8 +333,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyle, mStyleContext,
- skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
} else {
@@ -344,7 +341,7 @@ nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect,
nsRect(aPt, mRect.Size()),
- *borderStyle, mStyleContext, skipSides);
+ mStyleContext, skipSides);
}
}
diff --git a/layout/generic/nsColumnSetFrame.cpp b/layout/generic/nsColumnSetFrame.cpp
index 08d5c0402436..b9ef7f159c0d 100644
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -279,10 +279,10 @@ nsColumnSetFrame::PaintColumnRule(nsIRenderingContext* aCtx,
contentRect.y);
nsRect lineRect(linePt, ruleSize);
- nsCSSRendering::PaintBorder(presContext, *aCtx, this, aDirtyRect,
- lineRect, border, GetStyleContext(),
- // Remember, we only have the "left" "border". Skip everything else
- (1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM));
+ nsCSSRendering::PaintBorderWithStyleBorder(presContext, *aCtx, this,
+ aDirtyRect, lineRect, border, GetStyleContext(),
+ // Remember, we only have the "left" "border". Skip everything else
+ (1 << NS_SIDE_TOP | 1 << NS_SIDE_RIGHT | 1 << NS_SIDE_BOTTOM));
child = nextSibling;
nextSibling = nextSibling->GetNextSibling();
diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp
index 5e9b08290f3f..48e0dd373598 100644
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1009,8 +1009,9 @@ nsImageFrame::DisplayAltFeedback(nsIRenderingContext& aRenderingContext,
// Paint the border
nsRecessedBorder recessedBorder(borderEdgeWidth, PresContext());
- nsCSSRendering::PaintBorder(PresContext(), aRenderingContext, this, inner,
- inner, recessedBorder, mStyleContext);
+ nsCSSRendering::PaintBorderWithStyleBorder(PresContext(), aRenderingContext,
+ this, inner, inner,
+ recessedBorder, mStyleContext);
// Adjust the inner rect to account for the one pixel recessed border,
// and a six pixel padding on each edge
diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp
index 56fbb2679301..794b626f0594 100644
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -2008,8 +2008,7 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
nsStyleContext* styleContext = mFrame->GetStyleContext();
nsRect rect = mRect + aBuilder->ToReferenceFrame(mFrame);
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame,
- mVisibleRect, rect, *border, styleContext,
- skipSides);
+ mVisibleRect, rect, styleContext, skipSides);
nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame,
mVisibleRect, rect, *border,
*mFrame->GetStyleOutline(), styleContext);
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index b7a0e64bf790..381384d598d8 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -1366,13 +1366,11 @@ nsTableFrame::PaintTableBorderBackground(nsIRenderingContext& aRenderingContext,
if (NS_FAILED(rv)) return;
if (GetStyleVisibility()->IsVisible()) {
- const nsStyleBorder* border = GetStyleBorder();
if (!IsBorderCollapse()) {
PRIntn skipSides = GetSkipSides();
nsRect rect(aPt, mRect.Size());
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *border, mStyleContext,
- skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
}
else {
// XXX we should probably get rid of this translation at some stage
diff --git a/layout/xul/base/src/nsGroupBoxFrame.cpp b/layout/xul/base/src/nsGroupBoxFrame.cpp
index 15e984b07d54..9fd4df8feb10 100644
--- a/layout/xul/base/src/nsGroupBoxFrame.cpp
+++ b/layout/xul/base/src/nsGroupBoxFrame.cpp
@@ -195,8 +195,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyleData,
- mStyleContext, skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
@@ -210,8 +209,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyleData,
- mStyleContext, skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
@@ -226,15 +224,14 @@ nsGroupBoxFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
aRenderingContext.PushState();
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
- aDirtyRect, rect, *borderStyleData,
- mStyleContext, skipSides);
+ aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.PopState();
} else {
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, nsRect(aPt, GetSize()),
- *borderStyleData, mStyleContext, skipSides);
+ mStyleContext, skipSides);
}
}
diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
index 34a74b297654..a233027aeb1c 100644
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -3908,8 +3908,9 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
aStyleContext, *myBorder,
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
- nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
- aDirtyRect, aRect, *myBorder, mStyleContext);
+ nsCSSRendering::PaintBorderWithStyleBorder(aPresContext, aRenderingContext,
+ this, aDirtyRect, aRect,
+ *myBorder, mStyleContext);
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
aDirtyRect, aRect, *myBorder, *myOutline,
From 951a1ae9b5d091eef5306aac99e8aa402745c973 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 36/62] Use the appropriate color based on visitedness for
border-collapse borders. (Bug 147777) r=bernd
---
layout/tables/nsTableFrame.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 381384d598d8..0c6659c2df10 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -73,6 +73,7 @@
#include "nsStyleSet.h"
#include "nsDisplayList.h"
#include "nsIScrollableFrame.h"
+#include "nsCSSProps.h"
using namespace mozilla;
@@ -4479,11 +4480,8 @@ GetColorAndStyle(const nsIFrame* aFrame,
(NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
return;
}
- PRBool foreground;
- styleData->GetBorderColor(aSide, aColor, foreground);
- if (foreground) {
- aColor = aFrame->GetStyleColor()->mColor;
- }
+ aColor = aFrame->GetStyleContext()->GetVisitedDependentColor(
+ nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_color)[aSide]);
}
/** coerce the paint style as required by CSS2.1
From e4ae9159cc5a4c2a0578ee8c70e7ded3a9497f20 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 37/62] Use the appropriate color based on visitedness for
'outline-color'. (Bug 147777) r=zweinberg
---
layout/base/nsCSSRendering.cpp | 20 +++++++++----------
layout/base/nsCSSRendering.h | 2 --
layout/base/nsDisplayList.cpp | 2 --
layout/mathml/nsMathMLChar.cpp | 3 +--
layout/style/nsStyleAnimation.cpp | 2 ++
.../xul/base/src/tree/src/nsTreeBodyFrame.cpp | 6 ++----
6 files changed, 14 insertions(+), 21 deletions(-)
diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp
index c9774b9add5f..61afbaea0739 100644
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -716,17 +716,16 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBorder& aStyleBorder,
- const nsStyleOutline& aOutlineStyle,
nsStyleContext* aStyleContext)
{
nscoord twipsRadii[8];
// Get our style context's color struct.
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
+ const nsStyleOutline* ourOutline = aStyleContext->GetStyleOutline();
nscoord width;
- aOutlineStyle.GetOutlineWidth(width);
+ ourOutline->GetOutlineWidth(width);
if (width == 0) {
// Empty outline
@@ -739,7 +738,7 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
bgContext->GetVisitedDependentColor(eCSSProperty_background_color);
// get the radius for our outline
- GetBorderRadiusTwips(aOutlineStyle.mOutlineRadius, aBorderArea.width,
+ GetBorderRadiusTwips(ourOutline->mOutlineRadius, aBorderArea.width,
twipsRadii);
// When the outline property is set on :-moz-anonymous-block or
@@ -774,7 +773,7 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
}
innerRect += aBorderArea.TopLeft();
- nscoord offset = aOutlineStyle.mOutlineOffset;
+ nscoord offset = ourOutline->mOutlineOffset;
innerRect.Inflate(offset, offset);
// If the dirty rect is completely inside the border area (e.g., only the
// content is being painted), then we can skip out now
@@ -799,17 +798,16 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
ComputePixelRadii(twipsRadii, outerRect, 0, twipsPerPixel,
&outlineRadii);
- PRUint8 outlineStyle = aOutlineStyle.GetOutlineStyle();
+ PRUint8 outlineStyle = ourOutline->GetOutlineStyle();
PRUint8 outlineStyles[4] = { outlineStyle,
outlineStyle,
outlineStyle,
outlineStyle };
- nscolor outlineColor;
- // PR_FALSE means use the initial color; PR_TRUE means a color was
- // set.
- if (!aOutlineStyle.GetOutlineColor(outlineColor))
- outlineColor = ourColor->mColor;
+ // This handles treating the initial color as 'currentColor'; if we
+ // ever want 'invert' back we'll need to do a bit of work here too.
+ nscolor outlineColor =
+ aStyleContext->GetVisitedDependentColor(eCSSProperty_outline_color);
nscolor outlineColors[4] = { outlineColor,
outlineColor,
outlineColor,
diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h
index ced76eaeca84..8278437237ad 100644
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -125,8 +125,6 @@ struct nsCSSRendering {
nsIFrame* aForFrame,
const nsRect& aDirtyRect,
const nsRect& aBorderArea,
- const nsStyleBorder& aBorderStyle,
- const nsStyleOutline& aOutlineStyle,
nsStyleContext* aStyleContext);
/**
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 1bc31166a58d..bcc9a910a85a 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1175,8 +1175,6 @@ nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder,
nsCSSRendering::PaintOutline(mFrame->PresContext(), *aCtx, mFrame,
mVisibleRect,
nsRect(offset, mFrame->GetSize()),
- *mFrame->GetStyleBorder(),
- *mFrame->GetStyleOutline(),
mFrame->GetStyleContext());
}
diff --git a/layout/mathml/nsMathMLChar.cpp b/layout/mathml/nsMathMLChar.cpp
index 794b626f0594..2a20794a54f9 100644
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -2010,8 +2010,7 @@ void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame,
mVisibleRect, rect, styleContext, skipSides);
nsCSSRendering::PaintOutline(presContext, *aCtx, mFrame,
- mVisibleRect, rect, *border,
- *mFrame->GetStyleOutline(), styleContext);
+ mVisibleRect, rect, styleContext);
}
#endif
diff --git a/layout/style/nsStyleAnimation.cpp b/layout/style/nsStyleAnimation.cpp
index 7c36c193d7e0..85a7d0c1f577 100644
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -1361,6 +1361,8 @@ nsStyleAnimation::ExtractComputedValue(nsCSSProperty aProperty,
static_cast(styleStruct);
nscolor color;
#ifdef GFX_HAS_INVERT
+ // This isn't right. And note that outline drawing itself
+ // goes through this codepath via GetVisitedDependentColor.
styleOutline->GetOutlineColor(color);
#else
if (!styleOutline->GetOutlineColor(color))
diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
index a233027aeb1c..6e819a5f50d8 100644
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -3901,8 +3901,7 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
const nsRect& aDirtyRect)
{
const nsStyleBorder* myBorder = aStyleContext->GetStyleBorder();
- const nsStyleOutline* myOutline = aStyleContext->GetStyleOutline();
-
+
nsCSSRendering::PaintBackgroundWithSC(aPresContext, aRenderingContext,
this, aDirtyRect, aRect,
aStyleContext, *myBorder,
@@ -3913,8 +3912,7 @@ nsTreeBodyFrame::PaintBackgroundLayer(nsStyleContext* aStyleContext,
*myBorder, mStyleContext);
nsCSSRendering::PaintOutline(aPresContext, aRenderingContext, this,
- aDirtyRect, aRect, *myBorder, *myOutline,
- aStyleContext);
+ aDirtyRect, aRect, aStyleContext);
}
// Scrolling
From b33a804541ea34e7d947e55f3372a18446eefd3c Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 38/62] Use the appropriate color based on visitedness for the
color or fallback color parts of 'fill' and 'stroke'. (Bug 147777) r=jwatt
---
layout/style/nsStyleContext.cpp | 13 ++++--
layout/style/nsStyleContext.h | 10 +++++
layout/svg/base/src/nsSVGGeometryFrame.cpp | 51 +++++++++++++++-------
3 files changed, 55 insertions(+), 19 deletions(-)
diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp
index 5306f963e44e..212d029da759 100644
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -730,13 +730,20 @@ nsStyleContext::GetVisitedDependentColor(nsCSSProperty aProperty)
colors[1] = ExtractColor(aProperty, visitedStyle);
+ return nsStyleContext::CombineVisitedColors(colors,
+ this->RelevantLinkVisited());
+}
+
+/* static */ nscolor
+nsStyleContext::CombineVisitedColors(nscolor *aColors, PRBool aLinkIsVisited)
+{
// NOTE: We want this code to have as little timing dependence as
// possible on whether this->RelevantLinkVisited() is true.
const ColorIndexSet &set =
- gVisitedIndices[this->RelevantLinkVisited() ? 1 : 0];
+ gVisitedIndices[aLinkIsVisited ? 1 : 0];
- nscolor colorColor = colors[set.colorIndex];
- nscolor alphaColor = colors[set.alphaIndex];
+ nscolor colorColor = aColors[set.colorIndex];
+ nscolor alphaColor = aColors[set.alphaIndex];
return NS_RGBA(NS_GET_R(colorColor), NS_GET_G(colorColor),
NS_GET_B(colorColor), NS_GET_A(alphaColor));
}
diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h
index 469472ff5ddb..cb14ead22b81 100644
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -261,6 +261,16 @@ public:
*/
NS_HIDDEN_(nscolor) GetVisitedDependentColor(nsCSSProperty aProperty);
+ /**
+ * aColors should be a two element array of nscolor in which the first
+ * color is the unvisited color and the second is the visited color.
+ *
+ * Combine the R, G, and B components of whichever of aColors should
+ * be used based on aLinkIsVisited with the A component of aColors[0].
+ */
+ static nscolor CombineVisitedColors(nscolor *aColors,
+ PRBool aLinkIsVisited);
+
#ifdef DEBUG
NS_HIDDEN_(void) List(FILE* out, PRInt32 aIndent);
#endif
diff --git a/layout/svg/base/src/nsSVGGeometryFrame.cpp b/layout/svg/base/src/nsSVGGeometryFrame.cpp
index a1968063253e..faed7435099b 100644
--- a/layout/svg/base/src/nsSVGGeometryFrame.cpp
+++ b/layout/svg/base/src/nsSVGGeometryFrame.cpp
@@ -191,6 +191,37 @@ SetupCairoColor(gfxContext *aContext, nscolor aRGB, float aOpacity)
NS_GET_A(aRGB)/255.0 * aOpacity));
}
+static void
+SetupFallbackOrPaintColor(gfxContext *aContext, nsStyleContext *aStyleContext,
+ nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
+ float aOpacity)
+{
+ const nsStyleSVGPaint &paint = aStyleContext->GetStyleSVG()->*aFillOrStroke;
+ nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
+ PRBool isServer = paint.mType == eStyleSVGPaintType_Server;
+ nscolor color = isServer ? paint.mFallbackColor : paint.mPaint.mColor;
+ if (styleIfVisited) {
+ const nsStyleSVGPaint &paintIfVisited =
+ styleIfVisited->GetStyleSVG()->*aFillOrStroke;
+ // To prevent Web content from detecting if a user has visited a URL
+ // (via URL loading triggered by paint servers or performance
+ // differences between paint servers or between a paint server and a
+ // color), we do not allow whether links are visited to change which
+ // paint server is used or switch between paint servers and simple
+ // colors. A :visited style may only override a simple color with
+ // another simple color.
+ if (paintIfVisited.mType == eStyleSVGPaintType_Color &&
+ paint.mType == eStyleSVGPaintType_Color) {
+ nscolor colorIfVisited = paintIfVisited.mPaint.mColor;
+ nscolor colors[2] = { color, colorIfVisited };
+ color = nsStyleContext::CombineVisitedColors(colors,
+ aStyleContext->RelevantLinkVisited());
+ }
+ }
+
+ SetupCairoColor(aContext, color, aOpacity);
+}
+
float
nsSVGGeometryFrame::MaybeOptimizeOpacity(float aFillOrStrokeOpacity)
{
@@ -223,14 +254,8 @@ nsSVGGeometryFrame::SetupCairoFill(gfxContext *aContext)
// On failure, use the fallback colour in case we have an
// objectBoundingBox where the width or height of the object is zero.
// See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox
- if (style->mFill.mType == eStyleSVGPaintType_Server) {
- SetupCairoColor(aContext,
- GetStyleSVG()->mFill.mFallbackColor,
- opacity);
- } else
- SetupCairoColor(aContext,
- GetStyleSVG()->mFill.mPaint.mColor,
- opacity);
+ SetupFallbackOrPaintColor(aContext, GetStyleContext(),
+ &nsStyleSVG::mFill, opacity);
return PR_TRUE;
}
@@ -314,14 +339,8 @@ nsSVGGeometryFrame::SetupCairoStroke(gfxContext *aContext)
// On failure, use the fallback colour in case we have an
// objectBoundingBox where the width or height of the object is zero.
// See http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox
- if (style->mStroke.mType == eStyleSVGPaintType_Server) {
- SetupCairoColor(aContext,
- GetStyleSVG()->mStroke.mFallbackColor,
- opacity);
- } else
- SetupCairoColor(aContext,
- GetStyleSVG()->mStroke.mPaint.mColor,
- opacity);
+ SetupFallbackOrPaintColor(aContext, GetStyleContext(),
+ &nsStyleSVG::mStroke, opacity);
return PR_TRUE;
}
From 9b0db9e924bfb2f74634aa33a618edee7cc2380d Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 39/62] Introduce TreeMatchContext for additional output from
SelectorMatchesTree. (Bug 147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 177 +++++++++++++++++-----------
1 file changed, 106 insertions(+), 71 deletions(-)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index 41361dc1f272..cfda9481e41d 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1215,6 +1215,27 @@ RuleProcessorData::GetNthIndex(PRBool aIsOfType, PRBool aIsFromEnd,
return result;
}
+/**
+ * A |TreeMatchContext| has data about matching a selector (containing
+ * combinators) against a node and the tree that that node is in. It
+ * contains both input to and output from the matching.
+ *
+ * (In contrast, a RuleProcessorData has information needed to match a
+ * selector (without combinators) against a single node; it only
+ * has input to the matching.)
+ */
+struct TreeMatchContext {
+ // Is this matching operation for the creation of a style context?
+ // (If it is, we need to set slow selector bits on nodes indicating
+ // that certain restyling needs to happen.)
+ const PRBool mForStyling;
+
+ TreeMatchContext(PRBool aForStyling)
+ : mForStyling(aForStyling)
+ {
+ }
+};
+
static PRBool ValueIncludes(const nsSubstring& aValueList,
const nsSubstring& aValue,
const nsStringComparator& aComparator)
@@ -1312,7 +1333,7 @@ static PRBool AttrMatchesValue(const nsAttrSelector* aAttrSelector,
}
static PRBool NS_FASTCALL
-firstNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+firstNodeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::firstNode,
@@ -1320,7 +1341,7 @@ firstNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
nsIContent *firstNode = nsnull;
nsIContent *parent = data.mParentContent;
if (parent) {
- if (setNodeFlags)
+ if (aTreeMatchContext.mForStyling)
parent->SetFlags(NODE_HAS_EDGE_CHILD_SELECTOR);
PRInt32 index = -1;
@@ -1334,7 +1355,7 @@ firstNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-lastNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+lastNodeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::lastNode,
@@ -1342,7 +1363,7 @@ lastNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
nsIContent *lastNode = nsnull;
nsIContent *parent = data.mParentContent;
if (parent) {
- if (setNodeFlags)
+ if (aTreeMatchContext.mForStyling)
parent->SetFlags(NODE_HAS_EDGE_CHILD_SELECTOR);
PRUint32 index = parent->GetChildCount();
@@ -1356,7 +1377,7 @@ lastNodeMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static inline PRBool
-edgeChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+edgeChildMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
PRBool checkFirst, PRBool checkLast)
{
nsIContent *parent = data.mParentContent;
@@ -1364,7 +1385,7 @@ edgeChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
return PR_FALSE;
}
- if (setNodeFlags)
+ if (aTreeMatchContext.mForStyling)
parent->SetFlags(NODE_HAS_EDGE_CHILD_SELECTOR);
return (!checkFirst ||
@@ -1374,34 +1395,35 @@ edgeChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-firstChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+firstChildMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::firstChild,
"Unexpected atom");
- return edgeChildMatches(data, setNodeFlags, PR_TRUE, PR_FALSE);
+ return edgeChildMatches(data, aTreeMatchContext, PR_TRUE, PR_FALSE);
}
static PRBool NS_FASTCALL
-lastChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+lastChildMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::lastChild,
"Unexpected atom");
- return edgeChildMatches(data, setNodeFlags, PR_FALSE, PR_TRUE);
+ return edgeChildMatches(data, aTreeMatchContext, PR_FALSE, PR_TRUE);
}
static PRBool NS_FASTCALL
-onlyChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+onlyChildMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::onlyChild,
"Unexpected atom");
- return edgeChildMatches(data, setNodeFlags, PR_TRUE, PR_TRUE);
+ return edgeChildMatches(data, aTreeMatchContext, PR_TRUE, PR_TRUE);
}
static inline PRBool
-nthChildGenericMatches(RuleProcessorData& data, PRBool setNodeFlags,
+nthChildGenericMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass,
PRBool isOfType, PRBool isFromEnd)
{
@@ -1410,7 +1432,7 @@ nthChildGenericMatches(RuleProcessorData& data, PRBool setNodeFlags,
return PR_FALSE;
}
- if (setNodeFlags) {
+ if (aTreeMatchContext.mForStyling) {
if (isFromEnd)
parent->SetFlags(NODE_HAS_SLOW_SELECTOR);
else
@@ -1439,47 +1461,49 @@ nthChildGenericMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-nthChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+nthChildMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::nthChild,
"Unexpected atom");
- return nthChildGenericMatches(data, setNodeFlags, pseudoClass,
+ return nthChildGenericMatches(data, aTreeMatchContext, pseudoClass,
PR_FALSE, PR_FALSE);
}
static PRBool NS_FASTCALL
-nthLastChildMatches(RuleProcessorData& data, PRBool setNodeFlags,
+nthLastChildMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::nthLastChild,
"Unexpected atom");
- return nthChildGenericMatches(data, setNodeFlags, pseudoClass,
+ return nthChildGenericMatches(data, aTreeMatchContext, pseudoClass,
PR_FALSE, PR_TRUE);
}
static PRBool NS_FASTCALL
-nthOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+nthOfTypeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::nthOfType,
"Unexpected atom");
- return nthChildGenericMatches(data, setNodeFlags, pseudoClass,
+ return nthChildGenericMatches(data, aTreeMatchContext, pseudoClass,
PR_TRUE, PR_FALSE);
}
static PRBool NS_FASTCALL
-nthLastOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+nthLastOfTypeMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::nthLastOfType,
"Unexpected atom");
- return nthChildGenericMatches(data, setNodeFlags, pseudoClass,
+ return nthChildGenericMatches(data, aTreeMatchContext, pseudoClass,
PR_TRUE, PR_TRUE);
}
static inline PRBool
-edgeOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+edgeOfTypeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
PRBool checkFirst, PRBool checkLast)
{
nsIContent *parent = data.mParentContent;
@@ -1487,7 +1511,7 @@ edgeOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
return PR_FALSE;
}
- if (setNodeFlags) {
+ if (aTreeMatchContext.mForStyling) {
if (checkLast)
parent->SetFlags(NODE_HAS_SLOW_SELECTOR);
else
@@ -1501,41 +1525,42 @@ edgeOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-firstOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+firstOfTypeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::firstOfType,
"Unexpected atom");
- return edgeOfTypeMatches(data, setNodeFlags, PR_TRUE, PR_FALSE);
+ return edgeOfTypeMatches(data, aTreeMatchContext, PR_TRUE, PR_FALSE);
}
static PRBool NS_FASTCALL
-lastOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+lastOfTypeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::lastOfType,
"Unexpected atom");
- return edgeOfTypeMatches(data, setNodeFlags, PR_FALSE, PR_TRUE);
+ return edgeOfTypeMatches(data, aTreeMatchContext, PR_FALSE, PR_TRUE);
}
static PRBool NS_FASTCALL
-onlyOfTypeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+onlyOfTypeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::onlyOfType,
"Unexpected atom");
- return edgeOfTypeMatches(data, setNodeFlags, PR_TRUE, PR_TRUE);
+ return edgeOfTypeMatches(data, aTreeMatchContext, PR_TRUE, PR_TRUE);
}
static inline PRBool
-checkGenericEmptyMatches(RuleProcessorData& data, PRBool setNodeFlags,
+checkGenericEmptyMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
PRBool isWhitespaceSignificant)
{
nsIContent *child = nsnull;
nsIContent *element = data.mContent;
PRInt32 index = -1;
- if (setNodeFlags)
+ if (aTreeMatchContext.mForStyling)
element->SetFlags(NODE_HAS_EMPTY_SELECTOR);
do {
@@ -1547,26 +1572,27 @@ checkGenericEmptyMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-emptyMatches(RuleProcessorData& data, PRBool setNodeFlags,
+emptyMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::empty,
"Unexpected atom");
- return checkGenericEmptyMatches(data, setNodeFlags, PR_TRUE);
+ return checkGenericEmptyMatches(data, aTreeMatchContext, PR_TRUE);
}
static PRBool NS_FASTCALL
-mozOnlyWhitespaceMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozOnlyWhitespaceMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozOnlyWhitespace,
"Unexpected atom");
- return checkGenericEmptyMatches(data, setNodeFlags, PR_FALSE);
+ return checkGenericEmptyMatches(data, aTreeMatchContext, PR_FALSE);
}
static PRBool NS_FASTCALL
mozEmptyExceptChildrenWithLocalnameMatches(RuleProcessorData& data,
- PRBool setNodeFlags,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom ==
@@ -1577,7 +1603,7 @@ mozEmptyExceptChildrenWithLocalnameMatches(RuleProcessorData& data,
nsIContent *element = data.mContent;
PRInt32 index = -1;
- if (setNodeFlags)
+ if (aTreeMatchContext.mForStyling)
element->SetFlags(NODE_HAS_SLOW_SELECTOR);
do {
@@ -1590,7 +1616,8 @@ mozEmptyExceptChildrenWithLocalnameMatches(RuleProcessorData& data,
}
static PRBool NS_FASTCALL
-mozSystemMetricMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozSystemMetricMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozSystemMetric,
@@ -1601,7 +1628,8 @@ mozSystemMetricMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozHasHandlerRefMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozHasHandlerRefMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozHasHandlerRef,
@@ -1623,7 +1651,7 @@ mozHasHandlerRefMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-rootMatches(RuleProcessorData& data, PRBool setNodeFlags,
+rootMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::root,
@@ -1633,7 +1661,8 @@ rootMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozBoundElementMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozBoundElementMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozBoundElement,
@@ -1645,7 +1674,7 @@ mozBoundElementMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-langMatches(RuleProcessorData& data, PRBool setNodeFlags,
+langMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::lang,
@@ -1698,7 +1727,7 @@ langMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozIsHTMLMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozIsHTMLMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozIsHTML,
@@ -1707,7 +1736,8 @@ mozIsHTMLMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozLocaleDirMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozLocaleDirMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozLocaleDir,
@@ -1723,7 +1753,7 @@ mozLocaleDirMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozLWThemeMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozLWThemeMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom == nsCSSPseudoClasses::mozLWTheme,
@@ -1733,7 +1763,8 @@ mozLWThemeMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozLWThemeBrightTextMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozLWThemeBrightTextMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom ==
@@ -1744,7 +1775,8 @@ mozLWThemeBrightTextMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozLWThemeDarkTextMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozLWThemeDarkTextMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom ==
@@ -1755,7 +1787,8 @@ mozLWThemeDarkTextMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-mozWindowInactiveMatches(RuleProcessorData& data, PRBool setNodeFlags,
+mozWindowInactiveMatches(RuleProcessorData& data,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_PRECONDITION(pseudoClass->mAtom ==
@@ -1765,7 +1798,7 @@ mozWindowInactiveMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
static PRBool NS_FASTCALL
-notPseudoMatches(RuleProcessorData& data, PRBool setNodeFlags,
+notPseudoMatches(RuleProcessorData& data, TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass)
{
NS_NOTREACHED("Why did this get called?");
@@ -1773,7 +1806,8 @@ notPseudoMatches(RuleProcessorData& data, PRBool setNodeFlags,
}
typedef PRBool
- (NS_FASTCALL * PseudoClassMatcher)(RuleProcessorData&, PRBool setNodeFlags,
+ (NS_FASTCALL * PseudoClassMatcher)(RuleProcessorData&,
+ TreeMatchContext& aTreeMatchContext,
nsPseudoClassList* pseudoClass);
// Only one of mFunc or mBits will be set; the other will be null or 0
// respectively. We could use a union, but then we'd still need to
@@ -1807,8 +1841,6 @@ PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassInfo) >
// it really is (e.g., determining that a :hover:active rule no longer matches
// when both states are unset).
-// If |aForStyling| is false, we shouldn't mark slow-selector bits on nodes.
-
// |aDependence| has two functions:
// * when non-null, it indicates that we're processing a negation,
// which is done only when SelectorMatches calls itself recursively
@@ -1817,7 +1849,7 @@ PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassInfo) >
static PRBool SelectorMatches(RuleProcessorData &data,
nsCSSSelector* aSelector,
PRInt32 aStateMask, // states NOT to test
- PRBool aForStyling,
+ TreeMatchContext& aTreeMatchContext,
PRBool* const aDependence = nsnull)
{
@@ -1897,17 +1929,16 @@ static PRBool SelectorMatches(RuleProcessorData &data,
// generally quick to test, and thus earlier). If they were later,
// we'd probably avoid setting those bits in more cases where setting
// them is unnecessary.
- NS_ASSERTION(aStateMask == 0 || !aForStyling,
- "aForStyling must be false if we're just testing for "
+ NS_ASSERTION(aStateMask == 0 || !aTreeMatchContext.mForStyling,
+ "mForStyling must be false if we're just testing for "
"state-dependence");
- const PRBool setNodeFlags = aForStyling;
// test for pseudo class match
for (nsPseudoClassList* pseudoClass = aSelector->mPseudoClassList;
pseudoClass; pseudoClass = pseudoClass->mNext) {
const PseudoClassInfo& info = sPseudoClassInfo[pseudoClass->mType];
if (info.mFunc) {
- if (!(*info.mFunc)(data, setNodeFlags, pseudoClass)) {
+ if (!(*info.mFunc)(data, aTreeMatchContext, pseudoClass)) {
return PR_FALSE;
}
} else {
@@ -2026,7 +2057,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
result && negation; negation = negation->mNegations) {
PRBool dependence = PR_FALSE;
result = !SelectorMatches(data, negation, aStateMask,
- aForStyling, &dependence);
+ aTreeMatchContext, &dependence);
// If the selector does match due to the dependence on aStateMask,
// then we want to keep result true so that the final result of
// SelectorMatches is true. Doing so tells StateEnumFunc that
@@ -2048,7 +2079,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
nsCSSSelector* aSelector,
- PRBool aForStyling)
+ TreeMatchContext& aTreeMatchContext)
{
nsCSSSelector* selector = aSelector;
RuleProcessorData* prevdata = &aPrevData;
@@ -2071,7 +2102,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
nsIContent* content = prevdata->mContent;
nsIContent* parent = prevdata->mParentContent;
if (parent) {
- if (aForStyling)
+ if (aTreeMatchContext.mForStyling)
parent->SetFlags(NODE_HAS_SLOW_SELECTOR_NOAPPEND);
PRInt32 index = parent->IndexOf(content);
@@ -2107,7 +2138,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
if (! data) {
return PR_FALSE;
}
- if (SelectorMatches(*data, selector, 0, aForStyling)) {
+ if (SelectorMatches(*data, selector, 0, aTreeMatchContext)) {
// to avoid greedy matching, we need to recur if this is a
// descendant or general sibling combinator and the next
// combinator is different, but we can make an exception for
@@ -2127,7 +2158,7 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
// it tests from the top of the content tree, down. This
// doesn't matter much for performance since most selectors
// don't match. (If most did, it might be faster...)
- if (SelectorMatchesTree(*data, selector, aForStyling)) {
+ if (SelectorMatchesTree(*data, selector, aTreeMatchContext)) {
return PR_TRUE;
}
}
@@ -2150,9 +2181,10 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
{
RuleProcessorData* data = (RuleProcessorData*)aData;
- if (SelectorMatches(*data, aSelector, 0, PR_TRUE)) {
+ TreeMatchContext treeContext(PR_TRUE);
+ if (SelectorMatches(*data, aSelector, 0, treeContext)) {
nsCSSSelector *next = aSelector->mNext;
- if (!next || SelectorMatchesTree(*data, next, PR_TRUE)) {
+ if (!next || SelectorMatchesTree(*data, next, treeContext)) {
// for performance, require that every implementation of
// nsICSSStyleRule return the same pointer for nsIStyleRule (why
// would anything multiply inherit nsIStyleRule anyway?)
@@ -2300,9 +2332,10 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
// If hint already includes all the bits of possibleChange,
// don't bother calling SelectorMatches, since even if it returns false
// hint won't change.
+ TreeMatchContext treeContext(PR_FALSE);
if ((possibleChange & ~hint) &&
- SelectorMatches(*aData, selector, aData->mStateMask, PR_FALSE) &&
- SelectorMatchesTree(*aData, selector->mNext, PR_FALSE)) {
+ SelectorMatches(*aData, selector, aData->mStateMask, treeContext) &&
+ SelectorMatchesTree(*aData, selector->mNext, treeContext)) {
hint = nsRestyleHint(hint | possibleChange);
}
}
@@ -2338,9 +2371,10 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
// If enumData->change already includes all the bits of possibleChange, don't
// bother calling SelectorMatches, since even if it returns false
// enumData->change won't change.
+ TreeMatchContext treeContext(PR_FALSE);
if ((possibleChange & ~(aData->change)) &&
- SelectorMatches(*data, aSelector, 0, PR_FALSE) &&
- SelectorMatchesTree(*data, aSelector->mNext, PR_FALSE)) {
+ SelectorMatches(*data, aSelector, 0, treeContext) &&
+ SelectorMatchesTree(*data, aSelector->mNext, treeContext)) {
aData->change = nsRestyleHint(aData->change | possibleChange);
}
}
@@ -2881,9 +2915,10 @@ nsCSSRuleProcessor::SelectorListMatches(RuleProcessorData& aData,
nsCSSSelector* sel = aSelectorList->mSelectors;
NS_ASSERTION(sel, "Should have *some* selectors");
NS_ASSERTION(!sel->IsPseudoElement(), "Shouldn't have been called");
- if (SelectorMatches(aData, sel, 0, PR_FALSE)) {
+ TreeMatchContext treeContext(PR_FALSE);
+ if (SelectorMatches(aData, sel, 0, treeContext)) {
nsCSSSelector* next = sel->mNext;
- if (!next || SelectorMatchesTree(aData, next, PR_FALSE)) {
+ if (!next || SelectorMatchesTree(aData, next, treeContext)) {
return PR_TRUE;
}
}
From 179665d6cec8b289a8364f3b20d1cdf46204387b Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 40/62] Introduce NodeMatchContext for additional input into
SelectorMatches. (Bug 147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 65 ++++++++++++++++++++---------
1 file changed, 45 insertions(+), 20 deletions(-)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index cfda9481e41d..d3b12611918f 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1219,10 +1219,6 @@ RuleProcessorData::GetNthIndex(PRBool aIsOfType, PRBool aIsFromEnd,
* A |TreeMatchContext| has data about matching a selector (containing
* combinators) against a node and the tree that that node is in. It
* contains both input to and output from the matching.
- *
- * (In contrast, a RuleProcessorData has information needed to match a
- * selector (without combinators) against a single node; it only
- * has input to the matching.)
*/
struct TreeMatchContext {
// Is this matching operation for the creation of a style context?
@@ -1236,6 +1232,36 @@ struct TreeMatchContext {
}
};
+/**
+ * A |NodeMatchContext| has data about matching a selector (without
+ * combinators) against a single node. It contains only input to the
+ * matching.
+ *
+ * Unlike |RuleProcessorData|, which is similar, a |NodeMatchContext|
+ * can vary depending on the selector matching process. In other words,
+ * there might be multiple NodeMatchContexts corresponding to a single
+ * node, but only one possible RuleProcessorData.
+ */
+struct NodeMatchContext {
+ // In order to implement nsCSSRuleProcessor::HasStateDependentStyle,
+ // we need to be able to see if a node might match an
+ // event-state-dependent selector for any value of that event state.
+ // So mStateMask contains the states that should NOT be tested.
+ //
+ // NOTE: For |aStateMask| to work correctly, it's important that any
+ // change that changes multiple state bits include all those state
+ // bits in the notification. Otherwise, if multiple states change but
+ // we do separate notifications then we might determine the style is
+ // not state-dependent when it really is (e.g., determining that a
+ // :hover:active rule no longer matches when both states are unset).
+ const PRInt32 mStateMask;
+
+ NodeMatchContext(PRInt32 aStateMask)
+ : mStateMask(aStateMask)
+ {
+ }
+};
+
static PRBool ValueIncludes(const nsSubstring& aValueList,
const nsSubstring& aValue,
const nsStringComparator& aComparator)
@@ -1834,13 +1860,6 @@ static const PseudoClassInfo sPseudoClassInfo[] = {
PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassInfo) >
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
-// NOTE: For |aStateMask| to work correctly, it's important that any change
-// that changes multiple state bits include all those state bits in the
-// notification. Otherwise, if multiple states change but we do separate
-// notifications then we might determine the style is not state-dependent when
-// it really is (e.g., determining that a :hover:active rule no longer matches
-// when both states are unset).
-
// |aDependence| has two functions:
// * when non-null, it indicates that we're processing a negation,
// which is done only when SelectorMatches calls itself recursively
@@ -1848,7 +1867,7 @@ PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sPseudoClassInfo) >
// because of aStateMask
static PRBool SelectorMatches(RuleProcessorData &data,
nsCSSSelector* aSelector,
- PRInt32 aStateMask, // states NOT to test
+ NodeMatchContext& aNodeMatchContext,
TreeMatchContext& aTreeMatchContext,
PRBool* const aDependence = nsnull)
@@ -1929,7 +1948,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
// generally quick to test, and thus earlier). If they were later,
// we'd probably avoid setting those bits in more cases where setting
// them is unnecessary.
- NS_ASSERTION(aStateMask == 0 || !aTreeMatchContext.mForStyling,
+ NS_ASSERTION(aNodeMatchContext.mStateMask == 0 ||
+ !aTreeMatchContext.mForStyling,
"mForStyling must be false if we're just testing for "
"state-dependence");
@@ -1961,7 +1981,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
// selectors ":hover" and ":active".
return PR_FALSE;
} else {
- if (aStateMask & statesToCheck) {
+ if (aNodeMatchContext.mStateMask & statesToCheck) {
if (aDependence)
*aDependence = PR_TRUE;
} else {
@@ -2056,7 +2076,7 @@ static PRBool SelectorMatches(RuleProcessorData &data,
for (nsCSSSelector *negation = aSelector->mNegations;
result && negation; negation = negation->mNegations) {
PRBool dependence = PR_FALSE;
- result = !SelectorMatches(data, negation, aStateMask,
+ result = !SelectorMatches(data, negation, aNodeMatchContext,
aTreeMatchContext, &dependence);
// If the selector does match due to the dependence on aStateMask,
// then we want to keep result true so that the final result of
@@ -2138,7 +2158,8 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
if (! data) {
return PR_FALSE;
}
- if (SelectorMatches(*data, selector, 0, aTreeMatchContext)) {
+ NodeMatchContext nodeContext(0);
+ if (SelectorMatches(*data, selector, nodeContext, aTreeMatchContext)) {
// to avoid greedy matching, we need to recur if this is a
// descendant or general sibling combinator and the next
// combinator is different, but we can make an exception for
@@ -2182,7 +2203,8 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
RuleProcessorData* data = (RuleProcessorData*)aData;
TreeMatchContext treeContext(PR_TRUE);
- if (SelectorMatches(*data, aSelector, 0, treeContext)) {
+ NodeMatchContext nodeContext(0);
+ if (SelectorMatches(*data, aSelector, nodeContext, treeContext)) {
nsCSSSelector *next = aSelector->mNext;
if (!next || SelectorMatchesTree(*data, next, treeContext)) {
// for performance, require that every implementation of
@@ -2333,8 +2355,9 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
// don't bother calling SelectorMatches, since even if it returns false
// hint won't change.
TreeMatchContext treeContext(PR_FALSE);
+ NodeMatchContext nodeContext(aData->mStateMask);
if ((possibleChange & ~hint) &&
- SelectorMatches(*aData, selector, aData->mStateMask, treeContext) &&
+ SelectorMatches(*aData, selector, nodeContext, treeContext) &&
SelectorMatchesTree(*aData, selector->mNext, treeContext)) {
hint = nsRestyleHint(hint | possibleChange);
}
@@ -2372,8 +2395,9 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
// bother calling SelectorMatches, since even if it returns false
// enumData->change won't change.
TreeMatchContext treeContext(PR_FALSE);
+ NodeMatchContext nodeContext(0);
if ((possibleChange & ~(aData->change)) &&
- SelectorMatches(*data, aSelector, 0, treeContext) &&
+ SelectorMatches(*data, aSelector, nodeContext, treeContext) &&
SelectorMatchesTree(*data, aSelector->mNext, treeContext)) {
aData->change = nsRestyleHint(aData->change | possibleChange);
}
@@ -2916,7 +2940,8 @@ nsCSSRuleProcessor::SelectorListMatches(RuleProcessorData& aData,
NS_ASSERTION(sel, "Should have *some* selectors");
NS_ASSERTION(!sel->IsPseudoElement(), "Shouldn't have been called");
TreeMatchContext treeContext(PR_FALSE);
- if (SelectorMatches(aData, sel, 0, treeContext)) {
+ NodeMatchContext nodeContext(0);
+ if (SelectorMatches(aData, sel, nodeContext, treeContext)) {
nsCSSSelector* next = sel->mNext;
if (!next || SelectorMatchesTree(aData, next, treeContext)) {
return PR_TRUE;
From 12aeda8a305dbcc0d5e0bb111b4e433a809ad344 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 41/62] Propagate whether we have a relevant link out of
selector matching. (Bug 147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 67 +++++++++++++++++++++++------
1 file changed, 55 insertions(+), 12 deletions(-)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index d3b12611918f..081c0e51802b 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1226,8 +1226,13 @@ struct TreeMatchContext {
// that certain restyling needs to happen.)
const PRBool mForStyling;
+ // Did this matching operation find a relevant link? (If so, we'll
+ // need to construct a StyleIfVisited.)
+ PRBool mHaveRelevantLink;
+
TreeMatchContext(PRBool aForStyling)
: mForStyling(aForStyling)
+ , mHaveRelevantLink(PR_FALSE)
{
}
};
@@ -1256,8 +1261,20 @@ struct NodeMatchContext {
// :hover:active rule no longer matches when both states are unset).
const PRInt32 mStateMask;
- NodeMatchContext(PRInt32 aStateMask)
+ // Is this link the unique link whose visitedness can affect the style
+ // of the node being matched? (That link is the nearest link to the
+ // node being matched that is itself or an ancestor.)
+ //
+ // Always false when TreeMatchContext::mForStyling is false. (We
+ // could figure it out for SelectorListMatches, but we're starting
+ // from the middle of the selector list when doing
+ // Has{Attribute,State}DependentStyle, so we can't tell. So when
+ // mForStyling is false, we have to assume we don't know.)
+ const PRBool mIsRelevantLink;
+
+ NodeMatchContext(PRInt32 aStateMask, PRBool aIsRelevantLink)
: mStateMask(aStateMask)
+ , mIsRelevantLink(aIsRelevantLink)
{
}
};
@@ -1874,6 +1891,12 @@ static PRBool SelectorMatches(RuleProcessorData &data,
{
NS_PRECONDITION(!aSelector->IsPseudoElement(),
"Pseudo-element snuck into SelectorMatches?");
+ NS_ABORT_IF_FALSE(aTreeMatchContext.mForStyling ||
+ !aNodeMatchContext.mIsRelevantLink,
+ "mIsRelevantLink should be set to false when mForStyling "
+ "is false since we don't know how to set it correctly in "
+ "Has(Attribute|State)DependentStyle");
+
// namespace/tag match
// optimization : bail out early if we can
if ((kNameSpaceID_Unknown != aSelector->mNameSpace &&
@@ -2099,7 +2122,8 @@ static PRBool SelectorMatches(RuleProcessorData &data,
static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
nsCSSSelector* aSelector,
- TreeMatchContext& aTreeMatchContext)
+ TreeMatchContext& aTreeMatchContext,
+ PRBool aLookForRelevantLink)
{
nsCSSSelector* selector = aSelector;
RuleProcessorData* prevdata = &aPrevData;
@@ -2117,6 +2141,8 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
RuleProcessorData* data;
if (PRUnichar('+') == selector->mOperator ||
PRUnichar('~') == selector->mOperator) {
+ // The relevant link must be an ancestor of the node being matched.
+ aLookForRelevantLink = PR_FALSE;
data = prevdata->mPreviousSiblingData;
if (!data) {
nsIContent* content = prevdata->mContent;
@@ -2158,7 +2184,18 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
if (! data) {
return PR_FALSE;
}
- NodeMatchContext nodeContext(0);
+ NodeMatchContext nodeContext(0, aLookForRelevantLink && data->IsLink());
+ if (nodeContext.mIsRelevantLink) {
+ // If we find an ancestor of the matched node that is a link
+ // during the matching process, then it's the relevant link (see
+ // constructor call above).
+ // Since we are still matching against selectors that contain
+ // :visited (they'll just fail), we will always find such a node
+ // during the selector matching process if there is a relevant
+ // link that can influence selector matching.
+ aLookForRelevantLink = PR_FALSE;
+ aTreeMatchContext.mHaveRelevantLink = PR_TRUE;
+ }
if (SelectorMatches(*data, selector, nodeContext, aTreeMatchContext)) {
// to avoid greedy matching, we need to recur if this is a
// descendant or general sibling combinator and the next
@@ -2179,7 +2216,8 @@ static PRBool SelectorMatchesTree(RuleProcessorData& aPrevData,
// it tests from the top of the content tree, down. This
// doesn't matter much for performance since most selectors
// don't match. (If most did, it might be faster...)
- if (SelectorMatchesTree(*data, selector, aTreeMatchContext)) {
+ if (SelectorMatchesTree(*data, selector, aTreeMatchContext,
+ aLookForRelevantLink)) {
return PR_TRUE;
}
}
@@ -2203,10 +2241,14 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
RuleProcessorData* data = (RuleProcessorData*)aData;
TreeMatchContext treeContext(PR_TRUE);
- NodeMatchContext nodeContext(0);
+ NodeMatchContext nodeContext(0, data->IsLink());
+ if (nodeContext.mIsRelevantLink) {
+ treeContext.mHaveRelevantLink = PR_TRUE;
+ }
if (SelectorMatches(*data, aSelector, nodeContext, treeContext)) {
nsCSSSelector *next = aSelector->mNext;
- if (!next || SelectorMatchesTree(*data, next, treeContext)) {
+ if (!next || SelectorMatchesTree(*data, next, treeContext,
+ !nodeContext.mIsRelevantLink)) {
// for performance, require that every implementation of
// nsICSSStyleRule return the same pointer for nsIStyleRule (why
// would anything multiply inherit nsIStyleRule anyway?)
@@ -2355,10 +2397,11 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
// don't bother calling SelectorMatches, since even if it returns false
// hint won't change.
TreeMatchContext treeContext(PR_FALSE);
- NodeMatchContext nodeContext(aData->mStateMask);
+ NodeMatchContext nodeContext(aData->mStateMask, PR_FALSE);
if ((possibleChange & ~hint) &&
SelectorMatches(*aData, selector, nodeContext, treeContext) &&
- SelectorMatchesTree(*aData, selector->mNext, treeContext)) {
+ SelectorMatchesTree(*aData, selector->mNext, treeContext, PR_FALSE))
+ {
hint = nsRestyleHint(hint | possibleChange);
}
}
@@ -2395,10 +2438,10 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
// bother calling SelectorMatches, since even if it returns false
// enumData->change won't change.
TreeMatchContext treeContext(PR_FALSE);
- NodeMatchContext nodeContext(0);
+ NodeMatchContext nodeContext(0, PR_FALSE);
if ((possibleChange & ~(aData->change)) &&
SelectorMatches(*data, aSelector, nodeContext, treeContext) &&
- SelectorMatchesTree(*data, aSelector->mNext, treeContext)) {
+ SelectorMatchesTree(*data, aSelector->mNext, treeContext, PR_FALSE)) {
aData->change = nsRestyleHint(aData->change | possibleChange);
}
}
@@ -2940,10 +2983,10 @@ nsCSSRuleProcessor::SelectorListMatches(RuleProcessorData& aData,
NS_ASSERTION(sel, "Should have *some* selectors");
NS_ASSERTION(!sel->IsPseudoElement(), "Shouldn't have been called");
TreeMatchContext treeContext(PR_FALSE);
- NodeMatchContext nodeContext(0);
+ NodeMatchContext nodeContext(0, PR_FALSE);
if (SelectorMatches(aData, sel, nodeContext, treeContext)) {
nsCSSSelector* next = sel->mNext;
- if (!next || SelectorMatchesTree(aData, next, treeContext)) {
+ if (!next || SelectorMatchesTree(aData, next, treeContext, PR_FALSE)) {
return PR_TRUE;
}
}
From eb2548e97d94ed83f4a2d5b459c359dafcf87847 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 42/62] Make nsStyleContext::FindChildWithRules deal with the
visited style context. (Bug 147777) r=bzbarsky
---
layout/style/nsStyleContext.cpp | 23 +++++++++++++++++++----
layout/style/nsStyleContext.h | 11 ++++++++++-
layout/style/nsStyleSet.cpp | 3 ++-
3 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/layout/style/nsStyleContext.cpp b/layout/style/nsStyleContext.cpp
index 212d029da759..9d802c0fd8d4 100644
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -168,8 +168,12 @@ void nsStyleContext::RemoveChild(nsStyleContext* aChild)
already_AddRefed
nsStyleContext::FindChildWithRules(const nsIAtom* aPseudoTag,
- nsRuleNode* aRuleNode)
+ nsRuleNode* aRuleNode,
+ nsRuleNode* aRulesIfVisited,
+ PRBool aRelevantLinkVisited)
{
+ NS_ABORT_IF_FALSE(aRulesIfVisited || !aRelevantLinkVisited,
+ "aRelevantLinkVisited should only be set when we have a separate style");
PRUint32 threshold = 10; // The # of siblings we're willing to examine
// before just giving this whole thing up.
@@ -179,9 +183,20 @@ nsStyleContext::FindChildWithRules(const nsIAtom* aPseudoTag,
if (list) {
nsStyleContext *child = list;
do {
- if (child->mRuleNode == aRuleNode && child->mPseudoTag == aPseudoTag) {
- result = child;
- break;
+ if (child->mRuleNode == aRuleNode &&
+ child->mPseudoTag == aPseudoTag &&
+ child->RelevantLinkVisited() == aRelevantLinkVisited) {
+ PRBool match = PR_FALSE;
+ if (aRulesIfVisited) {
+ match = child->GetStyleIfVisited() &&
+ child->GetStyleIfVisited()->mRuleNode == aRulesIfVisited;
+ } else {
+ match = !child->GetStyleIfVisited();
+ }
+ if (match) {
+ result = child;
+ break;
+ }
}
child = child->mNextSibling;
threshold--;
diff --git a/layout/style/nsStyleContext.h b/layout/style/nsStyleContext.h
index cb14ead22b81..d541cf2338f7 100644
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -115,8 +115,17 @@ public:
NS_STYLE_CONTEXT_TYPE_SHIFT);
}
+ // Find, if it already exists *and is easily findable* (i.e., near the
+ // start of the child list), a style context whose:
+ // * GetPseudo() matches aPseudoTag
+ // * GetRuleNode() matches aRules
+ // * !GetStyleIfVisited() == !aRulesIfVisited, and, if they're
+ // non-null, GetStyleIfVisited()->GetRuleNode() == aRulesIfVisited
+ // * RelevantLinkVisited() == aRelevantLinkVisited
NS_HIDDEN_(already_AddRefed)
- FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules);
+ FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules,
+ nsRuleNode* aRulesIfVisited,
+ PRBool aRelevantLinkVisited);
// Does this style context or any of its ancestors have text
// decorations?
diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp
index 9d70f1be2e4c..456e99d0c28f 100644
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -443,7 +443,8 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
nsStyleContext* result = nsnull;
if (aParentContext)
- result = aParentContext->FindChildWithRules(aPseudoTag, aRuleNode).get();
+ result = aParentContext->FindChildWithRules(aPseudoTag, aRuleNode,
+ nsnull, PR_FALSE).get();
#ifdef NOISY_DEBUG
if (result)
From 3dbb11b9a9e58dcd71e155c654e3fb48d04b30d0 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:26 -0700
Subject: [PATCH 43/62] Fix initialization comment in nsRuleProcessorData.
(Bug 147777) r=sdwilsh
---
layout/style/nsRuleProcessorData.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/layout/style/nsRuleProcessorData.h b/layout/style/nsRuleProcessorData.h
index f2bf8bc78049..0f28e58095b3 100644
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -151,7 +151,7 @@ private:
// subscript is 0 for nth- and 1 for nth-last-.
PRInt32 mNthIndices[2][2];
- // mContentState, mLinkState, mIsLink are initialized lazily.
+ // mContentState is initialized lazily.
PRInt32 mContentState; // eventStateMgr->GetContentState() or
// mContent->IntrinsicState() if we have no ESM
PRPackedBool mGotContentState;
From 124bb33c2ed218ce3bfd3a736c17e252acd84d8d Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 44/62] Pass through desired link-visitedness on the rule
walker and construct if-visited style contexts in the style set when visited
styles are present. (Bug 147777) r=bzbarsky
---
layout/style/nsRuleWalker.h | 46 ++++++++++++-
layout/style/nsStyleSet.cpp | 125 ++++++++++++++++++++++++++++++++----
layout/style/nsStyleSet.h | 1 +
3 files changed, 157 insertions(+), 15 deletions(-)
diff --git a/layout/style/nsRuleWalker.h b/layout/style/nsRuleWalker.h
index e7c314e249c7..0b50475d46f9 100644
--- a/layout/style/nsRuleWalker.h
+++ b/layout/style/nsRuleWalker.h
@@ -41,7 +41,11 @@
* rules are matched
*/
+#ifndef nsRuleWalker_h_
+#define nsRuleWalker_h_
+
#include "nsRuleNode.h"
+#include "nsIStyleRule.h"
class nsRuleWalker {
public:
@@ -75,6 +79,28 @@ public:
PRBool GetImportance() const { return mImportance; }
PRBool GetCheckForImportantRules() const { return mCheckForImportantRules; }
+ // We define the visited-relevant link to be the link that is the
+ // nearest self-or-ancestor to the node being matched.
+ enum VisitedHandlingType {
+ // Do rule matching as though all links are unvisited.
+ eRelevantLinkUnvisited,
+ // Do rule matching as though the relevant link is visited and all
+ // other links are unvisited.
+ eRelevantLinkVisited,
+ // Do rule matching as though a rule should match if it would match
+ // given any set of visitedness states. (used by users other than
+ // nsRuleWalker)
+ eLinksVisitedOrUnvisited
+ };
+
+ void ResetForVisitedMatching() {
+ Reset();
+ mVisitedHandling = eRelevantLinkVisited;
+ }
+ VisitedHandlingType VisitedHandling() const { return mVisitedHandling; }
+ void SetHaveRelevantLink() { mHaveRelevantLink = PR_TRUE; }
+ PRBool HaveRelevantLink() const { return mHaveRelevantLink; }
+
private:
nsRuleNode* mCurrent; // Our current position. Never null.
nsRuleNode* mRoot; // The root of the tree we're walking.
@@ -84,10 +110,28 @@ private:
// we walk and set to false if we find
// one.
+ // When mVisitedHandling is eRelevantLinkUnvisited, this is set to
+ // true on the RuleProcessorData *for the node being matched* if a
+ // relevant link (see explanation in definition of VisitedHandling
+ // enum) was encountered during the matching process, which means that
+ // matching needs to be rerun with eRelevantLinkVisited. Otherwise,
+ // its behavior is undefined (it might get set appropriately, or might
+ // not).
+ PRBool mHaveRelevantLink;
+
+ VisitedHandlingType mVisitedHandling;
+
public:
- nsRuleWalker(nsRuleNode* aRoot) :mCurrent(aRoot), mRoot(aRoot) {
+ nsRuleWalker(nsRuleNode* aRoot)
+ : mCurrent(aRoot)
+ , mRoot(aRoot)
+ , mHaveRelevantLink(PR_FALSE)
+ , mVisitedHandling(eRelevantLinkUnvisited)
+ {
NS_ASSERTION(mCurrent, "Caller screwed up and gave us null node");
MOZ_COUNT_CTOR(nsRuleWalker);
}
~nsRuleWalker() { MOZ_COUNT_DTOR(nsRuleWalker); }
};
+
+#endif /* !defined(nsRuleWalker_h_) */
diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp
index 456e99d0c28f..fcc1a66327a2 100644
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -429,6 +429,12 @@ EnumRulesMatching(nsIStyleRuleProcessor* aProcessor, void* aData)
already_AddRefed
nsStyleSet::GetContext(nsStyleContext* aParentContext,
nsRuleNode* aRuleNode,
+ // aVisitedRuleNode may be null; if it is null
+ // it means that we don't need to force creation
+ // of a StyleIfVisited. (But if we make one
+ // because aParentContext has one, then aRuleNode
+ // should be used.)
+ nsRuleNode* aVisitedRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType)
{
@@ -440,11 +446,33 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
aPseudoType),
"Pseudo mismatch");
- nsStyleContext* result = nsnull;
+ // Ensure |aVisitedRuleNode != nsnull| corresponds to the need to
+ // create an if-visited style context, and that in that case, we have
+ // parentIfVisited set correctly.
+ nsStyleContext *parentIfVisited =
+ aParentContext ? aParentContext->GetStyleIfVisited() : nsnull;
+ if (parentIfVisited) {
+ if (!aVisitedRuleNode) {
+ aVisitedRuleNode = aRuleNode;
+ }
+ } else {
+ if (aVisitedRuleNode) {
+ parentIfVisited = aParentContext;
+ }
+ }
+ if (aIsLink) {
+ // If this node is a link, we want its visited's style context's
+ // parent to be the regular style context of its parent, because
+ // only the visitedness of the relevant link should influence style.
+ parentIfVisited = aParentContext;
+ }
+
+ nsRefPtr result;
if (aParentContext)
result = aParentContext->FindChildWithRules(aPseudoTag, aRuleNode,
- nsnull, PR_FALSE).get();
+ aVisitedRuleNode,
+ PR_FALSE);
#ifdef NOISY_DEBUG
if (result)
@@ -455,8 +483,19 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
if (!result) {
result = NS_NewStyleContext(aParentContext, aPseudoTag, aPseudoType,
- aRuleNode, PresContext()).get();
- if (!aParentContext && result)
+ aRuleNode, PresContext());
+ if (!result)
+ return nsnull;
+ if (aVisitedRuleNode) {
+ nsRefPtr resultIfVisited =
+ NS_NewStyleContext(parentIfVisited, aPseudoTag, aPseudoType,
+ aVisitedRuleNode, PresContext());
+ if (!resultIfVisited) {
+ return nsnull;
+ }
+ result->SetStyleIfVisited(resultIfVisited.forget());
+ }
+ if (!aParentContext)
mRoots.AppendElement(result);
}
else {
@@ -464,7 +503,7 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
NS_ASSERTION(result->GetPseudo() == aPseudoTag, "Unexpected pseudo");
}
- return result;
+ return result.forget();
}
void
@@ -748,7 +787,17 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
FileRules(EnumRulesMatching, &data, aContent,
&ruleWalker);
- return GetContext(aParentContext, ruleWalker.CurrentNode(),
+ nsRuleNode *ruleNode = ruleWalker.CurrentNode();
+ nsRuleNode *visitedRuleNode = nsnull;
+
+ if (ruleWalker.HaveRelevantLink()) {
+ ruleWalker.ResetForVisitedMatching();
+ FileRules(EnumRulesMatching, &data, aContent,
+ &ruleWalker);
+ visitedRuleNode = ruleWalker.CurrentNode();
+ }
+
+ return GetContext(aParentContext, ruleNode, visitedRuleNode,
nsnull, nsCSSPseudoElements::ePseudo_NotPseudoElement);
}
@@ -766,7 +815,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
ruleWalker.Forward(aRules.ObjectAt(i));
}
- return GetContext(aParentContext, ruleWalker.CurrentNode(),
+ return GetContext(aParentContext, ruleWalker.CurrentNode(), nsnull,
nsnull, nsCSSPseudoElements::ePseudo_NotPseudoElement);
}
@@ -784,7 +833,19 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
for (PRInt32 i = 0; i < aRules.Count(); i++) {
ruleWalker.Forward(aRules.ObjectAt(i));
}
- return GetContext(aBaseContext->GetParent(), ruleWalker.CurrentNode(),
+
+ nsRuleNode *ruleNode = ruleWalker.CurrentNode();
+ nsRuleNode *visitedRuleNode = nsnull;
+
+ if (aBaseContext->GetStyleIfVisited()) {
+ ruleWalker.SetCurrentNode(aBaseContext->GetStyleIfVisited()->GetRuleNode());
+ for (PRInt32 i = 0; i < aRules.Count(); i++) {
+ ruleWalker.Forward(aRules.ObjectAt(i));
+ }
+ visitedRuleNode = ruleWalker.CurrentNode();
+ }
+
+ return GetContext(aBaseContext->GetParent(), ruleNode, visitedRuleNode,
aBaseContext->GetPseudo(),
aBaseContext->GetPseudoType());
}
@@ -792,7 +853,7 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
already_AddRefed
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
{
- return GetContext(aParentContext, mRuleTree,
+ return GetContext(aParentContext, mRuleTree, nsnull,
nsCSSAnonBoxes::mozNonElement,
nsCSSPseudoElements::ePseudo_AnonBox);
}
@@ -829,7 +890,17 @@ nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
FileRules(EnumRulesMatching, &data,
aParentContent, &ruleWalker);
- return GetContext(aParentContext, ruleWalker.CurrentNode(),
+ nsRuleNode *ruleNode = ruleWalker.CurrentNode();
+ nsRuleNode *visitedRuleNode = nsnull;
+
+ if (ruleWalker.HaveRelevantLink()) {
+ ruleWalker.ResetForVisitedMatching();
+ FileRules(EnumRulesMatching, &data,
+ aParentContent, &ruleWalker);
+ visitedRuleNode = ruleWalker.CurrentNode();
+ }
+
+ return GetContext(aParentContext, ruleNode, visitedRuleNode,
nsCSSPseudoElements::GetPseudoAtom(aType), aType);
}
@@ -861,8 +932,18 @@ nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
return nsnull;
}
+ nsRuleNode *visitedRuleNode = nsnull;
+
+ if (ruleWalker.HaveRelevantLink()) {
+ ruleWalker.ResetForVisitedMatching();
+ FileRules(EnumRulesMatching, &data,
+ aParentContent, &ruleWalker);
+ visitedRuleNode = ruleWalker.CurrentNode();
+ }
+
nsRefPtr result =
- GetContext(aParentContext, ruleNode, pseudoTag, aType);
+ GetContext(aParentContext, ruleNode, visitedRuleNode,
+ pseudoTag, aType);
// For :before and :after pseudo-elements, having display: none or no
// 'content' property is equivalent to not having the pseudo-element
@@ -902,7 +983,7 @@ nsStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
FileRules(EnumRulesMatching, &data, nsnull,
&ruleWalker);
- return GetContext(aParentContext, ruleWalker.CurrentNode(),
+ return GetContext(aParentContext, ruleWalker.CurrentNode(), nsnull,
aPseudoTag, nsCSSPseudoElements::ePseudo_AnonBox);
}
@@ -927,7 +1008,17 @@ nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
FileRules(EnumRulesMatching, &data, aParentContent,
&ruleWalker);
- return GetContext(aParentContext, ruleWalker.CurrentNode(),
+ nsRuleNode *ruleNode = ruleWalker.CurrentNode();
+ nsRuleNode *visitedRuleNode = nsnull;
+
+ if (ruleWalker.HaveRelevantLink()) {
+ ruleWalker.ResetForVisitedMatching();
+ FileRules(EnumRulesMatching, &data,
+ aParentContent, &ruleWalker);
+ visitedRuleNode = ruleWalker.CurrentNode();
+ }
+
+ return GetContext(aParentContext, ruleNode, visitedRuleNode,
aPseudoTag, nsCSSPseudoElements::ePseudo_XULTree);
}
#endif
@@ -1044,8 +1135,14 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
nsIAtom* pseudoTag = aStyleContext->GetPseudo();
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
nsRuleNode* ruleNode = aStyleContext->GetRuleNode();
+ nsRuleNode* visitedRuleNode = nsnull;
+ nsStyleContext* visitedContext = aStyleContext->GetStyleIfVisited();
+ if (visitedContext) {
+ visitedRuleNode = visitedContext->GetRuleNode();
+ }
- return GetContext(aNewParentContext, ruleNode, pseudoTag, pseudoType);
+ return GetContext(aNewParentContext, ruleNode, visitedRuleNode,
+ pseudoTag, pseudoType);
}
struct StatefulData : public StateRuleProcessorData {
diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h
index 7fd046fa842c..4c585bf388e4 100644
--- a/layout/style/nsStyleSet.h
+++ b/layout/style/nsStyleSet.h
@@ -339,6 +339,7 @@ class nsStyleSet
already_AddRefed
GetContext(nsStyleContext* aParentContext,
nsRuleNode* aRuleNode,
+ nsRuleNode* aVisitedRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType);
From fa5650511bd6c36e22f788db3b1b8d9477f7e78d Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 45/62] Propagate whether we have a relevant link from rule
processors to style set. (Bug 147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 4 ++++
layout/style/nsHTMLStyleSheet.cpp | 2 ++
2 files changed, 6 insertions(+)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index 081c0e51802b..4c7a20074e9e 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -2262,6 +2262,10 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
// nsStyleSet will deal with the !important rule
}
}
+
+ if (treeContext.mHaveRelevantLink) {
+ data->mRuleWalker->SetHaveRelevantLink();
+ }
}
NS_IMETHODIMP
diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp
index 680e9e34e0bd..0aa34febb77e 100644
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -241,9 +241,11 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
PRUint32 state = aData->ContentState();
if (mLinkRule && (state & NS_EVENT_STATE_UNVISITED)) {
ruleWalker->Forward(mLinkRule);
+ ruleWalker->SetHaveRelevantLink();
}
else if (mVisitedRule && (state & NS_EVENT_STATE_VISITED)) {
ruleWalker->Forward(mVisitedRule);
+ ruleWalker->SetHaveRelevantLink();
}
// No need to add to the active rule if it's not a link
From fa654ea00fef65c1aede2210801a0a33571c43e5 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 46/62] Set NS_STYLE_RELEVANT_LINK_IS_VISITED when appropriate.
(Bug 147777) r=bzbarsky
---
layout/style/crashtests/147777-1.html | 6 +++++
layout/style/crashtests/crashtests.list | 1 +
layout/style/nsStyleSet.cpp | 36 ++++++++++++++++++++++++-
layout/style/nsStyleSet.h | 2 ++
4 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 layout/style/crashtests/147777-1.html
diff --git a/layout/style/crashtests/147777-1.html b/layout/style/crashtests/147777-1.html
new file mode 100644
index 000000000000..2500fae9fb0f
--- /dev/null
+++ b/layout/style/crashtests/147777-1.html
@@ -0,0 +1,6 @@
+
+crashtest for NS_ABORT_IF_FALSE during development of 147777
+
+example
diff --git a/layout/style/crashtests/crashtests.list b/layout/style/crashtests/crashtests.list
index 474d070cb1af..a10c7ebae100 100644
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -1,4 +1,5 @@
load 105619-1.html
+load 147777-1.html
load 187671-1.html
load 192408-1.html
load 286707-1.html
diff --git a/layout/style/nsStyleSet.cpp b/layout/style/nsStyleSet.cpp
index fcc1a66327a2..de087ed35655 100644
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -59,6 +59,7 @@
#include "nsContentUtils.h"
#include "nsRuleProcessorData.h"
#include "nsTransitionManager.h"
+#include "nsIEventStateManager.h"
NS_IMPL_ISUPPORTS1(nsEmptyStyleRule, nsIStyleRule)
@@ -435,6 +436,12 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
// because aParentContext has one, then aRuleNode
// should be used.)
nsRuleNode* aVisitedRuleNode,
+ // NB: ReparentStyleContext and
+ // ResolveStyleByAddingRules pass bogus values
+ // that work based on what this function is known
+ // to do with aIsLink and aIsVisitedLink
+ PRBool aIsLink,
+ PRBool aIsVisitedLink,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType)
{
@@ -472,7 +479,7 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
if (aParentContext)
result = aParentContext->FindChildWithRules(aPseudoTag, aRuleNode,
aVisitedRuleNode,
- PR_FALSE);
+ aIsVisitedLink);
#ifdef NOISY_DEBUG
if (result)
@@ -494,6 +501,13 @@ nsStyleSet::GetContext(nsStyleContext* aParentContext,
return nsnull;
}
result->SetStyleIfVisited(resultIfVisited.forget());
+
+ PRBool relevantLinkVisited =
+ aIsLink ? aIsVisitedLink
+ : (aParentContext && aParentContext->RelevantLinkVisited());
+ if (relevantLinkVisited) {
+ result->AddStyleBit(NS_STYLE_RELEVANT_LINK_VISITED);
+ }
}
if (!aParentContext)
mRoots.AppendElement(result);
@@ -798,6 +812,8 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
}
return GetContext(aParentContext, ruleNode, visitedRuleNode,
+ data.IsLink(),
+ (data.ContentState() & NS_EVENT_STATE_VISITED) != 0,
nsnull, nsCSSPseudoElements::ePseudo_NotPseudoElement);
}
@@ -816,6 +832,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
}
return GetContext(aParentContext, ruleWalker.CurrentNode(), nsnull,
+ PR_FALSE, PR_FALSE,
nsnull, nsCSSPseudoElements::ePseudo_NotPseudoElement);
}
@@ -846,6 +863,9 @@ nsStyleSet::ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
}
return GetContext(aBaseContext->GetParent(), ruleNode, visitedRuleNode,
+ // bogus values for aIsLink and aIsVisitedLink that
+ // we know will make GetContext do the right thing.
+ PR_TRUE, aBaseContext->RelevantLinkVisited(),
aBaseContext->GetPseudo(),
aBaseContext->GetPseudoType());
}
@@ -854,6 +874,7 @@ already_AddRefed
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
{
return GetContext(aParentContext, mRuleTree, nsnull,
+ PR_FALSE, PR_FALSE,
nsCSSAnonBoxes::mozNonElement,
nsCSSPseudoElements::ePseudo_AnonBox);
}
@@ -901,6 +922,9 @@ nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
}
return GetContext(aParentContext, ruleNode, visitedRuleNode,
+ // For pseudos, |data.IsLink()| being true means that
+ // our parent node is a link.
+ PR_FALSE, PR_FALSE,
nsCSSPseudoElements::GetPseudoAtom(aType), aType);
}
@@ -943,6 +967,9 @@ nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
nsRefPtr result =
GetContext(aParentContext, ruleNode, visitedRuleNode,
+ // For pseudos, |data.IsLink()| being true means that
+ // our parent node is a link.
+ PR_FALSE, PR_FALSE,
pseudoTag, aType);
// For :before and :after pseudo-elements, having display: none or no
@@ -984,6 +1011,7 @@ nsStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
&ruleWalker);
return GetContext(aParentContext, ruleWalker.CurrentNode(), nsnull,
+ PR_FALSE, PR_FALSE,
aPseudoTag, nsCSSPseudoElements::ePseudo_AnonBox);
}
@@ -1019,6 +1047,9 @@ nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
}
return GetContext(aParentContext, ruleNode, visitedRuleNode,
+ // For pseudos, |data.IsLink()| being true means that
+ // our parent node is a link.
+ PR_FALSE, PR_FALSE,
aPseudoTag, nsCSSPseudoElements::ePseudo_XULTree);
}
#endif
@@ -1142,6 +1173,9 @@ nsStyleSet::ReparentStyleContext(nsStyleContext* aStyleContext,
}
return GetContext(aNewParentContext, ruleNode, visitedRuleNode,
+ // bogus values for aIsLink and aIsVisitedLink that
+ // we know will make GetContext do the right thing.
+ PR_TRUE, aStyleContext->RelevantLinkVisited(),
pseudoTag, pseudoType);
}
diff --git a/layout/style/nsStyleSet.h b/layout/style/nsStyleSet.h
index 4c585bf388e4..ac3f1e50f84f 100644
--- a/layout/style/nsStyleSet.h
+++ b/layout/style/nsStyleSet.h
@@ -340,6 +340,8 @@ class nsStyleSet
GetContext(nsStyleContext* aParentContext,
nsRuleNode* aRuleNode,
nsRuleNode* aVisitedRuleNode,
+ PRBool aIsLink,
+ PRBool aIsVisitedLink,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType);
From 77b2baaacc03d2fca588030676e63608c223928f Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 47/62] Put visited handling in the tree match context. (Bug
147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index 4c7a20074e9e..84d2ddf96a50 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1230,9 +1230,13 @@ struct TreeMatchContext {
// need to construct a StyleIfVisited.)
PRBool mHaveRelevantLink;
- TreeMatchContext(PRBool aForStyling)
+ nsRuleWalker::VisitedHandlingType mVisitedHandling;
+
+ TreeMatchContext(PRBool aForStyling,
+ nsRuleWalker::VisitedHandlingType aVisitedHandling)
: mForStyling(aForStyling)
, mHaveRelevantLink(PR_FALSE)
+ , mVisitedHandling(aVisitedHandling)
{
}
};
@@ -2240,7 +2244,7 @@ static void ContentEnumFunc(nsICSSStyleRule* aRule, nsCSSSelector* aSelector,
{
RuleProcessorData* data = (RuleProcessorData*)aData;
- TreeMatchContext treeContext(PR_TRUE);
+ TreeMatchContext treeContext(PR_TRUE, data->mRuleWalker->VisitedHandling());
NodeMatchContext nodeContext(0, data->IsLink());
if (nodeContext.mIsRelevantLink) {
treeContext.mHaveRelevantLink = PR_TRUE;
@@ -2400,7 +2404,8 @@ nsCSSRuleProcessor::HasStateDependentStyle(StateRuleProcessorData* aData)
// If hint already includes all the bits of possibleChange,
// don't bother calling SelectorMatches, since even if it returns false
// hint won't change.
- TreeMatchContext treeContext(PR_FALSE);
+ TreeMatchContext treeContext(PR_FALSE,
+ nsRuleWalker::eLinksVisitedOrUnvisited);
NodeMatchContext nodeContext(aData->mStateMask, PR_FALSE);
if ((possibleChange & ~hint) &&
SelectorMatches(*aData, selector, nodeContext, treeContext) &&
@@ -2441,7 +2446,8 @@ AttributeEnumFunc(nsCSSSelector* aSelector, AttributeEnumData* aData)
// If enumData->change already includes all the bits of possibleChange, don't
// bother calling SelectorMatches, since even if it returns false
// enumData->change won't change.
- TreeMatchContext treeContext(PR_FALSE);
+ TreeMatchContext treeContext(PR_FALSE,
+ nsRuleWalker::eLinksVisitedOrUnvisited);
NodeMatchContext nodeContext(0, PR_FALSE);
if ((possibleChange & ~(aData->change)) &&
SelectorMatches(*data, aSelector, nodeContext, treeContext) &&
@@ -2986,7 +2992,8 @@ nsCSSRuleProcessor::SelectorListMatches(RuleProcessorData& aData,
nsCSSSelector* sel = aSelectorList->mSelectors;
NS_ASSERTION(sel, "Should have *some* selectors");
NS_ASSERTION(!sel->IsPseudoElement(), "Shouldn't have been called");
- TreeMatchContext treeContext(PR_FALSE);
+ TreeMatchContext treeContext(PR_FALSE,
+ nsRuleWalker::eRelevantLinkUnvisited);
NodeMatchContext nodeContext(0, PR_FALSE);
if (SelectorMatches(aData, sel, nodeContext, treeContext)) {
nsCSSSelector* next = sel->mNext;
From 3a0a9412023f541de35afed5ced3b671fe5b872c Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 48/62] Add method to munge the content state appropriately for
how we're matching so that matching operations in HTML and CSS style sheets
follow the new rules. (Bug 147777) r=bzbarsky
---
layout/style/nsCSSRuleProcessor.cpp | 40 ++++++++++++++++++++++++++---
layout/style/nsHTMLStyleSheet.cpp | 6 ++++-
layout/style/nsRuleProcessorData.h | 8 +++++-
3 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp
index 84d2ddf96a50..cbbe904803a4 100644
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1113,8 +1113,10 @@ RuleProcessorData::ContentState()
mContentState = mContent->IntrinsicState();
}
- // If we are not supposed to mark visited links as such, be sure to flip the
- // bits appropriately.
+ // If we are not supposed to mark visited links as such, be sure to
+ // flip the bits appropriately. We want to do this here, rather
+ // than in GetContentStateForVisitedHandling, so that we don't
+ // expose that :visited support is disabled to the Web page.
if ((!gSupportVisitedPseudo ||
gPrivateBrowsingObserver->InPrivateBrowsing()) &&
(mContentState & NS_EVENT_STATE_VISITED)) {
@@ -1138,6 +1140,35 @@ RuleProcessorData::IsLink()
return (state & (NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) != 0;
}
+PRUint32
+RuleProcessorData::GetContentStateForVisitedHandling(
+ nsRuleWalker::VisitedHandlingType aVisitedHandling,
+ PRBool aIsRelevantLink)
+{
+ PRUint32 contentState = ContentState();
+ if (contentState & (NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)) {
+ NS_ABORT_IF_FALSE(IsLink(), "IsLink() should match state");
+ contentState &=
+ ~PRUint32(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
+ if (aIsRelevantLink) {
+ switch (aVisitedHandling) {
+ case nsRuleWalker::eRelevantLinkUnvisited:
+ contentState |= NS_EVENT_STATE_UNVISITED;
+ break;
+ case nsRuleWalker::eRelevantLinkVisited:
+ contentState |= NS_EVENT_STATE_VISITED;
+ break;
+ case nsRuleWalker::eLinksVisitedOrUnvisited:
+ contentState |= NS_EVENT_STATE_UNVISITED | NS_EVENT_STATE_VISITED;
+ break;
+ }
+ } else {
+ contentState |= NS_EVENT_STATE_UNVISITED;
+ }
+ }
+ return contentState;
+}
+
PRInt32
RuleProcessorData::GetNthIndex(PRBool aIsOfType, PRBool aIsFromEnd,
PRBool aCheckEdgeOnly)
@@ -2012,7 +2043,10 @@ static PRBool SelectorMatches(RuleProcessorData &data,
if (aDependence)
*aDependence = PR_TRUE;
} else {
- if (!(data.ContentState() & statesToCheck)) {
+ PRUint32 contentState = data.GetContentStateForVisitedHandling(
+ aTreeMatchContext.mVisitedHandling,
+ aNodeMatchContext.mIsRelevantLink);
+ if (!(contentState & statesToCheck)) {
return PR_FALSE;
}
}
diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp
index 0aa34febb77e..b093316e3174 100644
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -238,7 +238,11 @@ nsHTMLStyleSheet::RulesMatching(ElementRuleProcessorData* aData)
// if we have anchor colors, check if this is an anchor with an href
if (tag == nsGkAtoms::a) {
if (mLinkRule || mVisitedRule || mActiveRule) {
- PRUint32 state = aData->ContentState();
+ PRUint32 state = aData->GetContentStateForVisitedHandling(
+ ruleWalker->VisitedHandling(),
+ // If the node being matched is a link,
+ // it's the relevant link.
+ aData->IsLink());
if (mLinkRule && (state & NS_EVENT_STATE_UNVISITED)) {
ruleWalker->Forward(mLinkRule);
ruleWalker->SetHaveRelevantLink();
diff --git a/layout/style/nsRuleProcessorData.h b/layout/style/nsRuleProcessorData.h
index 0f28e58095b3..4f8ee0a69604 100644
--- a/layout/style/nsRuleProcessorData.h
+++ b/layout/style/nsRuleProcessorData.h
@@ -49,12 +49,12 @@
#include "nsChangeHint.h"
#include "nsIContent.h"
#include "nsCSSPseudoElements.h"
+#include "nsRuleWalker.h"
class nsIStyleSheet;
class nsPresContext;
class nsIAtom;
class nsICSSPseudoComparator;
-class nsRuleWalker;
class nsAttrValue;
// The implementation of the constructor and destructor are currently in
@@ -111,6 +111,10 @@ public:
PRUint32 DocumentState();
PRBool IsLink();
+ PRUint32 GetContentStateForVisitedHandling(
+ nsRuleWalker::VisitedHandlingType aVisitedHandling,
+ PRBool aIsRelevantLink);
+
// Returns a 1-based index of the child in its parent. If the child
// is not in its parent's child list (i.e., it is anonymous content),
// returns 0.
@@ -154,6 +158,8 @@ private:
// mContentState is initialized lazily.
PRInt32 mContentState; // eventStateMgr->GetContentState() or
// mContent->IntrinsicState() if we have no ESM
+ // adjusted for not supporting :visited (but with
+ // visitedness information when we support it)
PRPackedBool mGotContentState;
};
From 13e72332b40a0c9e3d0957acdcd71f38eb1d6a31 Mon Sep 17 00:00:00 2001
From: "L. David Baron"
Date: Fri, 2 Apr 2010 18:58:27 -0700
Subject: [PATCH 49/62] Add reftests for :visited handling in
layout/reftests/css-visited/ and make them run through the mochitest harness
(via layout/style/test/test_visited_reftests.html) rather than the reftest
harness. (Bug 147777)
---
layout/reftests/css-visited/border-1-ref.html | 11 ++
layout/reftests/css-visited/border-1.html | 11 ++
layout/reftests/css-visited/border-2-ref.html | 11 ++
layout/reftests/css-visited/border-2a.html | 11 ++
layout/reftests/css-visited/border-2b.html | 11 ++
.../css-visited/border-collapse-1-ref.html | 32 ++++
.../css-visited/border-collapse-1.html | 32 ++++
.../css-visited/color-choice-1-ref.html | 10 +
.../reftests/css-visited/color-choice-1.html | 11 ++
.../css-visited/color-on-bullets-1-ref.html | 18 ++
.../css-visited/color-on-bullets-1.html | 18 ++
.../css-visited/color-on-link-1-ref.html | 6 +
.../reftests/css-visited/color-on-link-1.html | 8 +
.../css-visited/color-on-link-before-1.html | 8 +
.../color-on-text-decoration-1-ref.html | 18 ++
.../color-on-text-decoration-1.html | 18 ++
.../css-visited/color-on-visited-1-ref.html | 6 +
.../css-visited/color-on-visited-1.html | 8 +
.../color-on-visited-before-1.html | 8 +
.../css-visited/content-before-1-ref.html | 6 +
.../content-color-on-link-before-1-ref.html | 6 +
.../content-color-on-link-before-1.html | 8 +
...content-color-on-visited-before-1-ref.html | 6 +
.../content-color-on-visited-before-1.html | 8 +
.../css-visited/content-on-link-before-1.html | 8 +
.../content-on-visited-before-1.html | 8 +
.../css-visited/first-line-1-ref.html | 12 ++
layout/reftests/css-visited/first-line-1.html | 22 +++
.../css-visited/inherit-keyword-1-ref.html | 15 ++
.../css-visited/inherit-keyword-1.xhtml | 20 ++
.../reftests/css-visited/outline-1-ref.html | 11 ++
layout/reftests/css-visited/outline-1.html | 11 ++
layout/reftests/css-visited/reftest.list | 4 +
.../selector-adj-sibling-1-ref.html | 7 +
.../css-visited/selector-adj-sibling-1.html | 11 ++
.../selector-adj-sibling-2-ref.html | 6 +
.../css-visited/selector-adj-sibling-2.html | 15 ++
.../selector-any-sibling-1-ref.html | 7 +
.../css-visited/selector-any-sibling-1.html | 11 ++
.../selector-any-sibling-2-ref.html | 6 +
.../css-visited/selector-any-sibling-2.html | 15 ++
.../css-visited/selector-child-1-ref.html | 4 +
.../css-visited/selector-child-1.html | 11 ++
.../css-visited/selector-child-2-ref.xhtml | 12 ++
.../css-visited/selector-child-2.xhtml | 21 ++
.../selector-descendant-1-ref.html | 4 +
.../css-visited/selector-descendant-1.html | 11 ++
.../selector-descendant-2-ref.xhtml | 36 ++++
.../css-visited/selector-descendant-2.xhtml | 36 ++++
.../subject-of-selector-1-ref.html | 4 +
.../subject-of-selector-adj-sibling-1.html | 11 ++
.../subject-of-selector-any-sibling-1.html | 11 ++
.../subject-of-selector-child-1.html | 11 ++
.../subject-of-selector-descendant-1.html | 11 ++
...subject-of-selector-descendant-2-ref.xhtml | 33 ++++
.../subject-of-selector-descendant-2.xhtml | 33 ++++
layout/reftests/css-visited/visited-page.html | 2 +
layout/reftests/css-visited/width-1-ref.html | 12 ++
.../reftests/css-visited/width-on-link-1.html | 17 ++
.../css-visited/width-on-visited-1.html | 17 ++
layout/reftests/reftest.list | 4 +
layout/style/test/Makefile.in | 8 +
layout/style/test/test_visited_reftests.html | 181 ++++++++++++++++++
63 files changed, 969 insertions(+)
create mode 100644 layout/reftests/css-visited/border-1-ref.html
create mode 100644 layout/reftests/css-visited/border-1.html
create mode 100644 layout/reftests/css-visited/border-2-ref.html
create mode 100644 layout/reftests/css-visited/border-2a.html
create mode 100644 layout/reftests/css-visited/border-2b.html
create mode 100644 layout/reftests/css-visited/border-collapse-1-ref.html
create mode 100644 layout/reftests/css-visited/border-collapse-1.html
create mode 100644 layout/reftests/css-visited/color-choice-1-ref.html
create mode 100644 layout/reftests/css-visited/color-choice-1.html
create mode 100644 layout/reftests/css-visited/color-on-bullets-1-ref.html
create mode 100644 layout/reftests/css-visited/color-on-bullets-1.html
create mode 100644 layout/reftests/css-visited/color-on-link-1-ref.html
create mode 100644 layout/reftests/css-visited/color-on-link-1.html
create mode 100644 layout/reftests/css-visited/color-on-link-before-1.html
create mode 100644 layout/reftests/css-visited/color-on-text-decoration-1-ref.html
create mode 100644 layout/reftests/css-visited/color-on-text-decoration-1.html
create mode 100644 layout/reftests/css-visited/color-on-visited-1-ref.html
create mode 100644 layout/reftests/css-visited/color-on-visited-1.html
create mode 100644 layout/reftests/css-visited/color-on-visited-before-1.html
create mode 100644 layout/reftests/css-visited/content-before-1-ref.html
create mode 100644 layout/reftests/css-visited/content-color-on-link-before-1-ref.html
create mode 100644 layout/reftests/css-visited/content-color-on-link-before-1.html
create mode 100644 layout/reftests/css-visited/content-color-on-visited-before-1-ref.html
create mode 100644 layout/reftests/css-visited/content-color-on-visited-before-1.html
create mode 100644 layout/reftests/css-visited/content-on-link-before-1.html
create mode 100644 layout/reftests/css-visited/content-on-visited-before-1.html
create mode 100644 layout/reftests/css-visited/first-line-1-ref.html
create mode 100644 layout/reftests/css-visited/first-line-1.html
create mode 100644 layout/reftests/css-visited/inherit-keyword-1-ref.html
create mode 100644 layout/reftests/css-visited/inherit-keyword-1.xhtml
create mode 100644 layout/reftests/css-visited/outline-1-ref.html
create mode 100644 layout/reftests/css-visited/outline-1.html
create mode 100644 layout/reftests/css-visited/reftest.list
create mode 100644 layout/reftests/css-visited/selector-adj-sibling-1-ref.html
create mode 100644 layout/reftests/css-visited/selector-adj-sibling-1.html
create mode 100644 layout/reftests/css-visited/selector-adj-sibling-2-ref.html
create mode 100644 layout/reftests/css-visited/selector-adj-sibling-2.html
create mode 100644 layout/reftests/css-visited/selector-any-sibling-1-ref.html
create mode 100644 layout/reftests/css-visited/selector-any-sibling-1.html
create mode 100644 layout/reftests/css-visited/selector-any-sibling-2-ref.html
create mode 100644 layout/reftests/css-visited/selector-any-sibling-2.html
create mode 100644 layout/reftests/css-visited/selector-child-1-ref.html
create mode 100644 layout/reftests/css-visited/selector-child-1.html
create mode 100644 layout/reftests/css-visited/selector-child-2-ref.xhtml
create mode 100644 layout/reftests/css-visited/selector-child-2.xhtml
create mode 100644 layout/reftests/css-visited/selector-descendant-1-ref.html
create mode 100644 layout/reftests/css-visited/selector-descendant-1.html
create mode 100644 layout/reftests/css-visited/selector-descendant-2-ref.xhtml
create mode 100644 layout/reftests/css-visited/selector-descendant-2.xhtml
create mode 100644 layout/reftests/css-visited/subject-of-selector-1-ref.html
create mode 100644 layout/reftests/css-visited/subject-of-selector-adj-sibling-1.html
create mode 100644 layout/reftests/css-visited/subject-of-selector-any-sibling-1.html
create mode 100644 layout/reftests/css-visited/subject-of-selector-child-1.html
create mode 100644 layout/reftests/css-visited/subject-of-selector-descendant-1.html
create mode 100644 layout/reftests/css-visited/subject-of-selector-descendant-2-ref.xhtml
create mode 100644 layout/reftests/css-visited/subject-of-selector-descendant-2.xhtml
create mode 100644 layout/reftests/css-visited/visited-page.html
create mode 100644 layout/reftests/css-visited/width-1-ref.html
create mode 100644 layout/reftests/css-visited/width-on-link-1.html
create mode 100644 layout/reftests/css-visited/width-on-visited-1.html
create mode 100644 layout/style/test/test_visited_reftests.html
diff --git a/layout/reftests/css-visited/border-1-ref.html b/layout/reftests/css-visited/border-1-ref.html
new file mode 100644
index 000000000000..cbd7450ebb03
--- /dev/null
+++ b/layout/reftests/css-visited/border-1-ref.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
unvisited
+
visited
diff --git a/layout/reftests/css-visited/border-1.html b/layout/reftests/css-visited/border-1.html
new file mode 100644
index 000000000000..1d97017e4e8a
--- /dev/null
+++ b/layout/reftests/css-visited/border-1.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-2-ref.html b/layout/reftests/css-visited/border-2-ref.html
new file mode 100644
index 000000000000..3730a300c92b
--- /dev/null
+++ b/layout/reftests/css-visited/border-2-ref.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): default color for 'border'
+
+
unvisited
+
visited
diff --git a/layout/reftests/css-visited/border-2a.html b/layout/reftests/css-visited/border-2a.html
new file mode 100644
index 000000000000..de756dba15f6
--- /dev/null
+++ b/layout/reftests/css-visited/border-2a.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): implicit default color for 'border'
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-2b.html b/layout/reftests/css-visited/border-2b.html
new file mode 100644
index 000000000000..9a97afcc5e63
--- /dev/null
+++ b/layout/reftests/css-visited/border-2b.html
@@ -0,0 +1,11 @@
+
+Test for privacy restrictions on :visited (Bug 147777): explicit default color for 'border'
+
+unvisited
+visited
diff --git a/layout/reftests/css-visited/border-collapse-1-ref.html b/layout/reftests/css-visited/border-collapse-1-ref.html
new file mode 100644
index 000000000000..fea8ae14d1ef
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1-ref.html
@@ -0,0 +1,32 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
+
+
unvisited
+
visited
+
+
+
visited
+
unvisited
+
+
+
unvisited
+
visited
+
+
diff --git a/layout/reftests/css-visited/border-collapse-1.html b/layout/reftests/css-visited/border-collapse-1.html
new file mode 100644
index 000000000000..00dc62577c6a
--- /dev/null
+++ b/layout/reftests/css-visited/border-collapse-1.html
@@ -0,0 +1,32 @@
+
+Test for privacy restrictions on :visited (Bug 147777)
+
+
Subsequent functions will not allocate
- * any more memory, and are thus guaranteed not to fail because of lack
- * of memory.
The preallocation can be limited to some of the
- * internal memory by setting some values to 0 here. That means that
- * if, e.g., aMaxRunCount cannot be reasonably
- * predetermined and should not be set to aMaxLength (the
- * only failproof value) to avoid wasting memory, then
- * aMaxRunCount could be set to 0 here and the internal
- * structures that are associated with it will be allocated on demand,
- * just like with the default constructor.
- *
- * If sufficient memory could not be allocated, no exception is thrown.
- * Test whether mDirPropsSize == aMaxLength and/or mRunsSize == aMaxRunCount.
- *
- * @param aMaxLength is the maximum paragraph or line length that internal memory
- * will be preallocated for. An attempt to associate this object with a
- * longer text will fail, unless this value is 0, which leaves the allocation
- * up to the implementation.
- *
- * @param aMaxRunCount is the maximum anticipated number of same-level runs
- * that internal memory will be preallocated for. An attempt to access
- * visual runs on an object that was not preallocated for as many runs
- * as the text was actually resolved to will fail,
- * unless this value is 0, which leaves the allocation up to the implementation.
- * The number of runs depends on the actual text and maybe anywhere between
- * 1 and aMaxLength. It is typically small.
- */
- nsBidi(PRUint32 aMaxLength, PRUint32 aMaxRunCount);
-
/** @brief Destructor. */
virtual ~nsBidi();
diff --git a/layout/base/nsBidiPresUtils.cpp b/layout/base/nsBidiPresUtils.cpp
index ebe04151a3f3..f28e708c2493 100644
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -1397,16 +1397,6 @@ nsBidiPresUtils::CalculateCharType(PRInt32& aOffset,
aOffset = offset;
}
-nsresult nsBidiPresUtils::GetBidiEngine(nsBidi** aBidiEngine)
-{
- nsresult rv = NS_ERROR_FAILURE;
- if (mBidiEngine) {
- *aBidiEngine = mBidiEngine;
- rv = NS_OK;
- }
- return rv;
-}
-
nsresult nsBidiPresUtils::ProcessText(const PRUnichar* aText,
PRInt32 aLength,
nsBidiDirection aBaseDirection,
diff --git a/layout/base/nsBidiPresUtils.h b/layout/base/nsBidiPresUtils.h
index 986b061b9c15..d0435fcfa94a 100644
--- a/layout/base/nsBidiPresUtils.h
+++ b/layout/base/nsBidiPresUtils.h
@@ -198,11 +198,6 @@ public:
nsCharType aCharType,
PRBool aIsOddLevel);
- /**
- * Return our nsBidi object (bidi reordering engine)
- */
- nsresult GetBidiEngine(nsBidi** aBidiEngine);
-
/**
* Reorder plain text using the Unicode Bidi algorithm and send it to
* a rendering context for rendering.
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index bcc9a910a85a..646ec7d134a8 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -878,13 +878,6 @@ nsDisplayItem* nsDisplayList::RemoveBottom() {
return item;
}
-void nsDisplayList::DeleteBottom() {
- nsDisplayItem* item = RemoveBottom();
- if (item) {
- item->~nsDisplayItem();
- }
-}
-
void nsDisplayList::DeleteAll() {
nsDisplayItem* item;
while ((item = RemoveBottom()) != nsnull) {
diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h
index 3aaad2373786..39d3515e7a7f 100644
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -767,10 +767,6 @@ public:
*/
nsDisplayItem* RemoveBottom();
- /**
- * Remove an item from the bottom of the list and call its destructor.
- */
- void DeleteBottom();
/**
* Remove all items from the list and call their destructors.
*/
diff --git a/layout/base/nsFrameManager.cpp b/layout/base/nsFrameManager.cpp
index 912980a06ace..ae46fdb62c5e 100644
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -261,31 +261,6 @@ nsFrameManager::Destroy()
mPresShell = nsnull;
}
-nsIFrame*
-nsFrameManager::GetCanvasFrame()
-{
- if (mRootFrame) {
- // walk the children of the root frame looking for a frame with type==canvas
- // start at the root
- nsIFrame* childFrame = mRootFrame;
- while (childFrame) {
- // get each sibling of the child and check them, startig at the child
- nsIFrame *siblingFrame = childFrame;
- while (siblingFrame) {
- if (siblingFrame->GetType() == nsGkAtoms::canvasFrame) {
- // this is it
- return siblingFrame;
- } else {
- siblingFrame = siblingFrame->GetNextSibling();
- }
- }
- // move on to the child's child
- childFrame = childFrame->GetFirstChild(nsnull);
- }
- }
- return nsnull;
-}
-
//----------------------------------------------------------------------
// Placeholder frame functions
@@ -492,19 +467,6 @@ nsFrameManager::ClearAllUndisplayedContentIn(nsIContent* aParentContent)
}
}
-void
-nsFrameManager::ClearUndisplayedContentMap()
-{
-#ifdef DEBUG_UNDISPLAYED_MAP
- static int i = 0;
- printf("ClearUndisplayedContentMap(%d)\n", i++);
-#endif
-
- if (mUndisplayedMap) {
- mUndisplayedMap->Clear();
- }
-}
-
//----------------------------------------------------------------------
nsresult
diff --git a/layout/base/nsFrameManager.h b/layout/base/nsFrameManager.h
index d26909b6f309..158fea10ee1b 100644
--- a/layout/base/nsFrameManager.h
+++ b/layout/base/nsFrameManager.h
@@ -91,12 +91,6 @@ public:
*/
NS_HIDDEN_(void) Destroy();
- /*
- * Get the canvas frame, searching from the root frame down.
- * The canvas frame may or may not exist, so this may return null.
- */
- NS_HIDDEN_(nsIFrame*) GetCanvasFrame();
-
// Placeholder frame functions
NS_HIDDEN_(nsPlaceholderFrame*) GetPlaceholderFrameFor(nsIFrame* aFrame);
NS_HIDDEN_(nsresult)
@@ -116,7 +110,6 @@ public:
NS_HIDDEN_(void) ClearUndisplayedContentIn(nsIContent* aContent,
nsIContent* aParentContent);
NS_HIDDEN_(void) ClearAllUndisplayedContentIn(nsIContent* aParentContent);
- NS_HIDDEN_(void) ClearUndisplayedContentMap();
// Functions for manipulating the frame model
NS_HIDDEN_(nsresult) AppendFrames(nsIFrame* aParentFrame,
diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h
index 5f8efec8d757..fe509454f3d2 100644
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -741,11 +741,6 @@ public:
*/
static void SetVerifyReflowEnable(PRBool aEnabled);
- /**
- * Get the flags associated with the VerifyReflow debug tool
- */
- static PRInt32 GetVerifyReflowFlags();
-
virtual nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
#ifdef MOZ_REFLOW_PERF
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
index b2d7cebb7b4b..56969d762d2e 100644
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1759,63 +1759,6 @@ nsLayoutUtils::GetParentOrPlaceholderFor(nsFrameManager* aFrameManager,
return aFrame->GetParent();
}
-nsIFrame*
-nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
- nsIFrame* aFrame2,
- nsIFrame* aKnownCommonAncestorHint)
-{
- NS_PRECONDITION(aFrame1, "aFrame1 must not be null");
- NS_PRECONDITION(aFrame2, "aFrame2 must not be null");
-
- nsPresContext* presContext = aFrame1->PresContext();
- if (presContext != aFrame2->PresContext()) {
- // different documents, no common ancestor
- return nsnull;
- }
- nsFrameManager* frameManager = presContext->PresShell()->FrameManager();
-
- nsAutoTArray frame1Ancestors;
- nsIFrame* f1;
- for (f1 = aFrame1; f1 && f1 != aKnownCommonAncestorHint;
- f1 = GetParentOrPlaceholderFor(frameManager, f1)) {
- frame1Ancestors.AppendElement(f1);
- }
- if (!f1 && aKnownCommonAncestorHint) {
- // So, it turns out aKnownCommonAncestorHint was not an ancestor of f1. Oops.
- // Never mind. We can continue as if aKnownCommonAncestorHint was null.
- aKnownCommonAncestorHint = nsnull;
- }
-
- nsAutoTArray frame2Ancestors;
- nsIFrame* f2;
- for (f2 = aFrame2; f2 && f2 != aKnownCommonAncestorHint;
- f2 = GetParentOrPlaceholderFor(frameManager, f2)) {
- frame2Ancestors.AppendElement(f2);
- }
- if (!f2 && aKnownCommonAncestorHint) {
- // So, it turns out aKnownCommonAncestorHint was not an ancestor of f2.
- // We need to retry with no common ancestor hint.
- return GetClosestCommonAncestorViaPlaceholders(aFrame1, aFrame2, nsnull);
- }
-
- // now frame1Ancestors and frame2Ancestors give us the parent frame chain
- // up to aKnownCommonAncestorHint, or if that is null, up to and including
- // the root frame. We need to walk from the end (i.e., the top of the
- // frame (sub)tree) down to aFrame1/aFrame2 looking for the first difference.
- nsIFrame* lastCommonFrame = aKnownCommonAncestorHint;
- PRInt32 last1 = frame1Ancestors.Length() - 1;
- PRInt32 last2 = frame2Ancestors.Length() - 1;
- while (last1 >= 0 && last2 >= 0) {
- nsIFrame* frame1 = frame1Ancestors.ElementAt(last1);
- if (frame1 != frame2Ancestors.ElementAt(last2))
- break;
- lastCommonFrame = frame1;
- last1--;
- last2--;
- }
- return lastCommonFrame;
-}
-
nsIFrame*
nsLayoutUtils::GetNextContinuationOrSpecialSibling(nsIFrame *aFrame)
{
diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h
index 703be41e759c..cd57763fca02 100644
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -729,20 +729,6 @@ public:
static nsIFrame* GetParentOrPlaceholderFor(nsFrameManager* aFrameManager,
nsIFrame* aFrame);
- /**
- * Find the closest common ancestor of aFrame1 and aFrame2, following
- * out of flow frames to their placeholders instead of their parents. Returns
- * nsnull if the frames are in different frame trees.
- *
- * @param aKnownCommonAncestorHint a frame that is believed to be on the
- * ancestor chain of both aFrame1 and aFrame2. If null, or a frame that is
- * not in fact on both ancestor chains, then this function will still return
- * the correct result, but it will be slower.
- */
- static nsIFrame*
- GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1, nsIFrame* aFrame2,
- nsIFrame* aKnownCommonAncestorHint);
-
/**
* Get a frame's next-in-flow, or, if it doesn't have one, its special sibling.
*/
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 73cbe6671df6..2453b73cb1bb 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1092,11 +1092,6 @@ protected:
public:
virtual ~nsDelayedEvent() {};
virtual void Dispatch(PresShell* aShell) {}
- // This is needed only by nsDelayedFocusBlur.
- virtual PRBool Equals(nsPIDOMEventTarget* aTarget, PRUint32 aEventType)
- {
- return PR_FALSE;
- }
};
class nsDelayedInputEvent : public nsDelayedEvent
@@ -1431,16 +1426,6 @@ nsIPresShell::SetVerifyReflowEnable(PRBool aEnabled)
gVerifyReflowEnabled = aEnabled;
}
-PRInt32
-nsIPresShell::GetVerifyReflowFlags()
-{
-#ifdef NS_DEBUG
- return gVerifyReflowFlags;
-#else
- return 0;
-#endif
-}
-
/* virtual */ void
nsIPresShell::AddWeakFrameExternal(nsWeakFrame* aWeakFrame)
{
diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp
index f9600c80546d..6d846940ecd9 100644
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -349,20 +349,6 @@ nsButtonFrameRenderer::GetButtonInnerFocusBorderAndPadding()
return result;
}
-nsMargin
-nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding()
-{
- nsMargin borderAndPadding(0,0,0,0);
- return borderAndPadding;
-}
-
-// gets the full size of our border with all the focus borders
-nsMargin
-nsButtonFrameRenderer::GetFullButtonBorderAndPadding()
-{
- return GetAddedButtonBorderAndPadding() + GetButtonBorderAndPadding();
-}
-
// gets all the focus borders and padding that will be added to the regular border
nsMargin
nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
diff --git a/layout/forms/nsButtonFrameRenderer.h b/layout/forms/nsButtonFrameRenderer.h
index 97b9e0ebf23f..3476e2beb469 100644
--- a/layout/forms/nsButtonFrameRenderer.h
+++ b/layout/forms/nsButtonFrameRenderer.h
@@ -92,8 +92,6 @@ public:
nsMargin GetButtonBorderAndPadding();
nsMargin GetButtonInnerFocusMargin();
nsMargin GetButtonInnerFocusBorderAndPadding();
- nsMargin GetButtonOutlineBorderAndPadding();
- nsMargin GetFullButtonBorderAndPadding();
nsMargin GetAddedButtonBorderAndPadding();
nsStyleContext* GetStyleContext(PRInt32 aIndex) const;
diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp
index aaf11a7c445b..b1824fd743ad 100644
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -899,17 +899,6 @@ nsComboboxControlFrame::RemoveOption(PRInt32 aIndex)
return lcf->RemoveOption(aIndex);
}
-NS_IMETHODIMP
-nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
-{
- NS_ASSERTION(mDropdownFrame, "No dropdown frame!");
-
- nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame);
- NS_ASSERTION(listFrame, "No list frame!");
-
- return listFrame->GetOptionSelected(aIndex, aValue);
-}
-
NS_IMETHODIMP
nsComboboxControlFrame::OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex)
{
diff --git a/layout/forms/nsComboboxControlFrame.h b/layout/forms/nsComboboxControlFrame.h
index d917a02750f2..904984de5e76 100644
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -188,7 +188,6 @@ public:
// nsISelectControlFrame
NS_IMETHOD AddOption(PRInt32 index);
NS_IMETHOD RemoveOption(PRInt32 index);
- NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingChildren(PRBool aIsDone);
NS_IMETHOD OnOptionSelected(PRInt32 aIndex, PRBool aSelected);
NS_IMETHOD OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex);
diff --git a/layout/forms/nsISelectControlFrame.h b/layout/forms/nsISelectControlFrame.h
index 721ec946dc30..2fd7a66f29e4 100644
--- a/layout/forms/nsISelectControlFrame.h
+++ b/layout/forms/nsISelectControlFrame.h
@@ -63,11 +63,6 @@ public:
*/
NS_IMETHOD RemoveOption(PRInt32 index) = 0;
- /**
- * Sets the select state of the option at index
- */
- NS_IMETHOD GetOptionSelected(PRInt32 index, PRBool* value) = 0;
-
/**
* Sets whether the parser is done adding children
* @param aIsDone whether the parser is done adding children
diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp
index a066dbff51b9..2b58e491af89 100644
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -1645,14 +1645,6 @@ nsListControlFrame::FireOnChange()
}
}
-// Determine if the specified item in the listbox is selected.
-NS_IMETHODIMP
-nsListControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
-{
- *aValue = IsContentSelectedByIndex(aIndex);
- return NS_OK;
-}
-
NS_IMETHODIMP
nsListControlFrame::OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex)
{
diff --git a/layout/forms/nsListControlFrame.h b/layout/forms/nsListControlFrame.h
index fd47b01e423f..dc984d4ef006 100644
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -188,7 +188,6 @@ public:
// nsISelectControlFrame
NS_IMETHOD AddOption(PRInt32 index);
NS_IMETHOD RemoveOption(PRInt32 index);
- NS_IMETHOD GetOptionSelected(PRInt32 aIndex, PRBool* aValue);
NS_IMETHOD DoneAddingChildren(PRBool aIsDone);
/**
diff --git a/layout/generic/nsBlockFrame.cpp b/layout/generic/nsBlockFrame.cpp
index a2685d2222a0..c5993e71daac 100644
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2848,27 +2848,6 @@ nsBlockFrame::ShouldApplyTopMargin(nsBlockReflowState& aState,
return PR_FALSE;
}
-nsIFrame*
-nsBlockFrame::GetTopBlockChild(nsPresContext* aPresContext)
-{
- if (mLines.empty())
- return nsnull;
-
- nsLineBox *firstLine = mLines.front();
- if (firstLine->IsBlock())
- return firstLine->mFirstChild;
-
- if (!firstLine->CachedIsEmpty())
- return nsnull;
-
- line_iterator secondLine = begin_lines();
- ++secondLine;
- if (secondLine == end_lines() || !secondLine->IsBlock())
- return nsnull;
-
- return secondLine->mFirstChild;
-}
-
nsresult
nsBlockFrame::ReflowBlockFrame(nsBlockReflowState& aState,
line_iterator aLine,
diff --git a/layout/generic/nsBlockFrame.h b/layout/generic/nsBlockFrame.h
index 7b21334f5d02..bbadac378f68 100644
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -271,12 +271,6 @@ public:
*/
PRBool CheckForCollapsedBottomMarginFromClearanceLine();
- /** return the topmost block child based on y-index.
- * almost always the first or second line, if there is one.
- * accounts for lines that hold only compressed white space, etc.
- */
- nsIFrame* GetTopBlockChild(nsPresContext *aPresContext);
-
static nsresult GetCurrentLine(nsBlockReflowState *aState, nsLineBox **aOutCurrentLine);
static PRBool BlockIsMarginRoot(nsIFrame* aBlock);
diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp
index 5bf7af188585..ea701ff113a1 100644
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -708,16 +708,6 @@ nsIFrame::ApplySkipSides(nsMargin& aMargin) const
aMargin.left = 0;
}
-nsRect
-nsIFrame::GetMarginRect() const
-{
- nsMargin m(GetUsedMargin());
- ApplySkipSides(m);
- nsRect r(mRect);
- r.Inflate(m);
- return r;
-}
-
nsRect
nsIFrame::GetPaddingRect() const
{
@@ -1203,16 +1193,6 @@ nsIFrame::OverflowClip(nsDisplayListBuilder* aBuilder,
return wrapper.WrapLists(aBuilder, this, aFromSet, aToSet);
}
-nsresult
-nsIFrame::Clip(nsDisplayListBuilder* aBuilder,
- const nsDisplayListSet& aFromSet,
- const nsDisplayListSet& aToSet,
- const nsRect& aClipRect)
-{
- nsAbsPosClipWrapper wrapper(this, aClipRect);
- return wrapper.WrapLists(aBuilder, this, aFromSet, aToSet);
-}
-
static nsresult
BuildDisplayListWithOverflowClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aDirtyRect, const nsDisplayListSet& aSet,
diff --git a/layout/generic/nsFrameList.cpp b/layout/generic/nsFrameList.cpp
index 5689d9e8cf8c..be4797097498 100644
--- a/layout/generic/nsFrameList.cpp
+++ b/layout/generic/nsFrameList.cpp
@@ -360,24 +360,6 @@ nsFrameList::ContainsFrame(const nsIFrame* aFrame) const
return PR_FALSE;
}
-PRBool
-nsFrameList::ContainsFrameBefore(const nsIFrame* aFrame, const nsIFrame* aEnd) const
-{
- NS_PRECONDITION(aFrame, "null ptr");
-
- nsIFrame* frame = mFirstChild;
- while (frame) {
- if (frame == aEnd) {
- return PR_FALSE;
- }
- if (frame == aFrame) {
- return PR_TRUE;
- }
- frame = frame->GetNextSibling();
- }
- return PR_FALSE;
-}
-
PRInt32
nsFrameList::GetLength() const
{
@@ -429,28 +411,6 @@ class CompareByContentOrderComparator
}
};
-void
-nsFrameList::SortByContentOrder()
-{
- if (IsEmpty())
- return;
-
- nsAutoTArray array;
- nsIFrame* f;
- for (f = mFirstChild; f; f = f->GetNextSibling()) {
- array.AppendElement(f);
- }
- array.Sort(CompareByContentOrderComparator());
- f = mFirstChild = array.ElementAt(0);
- for (PRUint32 i = 1; i < array.Length(); ++i) {
- nsIFrame* ff = array.ElementAt(i);
- f->SetNextSibling(ff);
- f = ff;
- }
- f->SetNextSibling(nsnull);
- mLastChild = f;
-}
-
void
nsFrameList::ApplySetParent(nsIFrame* aParent) const
{
diff --git a/layout/generic/nsFrameList.h b/layout/generic/nsFrameList.h
index 489873888f87..e8288d2e8bba 100644
--- a/layout/generic/nsFrameList.h
+++ b/layout/generic/nsFrameList.h
@@ -215,14 +215,6 @@ public:
*/
nsFrameList ExtractTail(FrameLinkEnumerator& aLink);
- /**
- * Sort the frames according to content order so that the first
- * frame in the list is the first in content order. Frames for
- * the same content will be ordered so that a prev in flow
- * comes before its next in flow.
- */
- void SortByContentOrder();
-
nsIFrame* FirstChild() const {
return mFirstChild;
}
@@ -243,7 +235,6 @@ public:
}
PRBool ContainsFrame(const nsIFrame* aFrame) const;
- PRBool ContainsFrameBefore(const nsIFrame* aFrame, const nsIFrame* aEnd) const;
PRInt32 GetLength() const;
diff --git a/layout/generic/nsFrameSetFrame.cpp b/layout/generic/nsFrameSetFrame.cpp
index 0abf8a43f6e6..c866ce41d79b 100644
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -93,16 +93,6 @@ nsFramesetDrag::nsFramesetDrag()
UnSet();
}
-nsFramesetDrag::nsFramesetDrag(PRBool aVertical,
- PRInt32 aIndex,
- PRInt32 aChange,
- nsHTMLFramesetFrame* aSource)
-{
- mVertical = aVertical;
- mIndex = aIndex;
- mChange = aChange;
- mSource = aSource;
-}
void nsFramesetDrag::Reset(PRBool aVertical,
PRInt32 aIndex,
PRInt32 aChange,
diff --git a/layout/generic/nsFrameSetFrame.h b/layout/generic/nsFrameSetFrame.h
index 7150f144a221..9903bb80c0d2 100644
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -87,10 +87,6 @@ struct nsFramesetDrag {
PRPackedBool mActive;
nsFramesetDrag();
- nsFramesetDrag(PRBool aVertical,
- PRInt32 aIndex,
- PRInt32 aChange,
- nsHTMLFramesetFrame* aSource);
void Reset(PRBool aVertical,
PRInt32 aIndex,
PRInt32 aChange,
diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h
index b18b1d1bfa88..159ed71a0e3b 100644
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -888,13 +888,7 @@ public:
/**
* Like the frame's rect (see |GetRect|), which is the border rect,
* other rectangles of the frame, in app units, relative to the parent.
- *
- * Note that GetMarginRect is not meaningful for blocks (anything with
- * 'display:block', whether block frame or not) because of both the
- * collapsing and 'auto' issues with GetUsedMargin (on which it
- * depends).
*/
- nsRect GetMarginRect() const;
nsRect GetPaddingRect() const;
nsRect GetContentRect() const;
@@ -1033,15 +1027,6 @@ public:
PRBool aClipBorderBackground = PR_FALSE,
PRBool aClipAll = PR_FALSE);
- /**
- * Clips the display items of aFromSet, putting the results in aToSet.
- * All items are clipped.
- */
- nsresult Clip(nsDisplayListBuilder* aBuilder,
- const nsDisplayListSet& aFromSet,
- const nsDisplayListSet& aToSet,
- const nsRect& aClipRect);
-
enum {
DISPLAY_CHILD_FORCE_PSEUDO_STACKING_CONTEXT = 0x01,
DISPLAY_CHILD_FORCE_STACKING_CONTEXT = 0x02,
diff --git a/layout/generic/nsILineIterator.h b/layout/generic/nsILineIterator.h
index 9c154ed41291..2ff673036b40 100644
--- a/layout/generic/nsILineIterator.h
+++ b/layout/generic/nsILineIterator.h
@@ -108,15 +108,6 @@ public:
*/
virtual PRInt32 FindLineContaining(nsIFrame* aFrame) = 0;
- /**
- * Given a Y coordinate relative to the block that provided this
- * line iterator, return the line that contains the Y
- * coordinate. Returns -1 in aLineNumberResult if the Y coordinate
- * is above the first line. Returns N (where N is the number of
- * lines) if the Y coordinate is below the last line.
- */
- virtual PRInt32 FindLineAt(nscoord aY) = 0;
-
// Given a line number and an X coordinate, find the frame on the
// line that is nearest to the X coordinate. The
// aXIsBeforeFirstFrame and aXIsAfterLastFrame flags are updated
diff --git a/layout/generic/nsImageMap.cpp b/layout/generic/nsImageMap.cpp
index 043f1147c022..7092fa08c4c3 100644
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -83,8 +83,6 @@ public:
void HasFocus(PRBool aHasFocus);
- void GetHREF(nsAString& aHref) const;
-
nsCOMPtr mArea;
nscoord* mCoords;
PRInt32 mNumCoords;
@@ -107,15 +105,6 @@ Area::~Area()
delete [] mCoords;
}
-void
-Area::GetHREF(nsAString& aHref) const
-{
- aHref.Truncate();
- if (mArea) {
- mArea->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aHref);
- }
-}
-
#include
inline PRBool
diff --git a/layout/generic/nsIntervalSet.cpp b/layout/generic/nsIntervalSet.cpp
index 7ced335ce63a..5836dc92aa22 100644
--- a/layout/generic/nsIntervalSet.cpp
+++ b/layout/generic/nsIntervalSet.cpp
@@ -97,17 +97,6 @@ void nsIntervalSet::IncludeInterval(coord_type aBegin, coord_type aEnd)
}
}
-PRBool nsIntervalSet::HasPoint(coord_type aPoint) const
-{
- Interval *current = mList;
- while (current && current->mBegin <= aPoint) {
- if (current->mEnd >= aPoint)
- return PR_TRUE;
- current = current->mNext;
- }
- return PR_FALSE;
-}
-
PRBool nsIntervalSet::Intersects(coord_type aBegin, coord_type aEnd) const
{
Interval *current = mList;
diff --git a/layout/generic/nsIntervalSet.h b/layout/generic/nsIntervalSet.h
index eaccbb4da4c4..e5e5b1f68a29 100644
--- a/layout/generic/nsIntervalSet.h
+++ b/layout/generic/nsIntervalSet.h
@@ -75,11 +75,6 @@ public:
*/
void IncludeInterval(coord_type aBegin, coord_type aEnd);
- /*
- * Is the point aPoint contained within the set of intervals?
- */
- PRBool HasPoint(coord_type aPoint) const;
-
/*
* Are _some_ points in [aBegin, aEnd] contained within the set
* of intervals?
diff --git a/layout/generic/nsLineBox.cpp b/layout/generic/nsLineBox.cpp
index b4e81450137a..81e6acf6bef3 100644
--- a/layout/generic/nsLineBox.cpp
+++ b/layout/generic/nsLineBox.cpp
@@ -356,26 +356,6 @@ nsLineBox::DeleteLineList(nsPresContext* aPresContext, nsLineList& aLines,
}
}
-nsLineBox*
-nsLineBox::FindLineContaining(nsLineList& aLines, nsIFrame* aFrame,
- PRInt32* aFrameIndexInLine)
-{
- NS_PRECONDITION(aFrameIndexInLine && !aLines.empty() && aFrame, "null ptr");
- for (nsLineList::iterator line = aLines.begin(),
- line_end = aLines.end();
- line != line_end;
- ++line)
- {
- PRInt32 ix = line->IndexOf(aFrame);
- if (ix >= 0) {
- *aFrameIndexInLine = ix;
- return line;
- }
- }
- *aFrameIndexInLine = -1;
- return nsnull;
-}
-
PRBool
nsLineBox::RFindLineContaining(nsIFrame* aFrame,
const nsLineList::iterator& aBegin,
@@ -656,23 +636,6 @@ nsLineIterator::FindLineContaining(nsIFrame* aFrame)
return -1;
}
-/* virtual */ PRInt32
-nsLineIterator::FindLineAt(nscoord aY)
-{
- nsLineBox* line = mLines[0];
- if (!line || (aY < line->mBounds.y)) {
- return -1;
- }
- PRInt32 lineNumber = 0;
- while (lineNumber != mNumLines) {
- if ((aY >= line->mBounds.y) && (aY < line->mBounds.YMost())) {
- return lineNumber;
- }
- line = mLines[++lineNumber];
- }
- return mNumLines;
-}
-
#ifdef IBMBIDI
NS_IMETHODIMP
nsLineIterator::CheckLineOrder(PRInt32 aLine,
diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h
index c31c9ed7b055..98e0030ec667 100644
--- a/layout/generic/nsLineBox.h
+++ b/layout/generic/nsLineBox.h
@@ -434,11 +434,6 @@ public:
static void DeleteLineList(nsPresContext* aPresContext, nsLineList& aLines,
nsIFrame* aDestructRoot);
- // search from beginning to end
- // XXX Should switch to API below
- static nsLineBox* FindLineContaining(nsLineList& aLines, nsIFrame* aFrame,
- PRInt32* aFrameIndexInLine);
-
// search from end to beginning of [aBegin, aEnd)
// Returns PR_TRUE if it found the line and PR_FALSE if not.
// Moves aEnd as it searches so that aEnd points to the resulting line.
@@ -1545,7 +1540,6 @@ public:
nsRect& aLineBounds,
PRUint32* aLineFlags);
virtual PRInt32 FindLineContaining(nsIFrame* aFrame);
- virtual PRInt32 FindLineAt(nscoord aY);
NS_IMETHOD FindFrameAt(PRInt32 aLineNumber,
nscoord aX,
nsIFrame** aFrameFound,
diff --git a/layout/mathml/nsIMathMLFrame.h b/layout/mathml/nsIMathMLFrame.h
index 9beff41acb88..597ba69e8033 100644
--- a/layout/mathml/nsIMathMLFrame.h
+++ b/layout/mathml/nsIMathMLFrame.h
@@ -83,9 +83,6 @@ public:
NS_IMETHOD
SetBoundingMetrics(const nsBoundingMetrics& aBoundingMetrics) = 0;
- NS_IMETHOD
- GetReference(nsPoint& aReference) = 0;
-
NS_IMETHOD
SetReference(const nsPoint& aReference) = 0;
@@ -117,30 +114,20 @@ public:
nsBoundingMetrics& aContainerSize,
nsHTMLReflowMetrics& aDesiredStretchSize) = 0;
- /* GetEmbellishData/SetEmbellishData :
- * Get/Set the mEmbellishData member variable.
- */
-
+ /* Get the mEmbellishData member variable. */
+
NS_IMETHOD
GetEmbellishData(nsEmbellishData& aEmbellishData) = 0;
- NS_IMETHOD
- SetEmbellishData(const nsEmbellishData& aEmbellishData) = 0;
-
/* SUPPORT FOR SCRIPTING ELEMENTS */
/*====================================================================*/
- /* GetPresentationData/SetPresentationData :
- * Get/Set the mPresentationData member variable.
- */
+ /* Get the mPresentationData member variable. */
NS_IMETHOD
GetPresentationData(nsPresentationData& aPresentationData) = 0;
- NS_IMETHOD
- SetPresentationData(const nsPresentationData& aPresentationData) = 0;
-
/* InheritAutomaticData() / TransmitAutomaticData() :
* There are precise rules governing each MathML frame and its children.
* Properties such as the scriptlevel or the embellished nature of a frame
diff --git a/layout/mathml/nsMathMLFrame.h b/layout/mathml/nsMathMLFrame.h
index a6cc52c4e9a2..5de0b60ee653 100644
--- a/layout/mathml/nsMathMLFrame.h
+++ b/layout/mathml/nsMathMLFrame.h
@@ -71,12 +71,6 @@ public:
return NS_OK;
}
- NS_IMETHOD
- GetReference(nsPoint& aReference) {
- aReference = mReference;
- return NS_OK;
- }
-
NS_IMETHOD
SetReference(const nsPoint& aReference) {
mReference = aReference;
@@ -99,12 +93,6 @@ public:
aEmbellishData = mEmbellishData;
return NS_OK;
}
-
- NS_IMETHOD
- SetEmbellishData(const nsEmbellishData& aEmbellishData) {
- mEmbellishData = aEmbellishData;
- return NS_OK;
- }
NS_IMETHOD
GetPresentationData(nsPresentationData& aPresentationData) {
@@ -112,12 +100,6 @@ public:
return NS_OK;
}
- NS_IMETHOD
- SetPresentationData(const nsPresentationData& aPresentationData) {
- mPresentationData = aPresentationData;
- return NS_OK;
- }
-
NS_IMETHOD
InheritAutomaticData(nsIFrame* aParent);
diff --git a/layout/style/nsCSSDeclaration.cpp b/layout/style/nsCSSDeclaration.cpp
index 7ae5facafdde..8a413d8b251a 100644
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -118,12 +118,6 @@ nsCSSDeclaration::RemoveProperty(nsCSSProperty aProperty)
return NS_OK;
}
-nsresult
-nsCSSDeclaration::AppendComment(const nsAString& aComment)
-{
- return /* NS_ERROR_NOT_IMPLEMENTED, or not any longer that is */ NS_OK;
-}
-
PRBool nsCSSDeclaration::AppendValueToString(nsCSSProperty aProperty, nsAString& aResult) const
{
nsCSSCompressedDataBlock *data = GetValueIsImportant(aProperty)
diff --git a/layout/style/nsCSSDeclaration.h b/layout/style/nsCSSDeclaration.h
index 727e5b8be1f5..9af9c10a3e2a 100644
--- a/layout/style/nsCSSDeclaration.h
+++ b/layout/style/nsCSSDeclaration.h
@@ -73,7 +73,6 @@ public:
*/
nsresult ValueAppended(nsCSSProperty aProperty);
- nsresult AppendComment(const nsAString& aComment);
nsresult RemoveProperty(nsCSSProperty aProperty);
nsresult GetValue(nsCSSProperty aProperty, nsAString& aValue) const;
diff --git a/layout/style/nsCSSLoader.cpp b/layout/style/nsCSSLoader.cpp
index ff21529bc916..f9138c5d9e20 100644
--- a/layout/style/nsCSSLoader.cpp
+++ b/layout/style/nsCSSLoader.cpp
@@ -218,9 +218,9 @@ public:
PRPackedBool mIsLoading : 1;
// mIsCancelled is set to true when a sheet load is stopped by
- // Stop() or StopLoadingSheet(). SheetLoadData::OnStreamComplete()
- // checks this to avoid parsing sheets that have been cancelled and
- // such.
+ // Stop() or StopLoadingSheet() (which was removed in Bug 556446).
+ // SheetLoadData::OnStreamComplete() checks this to avoid parsing
+ // sheets that have been cancelled and such.
PRPackedBool mIsCancelled : 1;
// mMustNotify is true if the load data is being loaded async and
@@ -539,14 +539,6 @@ Loader::SetPreferredSheet(const nsAString& aTitle)
return NS_OK;
}
-nsresult
-Loader::GetPreferredSheet(nsAString& aTitle)
-{
- aTitle.Assign(mPreferredSheet);
- return NS_OK;
-}
-
-
static const char kCharsetSym[] = "@charset \"";
static nsresult GetCharsetFromData(const unsigned char* aStyleSheetData,
@@ -2341,89 +2333,6 @@ Loader::Stop()
return NS_OK;
}
-struct StopLoadingSheetsByURIClosure {
- StopLoadingSheetsByURIClosure(nsIURI* aURI,
- Loader::LoadDataArray& aArray) :
- uri(aURI), array(aArray)
- {}
-
- nsIURI* uri;
- Loader::LoadDataArray& array;
-};
-
-static PLDHashOperator
-StopLoadingSheetByURICallback(URIAndPrincipalHashKey* aKey,
- SheetLoadData*& aData,
- void* aClosure)
-{
- NS_PRECONDITION(aData, "Must have a data!");
- NS_PRECONDITION(aClosure, "Must have a loader");
-
- StopLoadingSheetsByURIClosure* closure =
- static_cast(aClosure);
-
- PRBool equal;
- if (NS_SUCCEEDED(aData->mURI->Equals(closure->uri, &equal)) &&
- equal) {
- aData->mIsLoading = PR_FALSE; // we will handle the removal right here
- aData->mIsCancelled = PR_TRUE;
-
- closure->array.AppendElement(aData);
- return PL_DHASH_REMOVE;
- }
-
- return PL_DHASH_NEXT;
-}
-
-nsresult
-Loader::StopLoadingSheet(nsIURI* aURL)
-{
- NS_ENSURE_TRUE(aURL, NS_ERROR_NULL_POINTER);
-
- PRUint32 pendingCount =
- mPendingDatas.IsInitialized() ? mPendingDatas.Count() : 0;
- PRUint32 loadingCount =
- mLoadingDatas.IsInitialized() ? mLoadingDatas.Count() : 0;
- LoadDataArray arr(pendingCount + loadingCount + mPostedEvents.Length());
-
- StopLoadingSheetsByURIClosure closure(aURL, arr);
- if (pendingCount) {
- mPendingDatas.Enumerate(StopLoadingSheetByURICallback, &closure);
- }
- if (loadingCount) {
- mLoadingDatas.Enumerate(StopLoadingSheetByURICallback, &closure);
- }
-
- PRUint32 i;
- for (i = 0; i < mPostedEvents.Length(); ++i) {
- SheetLoadData* curData = mPostedEvents[i];
- PRBool equal;
- if (curData->mURI && NS_SUCCEEDED(curData->mURI->Equals(aURL, &equal)) &&
- equal) {
- curData->mIsCancelled = PR_TRUE;
- if (arr.AppendElement(curData)) {
- // SheetComplete() calls Release(), so give this an extra ref.
- NS_ADDREF(curData);
- }
-#ifdef DEBUG
- else {
- NS_NOTREACHED("We preallocated this memory... shouldn't really fail, "
- "except we never check that preallocation succeeds.");
- }
-#endif
- }
- }
- mPostedEvents.Clear();
-
- mDatasToNotifyOn += arr.Length();
- for (i = 0; i < arr.Length(); ++i) {
- --mDatasToNotifyOn;
- SheetComplete(arr[i], NS_BINDING_ABORTED);
- }
-
- return NS_OK;
-}
-
PRBool
Loader::HasPendingLoads()
{
diff --git a/layout/style/nsCSSLoader.h b/layout/style/nsCSSLoader.h
index 87180b244eef..865d559b6956 100644
--- a/layout/style/nsCSSLoader.h
+++ b/layout/style/nsCSSLoader.h
@@ -154,7 +154,6 @@ public:
{ mCompatMode = aCompatMode; }
nsCompatibility GetCompatibilityMode() { return mCompatMode; }
nsresult SetPreferredSheet(const nsAString& aTitle);
- nsresult GetPreferredSheet(nsAString& aTitle);
// XXXbz sort out what the deal is with events! When should they fire?
@@ -315,10 +314,10 @@ public:
nsresult Stop(void);
/**
- * Stop loading one sheet. The nsICSSLoaderObserver involved will be
- * notified with NS_BINDING_ABORTED as the status, possibly synchronously.
+ * nsresult Loader::StopLoadingSheet(nsIURI* aURL), which notifies the
+ * nsICSSLoaderObserver with NS_BINDING_ABORTED, was removed in Bug 556446.
+ * It can be found in revision 2c44a32052ad.
*/
- nsresult StopLoadingSheet(nsIURI* aURL);
/**
* Whether the loader is enabled or not.
diff --git a/layout/style/nsCSSPseudoClasses.cpp b/layout/style/nsCSSPseudoClasses.cpp
index f8ad350b1eef..883be6f347a4 100644
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -67,12 +67,6 @@ void nsCSSPseudoClasses::AddRefAtoms()
NS_ARRAY_LENGTH(CSSPseudoClasses_info));
}
-PRBool nsCSSPseudoClasses::IsPseudoClass(nsIAtom *aAtom)
-{
- return nsAtomListUtils::IsMember(aAtom,CSSPseudoClasses_info,
- NS_ARRAY_LENGTH(CSSPseudoClasses_info));
-}
-
PRBool
nsCSSPseudoClasses::HasStringArg(nsIAtom* aAtom)
{
diff --git a/layout/style/nsCSSPseudoClasses.h b/layout/style/nsCSSPseudoClasses.h
index b2e13eed230c..1de467784bdb 100644
--- a/layout/style/nsCSSPseudoClasses.h
+++ b/layout/style/nsCSSPseudoClasses.h
@@ -52,7 +52,6 @@ public:
static void AddRefAtoms();
- static PRBool IsPseudoClass(nsIAtom *aAtom);
static PRBool HasStringArg(nsIAtom* aAtom);
static PRBool HasNthPairArg(nsIAtom* aAtom);
diff --git a/layout/style/nsCSSStruct.cpp b/layout/style/nsCSSStruct.cpp
index 38738737b65d..3db57fa1cbbf 100644
--- a/layout/style/nsCSSStruct.cpp
+++ b/layout/style/nsCSSStruct.cpp
@@ -205,14 +205,6 @@ nsCSSCornerSizes::~nsCSSCornerSizes()
MOZ_COUNT_DTOR(nsCSSCornerSizes);
}
-void
-nsCSSCornerSizes::SetAllCornersTo(const nsCSSValue& aValue)
-{
- NS_FOR_CSS_FULL_CORNERS(corner) {
- this->GetFullCorner(corner).SetBothValuesTo(aValue);
- }
-}
-
void
nsCSSCornerSizes::Reset()
{
diff --git a/layout/style/nsCSSStruct.h b/layout/style/nsCSSStruct.h
index 61a701be8337..c45842521e66 100644
--- a/layout/style/nsCSSStruct.h
+++ b/layout/style/nsCSSStruct.h
@@ -206,7 +206,6 @@ struct nsCSSCornerSizes {
return PR_FALSE;
}
- void SetAllCornersTo(const nsCSSValue& aValue);
void Reset();
nsCSSValuePair mTopLeft;
diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp
index f2a940779659..9b7218758be5 100644
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -414,12 +414,6 @@ void nsCSSValue::SetDummyInheritValue()
mUnit = eCSSUnit_DummyInherit;
}
-void nsCSSValue::SetRectIsAutoValue()
-{
- Reset();
- mUnit = eCSSUnit_RectIsAuto;
-}
-
void nsCSSValue::StartImageLoad(nsIDocument* aDocument) const
{
NS_PRECONDITION(eCSSUnit_URL == mUnit, "Not a URL value!");
diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h
index 9c6a4278f2ca..6cc4ac22682f 100644
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -341,7 +341,6 @@ public:
NS_HIDDEN_(void) SetSystemFontValue();
NS_HIDDEN_(void) SetDummyValue();
NS_HIDDEN_(void) SetDummyInheritValue();
- NS_HIDDEN_(void) SetRectIsAutoValue();
NS_HIDDEN_(void) StartImageLoad(nsIDocument* aDocument)
const; // Not really const, but pretending
diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp
index b093316e3174..f85dbd546fe8 100644
--- a/layout/style/nsHTMLStyleSheet.cpp
+++ b/layout/style/nsHTMLStyleSheet.cpp
@@ -496,42 +496,6 @@ nsHTMLStyleSheet::Reset(nsIURI* aURL)
return NS_OK;
}
-nsresult
-nsHTMLStyleSheet::GetLinkColor(nscolor& aColor)
-{
- if (!mLinkRule) {
- return NS_HTML_STYLE_PROPERTY_NOT_THERE;
- }
- else {
- aColor = mLinkRule->mColor;
- return NS_OK;
- }
-}
-
-nsresult
-nsHTMLStyleSheet::GetActiveLinkColor(nscolor& aColor)
-{
- if (!mActiveRule) {
- return NS_HTML_STYLE_PROPERTY_NOT_THERE;
- }
- else {
- aColor = mActiveRule->mColor;
- return NS_OK;
- }
-}
-
-nsresult
-nsHTMLStyleSheet::GetVisitedLinkColor(nscolor& aColor)
-{
- if (!mVisitedRule) {
- return NS_HTML_STYLE_PROPERTY_NOT_THERE;
- }
- else {
- aColor = mVisitedRule->mColor;
- return NS_OK;
- }
-}
-
nsresult
nsHTMLStyleSheet::SetLinkColor(nscolor aColor)
{
diff --git a/layout/style/nsHTMLStyleSheet.h b/layout/style/nsHTMLStyleSheet.h
index 8c7ad8e31c0f..dca36492bbf5 100644
--- a/layout/style/nsHTMLStyleSheet.h
+++ b/layout/style/nsHTMLStyleSheet.h
@@ -93,9 +93,6 @@ public:
nsresult Init(nsIURI* aURL, nsIDocument* aDocument);
nsresult Reset(nsIURI* aURL);
- nsresult GetLinkColor(nscolor& aColor);
- nsresult GetActiveLinkColor(nscolor& aColor);
- nsresult GetVisitedLinkColor(nscolor& aColor);
nsresult SetLinkColor(nscolor aColor);
nsresult SetActiveLinkColor(nscolor aColor);
nsresult SetVisitedLinkColor(nscolor aColor);
diff --git a/layout/tables/nsCellMap.cpp b/layout/tables/nsCellMap.cpp
index 27c3b187c356..455d21821de4 100644
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -912,30 +912,6 @@ PRBool nsTableCellMap::RowHasSpanningCells(PRInt32 aRowIndex,
return PR_FALSE;
}
-PRBool nsTableCellMap::ColIsSpannedInto(PRInt32 aColIndex) const
-{
- PRBool result = PR_FALSE;
-
- PRInt32 colCount = mCols.Length();
- if ((aColIndex >= 0) && (aColIndex < colCount)) {
- result = mCols.ElementAt(aColIndex).mNumCellsSpan != 0;
- }
- return result;
-}
-
-PRBool nsTableCellMap::ColHasSpanningCells(PRInt32 aColIndex) const
-{
- NS_PRECONDITION (aColIndex < GetColCount(), "bad col index arg");
- nsCellMap* cellMap = mFirstMap;
- while (cellMap) {
- if (cellMap->ColHasSpanningCells(aColIndex)) {
- return PR_TRUE;
- }
- cellMap = cellMap->GetNextSibling();
- }
- return PR_FALSE;
-}
-
void nsTableCellMap::ExpandZeroColSpans()
{
mTableFrame.SetNeedColSpanExpansion(PR_FALSE); // mark the work done
@@ -2645,15 +2621,6 @@ void nsCellMap::Dump(PRBool aIsBorderCollapse) const
}
#endif
-PRBool
-nsCellMap::IsZeroColSpan(PRInt32 aRowIndex,
- PRInt32 aColIndex) const
-{
- CellData* data =
- mRows.SafeElementAt(aRowIndex, *sEmptyRow).SafeElementAt(aColIndex);
- return data && data->IsZeroColSpan();
-}
-
CellData*
nsCellMap::GetDataAt(PRInt32 aMapRowIndex,
PRInt32 aColIndex) const
@@ -2779,22 +2746,6 @@ PRBool nsCellMap::RowHasSpanningCells(PRInt32 aRowIndex,
return PR_FALSE;
}
-PRBool nsCellMap::ColHasSpanningCells(PRInt32 aColIndex) const
-{
- for (PRInt32 rowIndex = 0; rowIndex < mContentRowCount; rowIndex++) {
- CellData* cd = GetDataAt(rowIndex, aColIndex);
- if (cd && (cd->IsOrig())) { // cell originates
- CellData* cd2 = GetDataAt(rowIndex, aColIndex +1);
- if (cd2 && cd2->IsColSpan()) { // cd2 is spanned by a col
- if (cd->GetCellFrame() == GetCellFrame(rowIndex , aColIndex + 1, *cd2, PR_FALSE)) {
- return PR_TRUE;
- }
- }
- }
- }
- return PR_FALSE;
-}
-
void nsCellMap::DestroyCellData(CellData* aData)
{
if (!aData) {
diff --git a/layout/tables/nsCellMap.h b/layout/tables/nsCellMap.h
index 0f5999d0e608..6ca8957f7cda 100644
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -227,9 +227,6 @@ protected:
nsRect& aDamageArea);
public:
- PRBool ColIsSpannedInto(PRInt32 aColIndex) const;
- PRBool ColHasSpanningCells(PRInt32 aColIndex) const;
-
void ExpandZeroColSpans();
void SetNotTopStart(PRUint8 aSide,
@@ -441,8 +438,6 @@ public:
PRBool RowHasSpanningCells(PRInt32 aRowIndex,
PRInt32 aNumEffCols) const;
- PRBool ColHasSpanningCells(PRInt32 aColIndex) const;
-
void ExpandZeroColSpans(nsTableCellMap& aMap);
/** indicate whether the row has more than one cell that either originates
@@ -578,9 +573,6 @@ protected:
PRInt32 GetColSpanForNewCell(nsTableCellFrame& aCellFrameToAdd,
PRBool& aIsZeroColSpan) const;
- PRBool IsZeroColSpan(PRInt32 aRowIndex,
- PRInt32 aColIndex) const;
-
// Destroy a CellData struct. This will handle the case of aData
// actually being a BCCellData properly.
void DestroyCellData(CellData* aData);
diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp
index 0c6659c2df10..105cd7483f42 100644
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -494,18 +494,6 @@ PRBool nsTableFrame::HasMoreThanOneCell(PRInt32 aRowIndex) const
return tableCellMap->HasMoreThanOneCell(aRowIndex);
}
-PRInt32 nsTableFrame::GetEffectiveCOLSAttribute()
-{
- NS_PRECONDITION (GetCellMap(), "null cellMap.");
-
- PRInt32 result;
- result = GetStyleTable()->mCols;
- PRInt32 numCols = GetColCount();
- if (result > numCols)
- result = numCols;
- return result;
-}
-
void nsTableFrame::AdjustRowIndices(PRInt32 aRowIndex,
PRInt32 aAdjustment)
{
@@ -3251,17 +3239,6 @@ nsTableFrame::DistributeHeightToRows(const nsHTMLReflowState& aReflowState,
ResizeCells(*this);
}
-PRBool
-nsTableFrame::IsPctHeight(nsStyleContext* aStyleContext)
-{
- PRBool result = PR_FALSE;
- if (aStyleContext) {
- result = (eStyleUnit_Percent ==
- aStyleContext->GetStylePosition()->mHeight.GetUnit());
- }
- return result;
-}
-
PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
{
nsTableFrame * firstInFlow = (nsTableFrame *)GetFirstInFlow();
@@ -3280,25 +3257,6 @@ PRInt32 nsTableFrame::GetColumnWidth(PRInt32 aColIndex)
return result;
}
-void nsTableFrame::SetColumnWidth(PRInt32 aColIndex, nscoord aWidth)
-{
- nsTableFrame* firstInFlow = (nsTableFrame *)GetFirstInFlow();
- NS_ASSERTION(firstInFlow, "illegal state -- no first in flow");
-
- if (this == firstInFlow) {
- nsTableColFrame* colFrame = GetColFrame(aColIndex);
- if (colFrame) {
- colFrame->SetFinalWidth(aWidth);
- }
- else {
- NS_ASSERTION(PR_FALSE, "null col frame");
- }
- }
- else {
- firstInFlow->SetColumnWidth(aColIndex, aWidth);
- }
-}
-
// XXX: could cache this. But be sure to check style changes if you do!
nscoord nsTableFrame::GetCellSpacingX()
{
@@ -3363,21 +3321,6 @@ nsTableFrame::GetTableFrame(nsIFrame* aSourceFrame)
return nsnull;
}
-PRBool
-nsTableFrame::IsAutoWidth(PRBool* aIsPctWidth)
-{
- const nsStyleCoord& width = GetStylePosition()->mWidth;
-
- if (aIsPctWidth) {
- // XXX The old code also made the return value true for 0%, but that
- // seems silly.
- *aIsPctWidth = width.GetUnit() == eStyleUnit_Percent &&
- width.GetPercentValue() > 0.0f;
- // Should this handle -moz-available and -moz-fit-content?
- }
- return width.GetUnit() == eStyleUnit_Auto;
-}
-
PRBool
nsTableFrame::IsAutoHeight()
{
@@ -7199,28 +7142,6 @@ PRBool nsTableFrame::RowIsSpannedInto(PRInt32 aRowIndex, PRInt32 aNumEffCols)
return result;
}
-PRBool nsTableFrame::ColHasSpanningCells(PRInt32 aColIndex)
-{
- PRBool result = PR_FALSE;
- nsTableCellMap * cellMap = GetCellMap();
- NS_PRECONDITION (cellMap, "bad call, cellMap not yet allocated.");
- if (cellMap) {
- result = cellMap->ColHasSpanningCells(aColIndex);
- }
- return result;
-}
-
-PRBool nsTableFrame::ColIsSpannedInto(PRInt32 aColIndex)
-{
- PRBool result = PR_FALSE;
- nsTableCellMap * cellMap = GetCellMap();
- NS_PRECONDITION (cellMap, "bad call, cellMap not yet allocated.");
- if (cellMap) {
- result = cellMap->ColIsSpannedInto(aColIndex);
- }
- return result;
-}
-
/* static */
void
nsTableFrame::InvalidateFrame(nsIFrame* aFrame,
diff --git a/layout/tables/nsTableFrame.h b/layout/tables/nsTableFrame.h
index 6589c24027d8..714281ce4230 100644
--- a/layout/tables/nsTableFrame.h
+++ b/layout/tables/nsTableFrame.h
@@ -240,9 +240,7 @@ public:
static nsIFrame* GetFrameAtOrBefore(nsIFrame* aParentFrame,
nsIFrame* aPriorChildFrame,
nsIAtom* aChildType);
- PRBool IsAutoWidth(PRBool* aIsPctWidth = nsnull);
PRBool IsAutoHeight();
- static PRBool IsPctHeight(nsStyleContext* aStyleContext);
/** @return PR_TRUE if aDisplayType represents a rowgroup of any sort
* (header, footer, or body)
@@ -381,9 +379,6 @@ public:
/** return the width of the column at aColIndex */
virtual PRInt32 GetColumnWidth(PRInt32 aColIndex);
- /** set the width of the column at aColIndex to aWidth */
- virtual void SetColumnWidth(PRInt32 aColIndex, nscoord aWidth);
-
/** helper to get the cell spacing X style value */
virtual nscoord GetCellSpacingX();
@@ -423,11 +418,6 @@ public:
*/
PRBool HasMoreThanOneCell(PRInt32 aRowIndex) const;
- /** return the value of the COLS attribute, adjusted for the
- * actual number of columns in the table
- */
- PRInt32 GetEffectiveCOLSAttribute();
-
/** return the column frame associated with aColIndex
* returns nsnull if the col frame has not yet been allocated, or if
* aColIndex is out of range
@@ -656,14 +646,6 @@ public:
// columns limits the search up to that column
PRBool RowHasSpanningCells(PRInt32 aRowIndex, PRInt32 aNumEffCols);
- // Returns PR_TRUE if there are any cells to the left of the column at
- // aColIndex and spanning into the column at aColIndex
- PRBool ColIsSpannedInto(PRInt32 aColIndex);
-
- // Returns PR_TRUE if there is a cell originating in aColIndex
- // which spans into the next col
- PRBool ColHasSpanningCells(PRInt32 aColIndex);
-
protected:
PRBool HaveReflowedColGroups() const;
diff --git a/layout/tables/nsTableOuterFrame.cpp b/layout/tables/nsTableOuterFrame.cpp
index ec43992ea890..a6a092658633 100644
--- a/layout/tables/nsTableOuterFrame.cpp
+++ b/layout/tables/nsTableOuterFrame.cpp
@@ -701,71 +701,6 @@ nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
}
-// XXX This is now unused, but it probably should be used!
-void
-nsTableOuterFrame::BalanceLeftRightCaption(PRUint8 aCaptionSide,
- const nsMargin& aInnerMargin,
- const nsMargin& aCaptionMargin,
- nscoord& aInnerWidth,
- nscoord& aCaptionWidth)
-{
-
- /* balance the caption and inner table widths to ensure space for percent widths
- * Percent widths for captions or the inner table frame can determine how much of the
- * available width is used and how the available width is distributed between those frames
- * The inner table frame has already a quite sophisticated treatment of percentage widths
- * (see BasicTableLayoutStrategy.cpp). So it acts as master in the below computations.
- * There are four possible scenarios
- * a) None of the frames have a percentage width - then the aInnerWidth and aCaptionwidth will not change
- * b) Only the inner frame has a percentage width - this is handled in BasicTableLayoutStrategy.cpp,
- * both widths will not change
- * c) Only the caption has a percentage width - then the overall width (ow) will be different depending on
- * the caption side. For the left side
- * ow = aCaptionMargin.left + aCaptionWidth + aCaptionMargin.right + aInnerwidth + aInnerMargin.right
- * aCaptionWidth = capPercent * ow
- * solving this equation for aCaptionWidth gives:
- * aCaptionWidth = capPercent/(1-capPercent) *
- * (aCaptionMargin.left + aCaptionMargin.right + aInnerwidth + aInnerMargin.right)
- * this result will cause problems for capPercent >= 1, in these cases the algorithm will now bail out
- * a similar expression can be found for the right case
- * d) both frames have percent widths in this case the caption width will be the inner width multiplied
- * by the weight capPercent/innerPercent
- */
-
-
- float capPercent = -1.0;
- float innerPercent = -1.0;
- const nsStylePosition* position = mCaptionFrame->GetStylePosition();
- if (eStyleUnit_Percent == position->mWidth.GetUnit()) {
- capPercent = position->mWidth.GetPercentValue();
- if (capPercent >= 1.0)
- return;
- }
-
- position = mInnerTableFrame->GetStylePosition();
- if (eStyleUnit_Percent == position->mWidth.GetUnit()) {
- innerPercent = position->mWidth.GetPercentValue();
- if (innerPercent >= 1.0)
- return;
- }
-
- if ((capPercent <= 0.0) && (innerPercent <= 0.0))
- return;
-
-
- if (innerPercent <= 0.0) {
- if (NS_STYLE_CAPTION_SIDE_LEFT == aCaptionSide)
- aCaptionWidth= (nscoord) ((capPercent / (1.0 - capPercent)) * (aCaptionMargin.left + aCaptionMargin.right +
- aInnerWidth + aInnerMargin.right));
- else
- aCaptionWidth= (nscoord) ((capPercent / (1.0 - capPercent)) * (aCaptionMargin.left + aCaptionMargin.right +
- aInnerWidth + aInnerMargin.left));
- }
- else {
- aCaptionWidth = (nscoord) ((capPercent / innerPercent) * aInnerWidth);
- }
-}
-
nsresult
nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
const nsSize& aContainBlockSize,
diff --git a/layout/tables/nsTableOuterFrame.h b/layout/tables/nsTableOuterFrame.h
index d8882a933bf0..55bfdcbeef48 100644
--- a/layout/tables/nsTableOuterFrame.h
+++ b/layout/tables/nsTableOuterFrame.h
@@ -220,12 +220,6 @@ protected:
nscoord& aWidth,
nscoord& aHeight);
- void BalanceLeftRightCaption(PRUint8 aCaptionSide,
- const nsMargin& aInnerMargin,
- const nsMargin& aCaptionMargin,
- nscoord& aInnerWidth,
- nscoord& aCaptionWidth);
-
nsresult GetCaptionOrigin(PRUint32 aCaptionSide,
const nsSize& aContainBlockSize,
const nsSize& aInnerSize,
diff --git a/layout/tables/nsTableRowGroupFrame.cpp b/layout/tables/nsTableRowGroupFrame.cpp
index f0b7527db878..f6b1be4652e6 100644
--- a/layout/tables/nsTableRowGroupFrame.cpp
+++ b/layout/tables/nsTableRowGroupFrame.cpp
@@ -1695,13 +1695,6 @@ nsTableRowGroupFrame::FindLineContaining(nsIFrame* aFrame)
return rowFrame->GetRowIndex() - GetStartRowIndex();
}
-PRInt32
-nsTableRowGroupFrame::FindLineAt(nscoord aY)
-{
- NS_NOTREACHED("Not implemented");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
#ifdef IBMBIDI
NS_IMETHODIMP
nsTableRowGroupFrame::CheckLineOrder(PRInt32 aLine,
diff --git a/layout/tables/nsTableRowGroupFrame.h b/layout/tables/nsTableRowGroupFrame.h
index 92e09591b5be..985a6eb8335e 100644
--- a/layout/tables/nsTableRowGroupFrame.h
+++ b/layout/tables/nsTableRowGroupFrame.h
@@ -262,11 +262,6 @@ public:
* frame. -1 if the frame cannot be found.
*/
virtual PRInt32 FindLineContaining(nsIFrame* aFrame);
-
- /** not implemented
- * the function is also not called in our tree
- */
- virtual PRInt32 FindLineAt(nscoord aY);
/** Find the orginating cell frame on a row that is the nearest to the
* coordinate X.
diff --git a/layout/xul/base/src/grid/nsGrid.cpp b/layout/xul/base/src/grid/nsGrid.cpp
index 6aa7401b0aad..93b2d1ec05ba 100644
--- a/layout/xul/base/src/grid/nsGrid.cpp
+++ b/layout/xul/base/src/grid/nsGrid.cpp
@@ -512,20 +512,6 @@ nsGrid::DirtyRows(nsIBox* aRowBox, nsBoxLayoutState& aState)
mMarkingDirty = PR_FALSE;
}
-nsGridRow* nsGrid::GetColumns()
-{
- RebuildIfNeeded();
-
- return mColumns;
-}
-
-nsGridRow* nsGrid::GetRows()
-{
- RebuildIfNeeded();
-
- return mRows;
-}
-
nsGridRow*
nsGrid::GetColumnAt(PRInt32 aIndex, PRBool aIsHorizontal)
{
diff --git a/layout/xul/base/src/grid/nsGrid.h b/layout/xul/base/src/grid/nsGrid.h
index c6dd22362f12..3ee05a2f2481 100644
--- a/layout/xul/base/src/grid/nsGrid.h
+++ b/layout/xul/base/src/grid/nsGrid.h
@@ -101,8 +101,6 @@ public:
nsIBox* GetBox() { return mBox; }
nsIBox* GetRowsBox() { return mRowsBox; }
nsIBox* GetColumnsBox() { return mColumnsBox; }
- nsGridRow* GetColumns();
- nsGridRow* GetRows();
PRInt32 GetRowCount(PRInt32 aIsHorizontal = PR_TRUE);
PRInt32 GetColumnCount(PRInt32 aIsHorizontal = PR_TRUE);
diff --git a/layout/xul/base/src/grid/nsGridRow.cpp b/layout/xul/base/src/grid/nsGridRow.cpp
index 86ac6166a2a0..8a244a08bae2 100644
--- a/layout/xul/base/src/grid/nsGridRow.cpp
+++ b/layout/xul/base/src/grid/nsGridRow.cpp
@@ -81,22 +81,6 @@ nsGridRow::~nsGridRow()
MOZ_COUNT_DTOR(nsGridRow);
}
-void
-nsGridRow::MarkDirty(nsBoxLayoutState& aState)
-{
- mPref = -1;
- mMin = -1;
- mMax = -1;
- mFlex = -1;
- mTop = -1;
- mBottom = -1;
-
- if (mBox) {
- aState.PresShell()->FrameNeedsReflow(mBox, nsIPresShell::eTreeChange,
- NS_FRAME_IS_DIRTY);
- }
-}
-
PRBool
nsGridRow::IsCollapsed(nsBoxLayoutState& aState)
{
diff --git a/layout/xul/base/src/grid/nsGridRow.h b/layout/xul/base/src/grid/nsGridRow.h
index 341f78de77ec..5c29e9948c57 100644
--- a/layout/xul/base/src/grid/nsGridRow.h
+++ b/layout/xul/base/src/grid/nsGridRow.h
@@ -60,7 +60,6 @@ public:
~nsGridRow();
void Init(nsIBox* aBox, PRBool aIsBogus);
- void MarkDirty(nsBoxLayoutState& aState);
// accessors
nsIBox* GetBox() { return mBox; }
diff --git a/layout/xul/base/src/nsBox.cpp b/layout/xul/base/src/nsBox.cpp
index 8d09559a7e43..441ecb454430 100644
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -410,7 +410,7 @@ nsBox::SizeNeedsRecalc(nsSize& aSize)
}
void
-nsBox::CoordNeedsRecalc(PRInt32& aFlex)
+nsBox::CoordNeedsRecalc(nscoord& aFlex)
{
aFlex = -1;
}
@@ -918,12 +918,6 @@ nsBox::AddBorderAndPadding(nsSize& aSize)
AddBorderAndPadding(this, aSize);
}
-void
-nsBox::AddMargin(nsSize& aSize)
-{
- AddMargin(this, aSize);
-}
-
void
nsBox::AddBorderAndPadding(nsIBox* aBox, nsSize& aSize)
{
diff --git a/layout/xul/base/src/nsBox.h b/layout/xul/base/src/nsBox.h
index 5062edcf7116..c309f0ea07e1 100644
--- a/layout/xul/base/src/nsBox.h
+++ b/layout/xul/base/src/nsBox.h
@@ -111,7 +111,6 @@ rollbox.
void CoordNeedsRecalc(nscoord& aCoord);
void AddBorderAndPadding(nsSize& aSize);
- void AddMargin(nsSize& aSize);
static void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize);
static void AddMargin(nsIBox* aChild, nsSize& aSize);
diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp
index 41e7434d27fa..003f54c49b5b 100644
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -1916,30 +1916,6 @@ nsBoxFrame::RegUnregAccessKey(PRBool aDoReg)
return rv;
}
-void
-nsBoxFrame::FireDOMEventSynch(const nsAString& aDOMEventName, nsIContent *aContent)
-{
- // XXX This will be deprecated, because it is not good to fire synchronous DOM events
- // from layout. It's better to use nsFrame::FireDOMEvent() which is asynchronous.
- nsPresContext *presContext = PresContext();
- nsIContent *content = aContent ? aContent : mContent;
- if (content && presContext) {
- // Fire a DOM event
- nsCOMPtr event;
- if (NS_SUCCEEDED(nsEventDispatcher::CreateEvent(presContext, nsnull,
- NS_LITERAL_STRING("Events"),
- getter_AddRefs(event)))) {
- event->InitEvent(aDOMEventName, PR_TRUE, PR_TRUE);
-
- nsCOMPtr privateEvent(do_QueryInterface(event));
- privateEvent->SetTrusted(PR_TRUE);
-
- nsEventDispatcher::DispatchDOMEvent(content, nsnull, event,
- presContext, nsnull);
- }
- }
-}
-
PRBool
nsBoxFrame::SupportsOrdinalsInChildren()
{
diff --git a/layout/xul/base/src/nsBoxFrame.h b/layout/xul/base/src/nsBoxFrame.h
index d25531788a2a..4ac4ff3dbb08 100644
--- a/layout/xul/base/src/nsBoxFrame.h
+++ b/layout/xul/base/src/nsBoxFrame.h
@@ -205,11 +205,6 @@ public:
static nsresult LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect);
- // Fire DOM event. If no aContent argument use frame's mContent.
- // XXX This will be deprecated, because it is not good to fire synchronous DOM events
- // from layout. It's better to use nsFrame::FireDOMEvent() which is asynchronous.
- void FireDOMEventSynch(const nsAString& aDOMEventName, nsIContent *aContent = nsnull);
-
/**
* Utility method to redirect events on descendants to this frame.
* Supports 'allowevents' attribute on descendant elements to allow those
diff --git a/layout/xul/base/src/nsBoxLayout.cpp b/layout/xul/base/src/nsBoxLayout.cpp
index a93e04103f71..a1a2b40074f4 100644
--- a/layout/xul/base/src/nsBoxLayout.cpp
+++ b/layout/xul/base/src/nsBoxLayout.cpp
@@ -56,19 +56,6 @@ nsBoxLayout::nsBoxLayout()
{
}
-void
-nsBoxLayout::GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent)
-{
- nsIBox* parent = aBox->GetParentBox();
- if (parent)
- {
- parent->GetLayoutManager(aParent);
- return;
- }
-
- *aParent = nsnull;
-}
-
void
nsBoxLayout::AddBorderAndPadding(nsIBox* aBox, nsSize& aSize)
{
diff --git a/layout/xul/base/src/nsBoxLayout.h b/layout/xul/base/src/nsBoxLayout.h
index 3f1d7f79d018..8094a23c81e2 100644
--- a/layout/xul/base/src/nsBoxLayout.h
+++ b/layout/xul/base/src/nsBoxLayout.h
@@ -64,7 +64,6 @@ public:
virtual void ChildrenSet(nsIBox* aBox, nsBoxLayoutState& aState, nsIBox* aChildList);
virtual void IntrinsicWidthsDirty(nsIBox* aBox, nsBoxLayoutState& aState);
- virtual void GetParentLayout(nsIBox* aBox, nsIBoxLayout** aParent);
virtual void AddBorderAndPadding(nsIBox* aBox, nsSize& aSize);
virtual void AddMargin(nsIBox* aChild, nsSize& aSize);
virtual void AddMargin(nsSize& aSize, const nsMargin& aMargin);
diff --git a/layout/xul/base/src/nsListBoxBodyFrame.h b/layout/xul/base/src/nsListBoxBodyFrame.h
index a0029614966e..34647906fd1d 100644
--- a/layout/xul/base/src/nsListBoxBodyFrame.h
+++ b/layout/xul/base/src/nsListBoxBodyFrame.h
@@ -109,7 +109,7 @@ public:
PRInt32 GetRowCount();
PRInt32 GetRowHeightAppUnits() { return mRowHeight; }
PRInt32 GetFixedRowSize();
- void SetRowHeight(PRInt32 aRowHeight);
+ void SetRowHeight(nscoord aRowHeight);
nscoord GetYPosition();
nscoord GetAvailableHeight();
nscoord ComputeIntrinsicWidth(nsBoxLayoutState& aBoxLayoutState);
diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h
index a81ee0070195..a2095a099fd8 100644
--- a/layout/xul/base/src/nsMenuFrame.h
+++ b/layout/xul/base/src/nsMenuFrame.h
@@ -123,8 +123,6 @@ public:
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
#endif
- NS_IMETHOD IsActive(PRBool& aResult) { aResult = PR_TRUE; return NS_OK; }
-
// The following methods are all overridden so that the menupopup
// can be stored in a separate list, so that it doesn't impact reflow of the
// actual menu item at all.
From 2a0ed155babadb2113b2e37c46935cdf8ac7c763 Mon Sep 17 00:00:00 2001
From: Laurent Jouanneau
Date: Sat, 3 Apr 2010 14:51:17 +0200
Subject: [PATCH 58/62] bug 549295 - html serializer should not wrap by
default. r=Olly sr=Boris
---
content/base/src/nsXHTMLContentSerializer.cpp | 7 +-
content/base/test/Makefile.in | 2 +
.../test/file_htmlserializer_1_bodyonly.html | 12 ++--
.../test/file_htmlserializer_1_linebreak.html | 15 ++--
.../test/file_htmlserializer_1_links.html | 16 ++---
.../file_htmlserializer_1_nested_body.html | 16 ++---
.../test/file_htmlserializer_1_no_body.html | 3 +-
.../test/file_htmlserializer_1_noflag.html | 15 ++--
.../file_htmlserializer_1_noformatpre.html | 15 ++--
.../file_htmlserializer_1_sibling_body.html | 15 ++--
...mlserializer_1_sibling_body_only_body.html | 12 ++--
.../base/test/file_htmlserializer_1_wrap.html | 52 ++++++++++++++
.../test/file_htmlserializer_2_basic.html | 6 +-
.../test/file_htmlserializer_2_enthtml.html | 6 +-
.../test/file_htmlserializer_2_entw3c.html | 6 +-
.../test/file_htmlserializer_2_latin1.html | 6 +-
.../test/file_htmlserializer_ipv6_out.html | 3 +-
.../file_xhtmlserializer_1_bodyonly.xhtml | 15 ++--
.../file_xhtmlserializer_1_linebreak.xhtml | 15 ++--
.../test/file_xhtmlserializer_1_links.xhtml | 16 ++---
.../file_xhtmlserializer_1_nested_body.xhtml | 15 ++--
.../test/file_xhtmlserializer_1_noflag.xhtml | 15 ++--
.../file_xhtmlserializer_1_noformatpre.xhtml | 15 ++--
.../file_xhtmlserializer_1_sibling_body.xhtml | 15 ++--
...lserializer_1_sibling_body_only_body.xhtml | 15 ++--
.../test/file_xhtmlserializer_1_wrap.xhtml | 70 +++++++++++++++++++
.../test/file_xhtmlserializer_2_basic.xhtml | 3 +-
.../test/file_xhtmlserializer_2_enthtml.xhtml | 3 +-
.../test/file_xhtmlserializer_2_entw3c.xhtml | 3 +-
.../test/file_xhtmlserializer_2_latin1.xhtml | 3 +-
content/base/test/test_bug422403-1.html | 3 +-
content/base/test/test_bug422403-2.xhtml | 20 +++---
content/base/test/test_bug424359-1.html | 3 +-
content/base/test/test_bug424359-2.html | 14 ++--
content/base/test/test_bug541937.html | 2 +-
content/base/test/test_copypaste.html | 2 +-
content/base/test/test_htmlcopyencoder.html | 20 +++---
content/base/test/test_htmlcopyencoder.xhtml | 14 ++--
38 files changed, 257 insertions(+), 231 deletions(-)
create mode 100644 content/base/test/file_htmlserializer_1_wrap.html
create mode 100644 content/base/test/file_xhtmlserializer_1_wrap.xhtml
diff --git a/content/base/src/nsXHTMLContentSerializer.cpp b/content/base/src/nsXHTMLContentSerializer.cpp
index 83001e129e1d..ac6085baccfe 100644
--- a/content/base/src/nsXHTMLContentSerializer.cpp
+++ b/content/base/src/nsXHTMLContentSerializer.cpp
@@ -104,13 +104,10 @@ nsXHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
// The previous version of the HTML serializer did implicit wrapping
// when there is no flags, so we keep wrapping in order to keep
// compatibility with the existing calling code
- // XXXLJ perhaps we should remove these two default settings later ?
+ // XXXLJ perhaps should we remove this default settings later ?
if (aFlags & nsIDocumentEncoder::OutputFormatted ) {
aFlags = aFlags | nsIDocumentEncoder::OutputWrap;
}
- else if (!(aFlags & nsIDocumentEncoder::OutputRaw)) {
- aFlags = aFlags | nsIDocumentEncoder::OutputWrap;
- }
nsresult rv;
rv = nsXMLContentSerializer::Init(aFlags, aWrapColumn, aCharSet, aIsCopying, aRewriteEncodingDeclaration);
@@ -185,7 +182,9 @@ nsXHTMLContentSerializer::AppendText(nsIDOMText* aText,
PRInt32 lastNewlineOffset = kNotFound;
if (HasLongLines(data, lastNewlineOffset)) {
// We have long lines, rewrap
+ mDoWrap = PR_TRUE;
AppendToStringWrapped(data, aStr);
+ mDoWrap = PR_FALSE;
}
else {
AppendToStringConvertLF(data, aStr);
diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in
index 22076cc16115..7a85cb8978d1 100644
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -184,6 +184,7 @@ _TEST_FILES = test_bug5141.html \
file_htmlserializer_1_sibling_body.html \
file_htmlserializer_1_sibling_body_only_body.html \
file_htmlserializer_1_no_body.html \
+ file_htmlserializer_1_wrap.html \
test_bug424359-2.html \
file_htmlserializer_2.html \
test_bug431082.html \
@@ -283,6 +284,7 @@ _TEST_FILES = test_bug5141.html \
file_xhtmlserializer_1_sibling_body.xhtml \
file_xhtmlserializer_1_sibling_body_only_body.xhtml \
file_xhtmlserializer_1_no_body.xhtml \
+ file_xhtmlserializer_1_wrap.xhtml \
test_bug422403-2.xhtml \
file_xhtmlserializer_2.xhtml \
file_xhtmlserializer_2_basic.xhtml \
diff --git a/content/base/test/file_htmlserializer_1_bodyonly.html b/content/base/test/file_htmlserializer_1_bodyonly.html
index bfb6c7cd3885..848167c62a11 100644
--- a/content/base/test/file_htmlserializer_1_bodyonly.html
+++ b/content/base/test/file_htmlserializer_1_bodyonly.html
@@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -28,8 +26,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -43,5 +40,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_linebreak.html b/content/base/test/file_htmlserializer_1_linebreak.html
index fc641e3f975d..8194b8b415ea 100644
--- a/content/base/test/file_htmlserializer_1_linebreak.html
+++ b/content/base/test/file_htmlserializer_1_linebreak.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
@@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -33,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -48,5 +44,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_links.html b/content/base/test/file_htmlserializer_1_links.html
index bd5467f234c5..3625bcf3e040 100644
--- a/content/base/test/file_htmlserializer_1_links.html
+++ b/content/base/test/file_htmlserializer_1_links.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
@@ -8,11 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -34,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -49,5 +44,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
diff --git a/content/base/test/file_htmlserializer_1_nested_body.html b/content/base/test/file_htmlserializer_1_nested_body.html
index 20c9db0ede35..94f67547e319 100644
--- a/content/base/test/file_htmlserializer_1_nested_body.html
+++ b/content/base/test/file_htmlserializer_1_nested_body.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
@@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -33,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -48,6 +44,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
this is
- an other body element
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
this is an other body element
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_no_body.html b/content/base/test/file_htmlserializer_1_no_body.html
index cdd68759dc86..9c749721b187 100644
--- a/content/base/test/file_htmlserializer_1_no_body.html
+++ b/content/base/test/file_htmlserializer_1_no_body.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_noflag.html b/content/base/test/file_htmlserializer_1_noflag.html
index fc641e3f975d..8194b8b415ea 100644
--- a/content/base/test/file_htmlserializer_1_noflag.html
+++ b/content/base/test/file_htmlserializer_1_noflag.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
@@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -33,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -48,5 +44,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_noformatpre.html b/content/base/test/file_htmlserializer_1_noformatpre.html
index bc3026a36a0a..aba95b62c825 100644
--- a/content/base/test/file_htmlserializer_1_noformatpre.html
+++ b/content/base/test/file_htmlserializer_1_noformatpre.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
@@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -33,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -52,5 +48,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_sibling_body.html b/content/base/test/file_htmlserializer_1_sibling_body.html
index dfbb095b3cdd..f533e6679a9c 100644
--- a/content/base/test/file_htmlserializer_1_sibling_body.html
+++ b/content/base/test/file_htmlserializer_1_sibling_body.html
@@ -1,6 +1,5 @@
-
+
Test for html serializer
this is an other body element
@@ -8,10 +7,8 @@ charset=UTF-8">
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -33,8 +30,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -48,5 +44,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_sibling_body_only_body.html b/content/base/test/file_htmlserializer_1_sibling_body_only_body.html
index ac01e4118c35..97c162515678 100644
--- a/content/base/test/file_htmlserializer_1_sibling_body_only_body.html
+++ b/content/base/test/file_htmlserializer_1_sibling_body_only_body.html
@@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -28,8 +26,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -43,5 +40,4 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_1_wrap.html b/content/base/test/file_htmlserializer_1_wrap.html
new file mode 100644
index 000000000000..fc641e3f975d
--- /dev/null
+++ b/content/base/test/file_htmlserializer_1_wrap.html
@@ -0,0 +1,52 @@
+
+
+ Test for html serializer
+
+
+
Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
+ ad
+ litora torquent per
+ conubia
+nostra, per inceptos hymenaeos.
+
+
+
Nam tellus massa,éàèçù
+ fringilla
+aliquam,
fermentum sit amet,
posuere ac,
est.
+
Duis tristique egestas ligula. Mauris quis felis.
+
+
+
Fusce
+ a ipsum
non lacus posuere aliquet.
Sed fermentum
+posuere nulla
Donec tempor.
+Donec sollicitudin tortor
+
+
lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+aliquet lectus. Nunc vitae eros. Class aptent taciti
\ No newline at end of file
diff --git a/content/base/test/file_htmlserializer_2_basic.html b/content/base/test/file_htmlserializer_2_basic.html
index 4acc6b8cb582..56ac95dfdd4c 100644
--- a/content/base/test/file_htmlserializer_2_basic.html
+++ b/content/base/test/file_htmlserializer_2_basic.html
@@ -1,11 +1,9 @@
-Test
- for html serializer with entities
+Test for html serializer with entities
-
The basic set is just & < > " for interoperability
-with older products that don't support α and friends.
+
The basic set is just & < > " for interoperability with older products that don't support α and friends.
+
Testcase for IPv6 addressesTest
diff --git a/content/base/test/file_xhtmlserializer_1_bodyonly.xhtml b/content/base/test/file_xhtmlserializer_1_bodyonly.xhtml
index 2f42d2bfb61a..fbefe91d6e5e 100644
--- a/content/base/test/file_xhtmlserializer_1_bodyonly.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_bodyonly.xhtml
@@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -30,8 +28,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -46,10 +43,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_linebreak.xhtml b/content/base/test/file_xhtmlserializer_1_linebreak.xhtml
index 6b156278ad5b..a0aecdd2c627 100644
--- a/content/base/test/file_xhtmlserializer_1_linebreak.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_linebreak.xhtml
@@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -38,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -54,10 +51,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_links.xhtml b/content/base/test/file_xhtmlserializer_1_links.xhtml
index 3db4d350441f..ff32e9475742 100644
--- a/content/base/test/file_xhtmlserializer_1_links.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_links.xhtml
@@ -11,11 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -39,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -55,10 +51,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_nested_body.xhtml b/content/base/test/file_xhtmlserializer_1_nested_body.xhtml
index 2250d3af9031..120f8e7dcb1c 100644
--- a/content/base/test/file_xhtmlserializer_1_nested_body.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_nested_body.xhtml
@@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -38,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -54,10 +51,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_noflag.xhtml b/content/base/test/file_xhtmlserializer_1_noflag.xhtml
index 6b156278ad5b..a0aecdd2c627 100644
--- a/content/base/test/file_xhtmlserializer_1_noflag.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_noflag.xhtml
@@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -38,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -54,10 +51,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_noformatpre.xhtml b/content/base/test/file_xhtmlserializer_1_noformatpre.xhtml
index 95f6d4c79a6c..a5eb6e969238 100644
--- a/content/base/test/file_xhtmlserializer_1_noformatpre.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_noformatpre.xhtml
@@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -38,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -58,10 +55,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_sibling_body.xhtml b/content/base/test/file_xhtmlserializer_1_sibling_body.xhtml
index d5085963366a..9ef4840e36a3 100644
--- a/content/base/test/file_xhtmlserializer_1_sibling_body.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_sibling_body.xhtml
@@ -11,10 +11,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -38,8 +36,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -54,10 +51,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml b/content/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml
index f5784bc30556..f9f92a06703d 100644
--- a/content/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml
+++ b/content/base/test/file_xhtmlserializer_1_sibling_body_only_body.xhtml
@@ -3,10 +3,8 @@
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
-Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
- ad
- litora torquent per
- conubia
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu ad
+ litora torquent per conubia
nostra, per inceptos hymenaeos.
@@ -30,8 +28,7 @@ var d = a < b && a > c;
Fusce
- a ipsum
non lacus posuere aliquet.
Sed fermentum
-posuere nulla
Donec tempor.
+ a ipsum
non lacus posuere aliquet.
Sed fermentum posuere nulla
Donec tempor.
Donec sollicitudin tortor
@@ -46,10 +43,8 @@ ut gravida eros leo ut libero
-
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
-aliquet lectus. Nunc vitae eros. Class aptent taciti
-
lacinia libero
-ullamcorper laoreet.
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero ullamcorper laoreet.
Cras quis
nisi at odio
consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
diff --git a/content/base/test/file_xhtmlserializer_1_wrap.xhtml b/content/base/test/file_xhtmlserializer_1_wrap.xhtml
new file mode 100644
index 000000000000..6b156278ad5b
--- /dev/null
+++ b/content/base/test/file_xhtmlserializer_1_wrap.xhtml
@@ -0,0 +1,70 @@
+
+
+
+
+
+ Test for html serializer
+
+
+
+
Hello world
+
+ Lorem ipsum dolor sit amet, consectetuer
+adipiscing elit. Nam eu sapien. Sed viverra lacus. Donec quis ipsum.
+Nunc cursus aliquet lectus. Nunc vitae eros. Class aptent taciti sociosqu
+ ad
+ litora torquent per
+ conubia
+nostra, per inceptos hymenaeos.
+
+
+
Nam tellus massa,éàèçù
+ fringilla
+aliquam,
fermentum sit amet,
posuere ac,
est.
+
Duis tristique egestas ligula. Mauris quis felis.
+
+
+
+
Fusce
+ a ipsum
non lacus posuere aliquet.
Sed fermentum
+posuere nulla
Donec tempor.
+Donec sollicitudin tortor
+
+
lacinia libero ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at pharetra rutrum,
+lacus risus pulvinar ante.
+
+ut gravida eros leo ut libero
+
+
+
+
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus
+aliquet lectus. Nunc vitae eros. Class aptent taciti
+
lacinia libero
+ullamcorper laoreet.
+ Cras quis
+ nisi at odio
+ consectetuer molestie. Curabitur consectetuer urna a sem. Nunc non
+urna. Cras in massa. Vestibulum ante ipsum primis in faucibus orci
+luctus et ultrices posuere cubilia Curae; Sed sollicitudin, nulla at
+pharetra rutrum,
+lacus risus pulvinar ante.
+
+
+
\ No newline at end of file
diff --git a/content/base/test/file_xhtmlserializer_2_basic.xhtml b/content/base/test/file_xhtmlserializer_2_basic.xhtml
index c064b46b4fde..f7acfb06c025 100644
--- a/content/base/test/file_xhtmlserializer_2_basic.xhtml
+++ b/content/base/test/file_xhtmlserializer_2_basic.xhtml
@@ -7,8 +7,7 @@
-
The basic set is just " " & < > " for interoperability with
- older products that don't support α and friends.
+
The basic set is just " " & < > " for interoperability with older products that don't support α and friends.
Nam eu sapien. Sed viverra \nlacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. \nClass
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(null);
encoder.setContainerNode(node);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer\n
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra \nlacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. \nClass
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list container node");
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
+ expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@@ -143,7 +143,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
Lorem ipsum \ndolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@@ -152,7 +152,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer\n
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@@ -163,7 +163,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit \namet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
@@ -174,7 +174,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "application/xhtml+xml", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer\n
\n ';
+ expected = '
sit amet, consectetuer
\n ';
is(out, expected, "test list selection with range: selection contains only some child of the ol");
diff --git a/content/base/test/test_bug424359-1.html b/content/base/test/test_bug424359-1.html
index dbabe68ed552..da007a1c2263 100644
--- a/content/base/test/test_bug424359-1.html
+++ b/content/base/test/test_bug424359-1.html
@@ -91,10 +91,9 @@ function testHtmlSerializer_1 () {
//------------ OutputWrap
- // by default, this flag is set, so we should have the same result as
- // when there are no flags.
encoder.init(doc, "text/html", de.OutputLFLineBreak |de.OutputWrap);
out = encoder.encodeToString();
+ expected = loadFileContent("file_htmlserializer_1_wrap.html");
isRoughly(out, expected, "test OutputWrap");
//------------ OutputFormatted
diff --git a/content/base/test/test_bug424359-2.html b/content/base/test/test_bug424359-2.html
index 346a0d7631e7..54add8eb6d80 100644
--- a/content/base/test/test_bug424359-2.html
+++ b/content/base/test/test_bug424359-2.html
@@ -111,7 +111,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(null);
encoder.setContainerNode(node);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
+ expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@@ -149,7 +149,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@@ -158,7 +158,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@@ -169,7 +169,7 @@ function testHtmlSerializer_1 () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
diff --git a/content/base/test/test_bug541937.html b/content/base/test/test_bug541937.html
index 4efd30570aa3..ab7d6fa0a0c2 100644
--- a/content/base/test/test_bug541937.html
+++ b/content/base/test/test_bug541937.html
@@ -90,7 +90,7 @@ function testSerializer () {
encoder.init(doc, "text/html", de.OutputLFLineBreak);
encoder.setCharset("UTF-8");
result = encoder.encodeToString();
- expected = '\n Test\n';
+ expected = '\n Test\n';
expected += ' ';
expected += ' foo \n\n\n
Hello world
\n';
is(result, expected, "serialization of a link element with content, inside an html document");
diff --git a/content/base/test/test_copypaste.html b/content/base/test/test_copypaste.html
index f52464e5493b..d29e5823d1cd 100644
--- a/content/base/test/test_copypaste.html
+++ b/content/base/test/test_copypaste.html
@@ -65,7 +65,7 @@ function testCopyPaste () {
transferable.getTransferData ("text/html", data, {} ) ;
is (data.value.QueryInterface(Components.interfaces.nsISupportsString).data,
- "
This is a draggable\n bit of text.
",
+ "
This is a draggable bit of text.
",
"text/html value in the clipboard");
// let's paste now in the textarea and verify its content
diff --git a/content/base/test/test_htmlcopyencoder.html b/content/base/test/test_htmlcopyencoder.html
index c7dba4bbd527..1b8e4c495f70 100644
--- a/content/base/test/test_htmlcopyencoder.html
+++ b/content/base/test/test_htmlcopyencoder.html
@@ -40,7 +40,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "
This is a draggable\n bit of text.
";
+ expected = "
This is a draggable bit of text.
";
is(out, expected, "test node");
var select = window.getSelection();
@@ -49,7 +49,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = "
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setContainerNode(node);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
+ expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@@ -100,7 +100,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@@ -109,7 +109,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@@ -120,7 +120,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer\n
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
// selection contains only some child of the ol
@@ -154,7 +154,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list selection with a value on a LI");
//test Bug 436703
diff --git a/content/base/test/test_htmlcopyencoder.xhtml b/content/base/test/test_htmlcopyencoder.xhtml
index 7dbc55da45e7..8fc82f176ef0 100644
--- a/content/base/test/test_htmlcopyencoder.xhtml
+++ b/content/base/test/test_htmlcopyencoder.xhtml
@@ -44,7 +44,7 @@ function testHtmlCopyEncoder () {
// right order but the html serializer serializes in the reverse order
// (because the html parser stores the attribute in the reverse order,
// see bug 213347 for reason).
- expected = "
This is a draggable\n bit of text.
";
+ expected = "
This is a draggable bit of text.
";
is(out, expected, "test node");
var select = window.getSelection();
@@ -53,7 +53,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html", de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = "
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
is(out, expected, "test list container node");
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setNode(node);
out = encoder.encodeToString();
- expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
+ expected = "\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
@@ -97,7 +97,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '\n
Lorem ipsum dolor
\n
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
todo_is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
@@ -106,7 +106,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
todo_is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
@@ -117,7 +117,7 @@ function testHtmlCopyEncoder () {
encoder.init(document, "text/html",de.OutputLFLineBreak | de.OutputSelectionOnly);
encoder.setSelection(select);
out = encoder.encodeToString();
- expected = '
sit amet, consectetuer\n
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
+ expected = '
sit amet, consectetuer\n
\n
adipiscing elit
\n
Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus aliquet lectus. Nunc vitae eros. Class
\n
aptent taciti
\n';
todo_is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
From f30edd9ec35c834d147830b0ee00f6a30f18a0c9 Mon Sep 17 00:00:00 2001
From: Jonathan Kew
Date: Sat, 3 Apr 2010 13:52:23 +0100
Subject: [PATCH 59/62] Bug 553433 - followup to correct freetype notice in
about:license. r=blassey
---
toolkit/content/license.html | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/toolkit/content/license.html b/toolkit/content/license.html
index 4f63a0a645cd..839fa8328732 100644
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -3132,8 +3132,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software is based in part on the work of the Independent
JPEG Group.