From e42e1bf3228eea6a668e88aa41022dc8a3351445 Mon Sep 17 00:00:00 2001 From: "tor%cs.brown.edu" Date: Tue, 26 Apr 2005 00:10:17 +0000 Subject: [PATCH] Bug 256624 - should operate over "real" content children only. Patch by scootermorris@comcast.net, r+sr=bz, a=asa. git-svn-id: svn://10.0.0.236/trunk@172710 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 23 +++++++++++-------- mozilla/layout/svg/base/src/svg.css | 4 ++++ 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 52e4c963dd5..7b07ef82958 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -7146,7 +7146,6 @@ nsCSSFrameConstructor::SVGSwitchProcessChildren(nsFrameConstructorState& aState, nsFrameItems& aFrameItems) { nsresult rv = NS_OK; - PRBool isFinished = PR_FALSE; PRBool hasRequiredExtensions = PR_FALSE; PRBool hasRequiredFeatures = PR_FALSE; PRBool hasSystemLanguage = PR_FALSE; @@ -7160,18 +7159,23 @@ nsCSSFrameConstructor::SVGSwitchProcessChildren(nsFrameConstructorState& aState, // elements in order, and then processes and renders the first child for // which these attributes evaluate to true. All others will be bypassed and // therefore not rendered. - ChildIterator iter, last; - for (ChildIterator::Init(aContent, &iter, &last); - (iter != last) && (! isFinished); - ++iter) { + PRInt32 childCount = aContent->GetChildCount(); + for (PRInt32 i = 0; i < childCount; ++i) { + nsIContent* child = aContent->GetChildAt(i); - nsCOMPtr child(*iter); + // Skip over children that aren't elements + if (!child->IsContentOfType(nsIContent::eELEMENT)) { + continue; + } rv = TestSVGConditions(child, hasRequiredExtensions, hasRequiredFeatures, hasSystemLanguage); #ifdef DEBUG_scooter + nsAutoString str; + child->Tag()->ToString(str); + printf("Child tag: %s\n", NS_ConvertUCS2toUTF8(str).get()); printf("SwitchProcessChildren: Required Extentions = %s, Required Features = %s, System Language = %s\n", hasRequiredExtensions ? "true" : "false", hasRequiredFeatures ? "true" : "false", @@ -7184,15 +7188,14 @@ nsCSSFrameConstructor::SVGSwitchProcessChildren(nsFrameConstructorState& aState, hasRequiredFeatures && hasSystemLanguage) { - rv = ConstructFrame(aState, nsCOMPtr(*iter), + rv = ConstructFrame(aState, child, aFrame, aFrameItems); if (NS_FAILED(rv)) return rv; - if (child->IsContentOfType(nsIContent::eELEMENT)) { - break; - } + // No errors -- break out of loop (only render the first matching element) + break; } } diff --git a/mozilla/layout/svg/base/src/svg.css b/mozilla/layout/svg/base/src/svg.css index e041e67e88a..188a5c6bcf9 100644 --- a/mozilla/layout/svg/base/src/svg.css +++ b/mozilla/layout/svg/base/src/svg.css @@ -59,6 +59,10 @@ style, script, symbol { display: none; } +switch { + -moz-binding: none !important; +} + svg:not(:root), symbol, image, marker, pattern, foreignObject { overflow: hidden; }