Bug 256624 - <switch> 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
This commit is contained in:
tor%cs.brown.edu
2005-04-26 00:10:17 +00:00
parent 775ef00693
commit e42e1bf322
2 changed files with 17 additions and 10 deletions

View File

@@ -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<nsIContent> 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<nsIContent>(*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;
}
}