Support for :last-child pseudoclass; checking in for Ian Hickson ; b=46916, r=pierre, sr=attinasi
This commit is contained in:
Родитель
1ff1a8817d
Коммит
ad4cc99616
|
@ -1373,6 +1373,7 @@ static PRBool IsPseudoClass(const nsIAtom* aAtom)
|
|||
(nsCSSAtoms::focusPseudo == aAtom) ||
|
||||
(nsCSSAtoms::hoverPseudo == aAtom) ||
|
||||
(nsCSSAtoms::langPseudo == aAtom) ||
|
||||
(nsCSSAtoms::lastChildPseudo == aAtom) ||
|
||||
(nsCSSAtoms::lastNodePseudo == aAtom) ||
|
||||
(nsCSSAtoms::linkPseudo == aAtom) ||
|
||||
(nsCSSAtoms::outOfDatePseudo == aAtom) ||
|
||||
|
|
|
@ -2980,7 +2980,7 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
PRInt32 index = -1;
|
||||
do {
|
||||
parent->ChildAt(++index, firstChild);
|
||||
if (firstChild) { // skip text & comments (and whitespace for firstNode as well)
|
||||
if (firstChild) { // stop at first non-comment and non-whitespace node (and non-text node for firstChild)
|
||||
if (IsSignificantChild(firstChild, (nsCSSAtoms::firstNodePseudo == pseudoClass->mAtom))) {
|
||||
break;
|
||||
}
|
||||
|
@ -2994,7 +2994,8 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
result = PRBool(localTrue == (data.mContent == firstChild));
|
||||
NS_IF_RELEASE(firstChild);
|
||||
}
|
||||
else if (nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom) {
|
||||
else if ((nsCSSAtoms::lastChildPseudo == pseudoClass->mAtom) ||
|
||||
(nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom)) {
|
||||
nsIContent* lastChild = nsnull;
|
||||
nsIContent* parent = data.mParentContent;
|
||||
if (parent) {
|
||||
|
@ -3002,8 +3003,8 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
parent->ChildCount(index);
|
||||
do {
|
||||
parent->ChildAt(--index, lastChild);
|
||||
if (lastChild) { // skip whitespace text & comments
|
||||
if (IsSignificantChild(lastChild, PR_TRUE)) {
|
||||
if (lastChild) { // stop at first non-comment and non-whitespace node (and non-text node for lastChild)
|
||||
if (IsSignificantChild(lastChild, (nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom))) {
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(lastChild);
|
||||
|
|
|
@ -56,6 +56,7 @@ CSS_ATOM(enabledPseudo, ":enabled")
|
|||
|
||||
CSS_ATOM(firstChildPseudo, ":first-child")
|
||||
CSS_ATOM(firstNodePseudo, ":first-node")
|
||||
CSS_ATOM(lastChildPseudo, ":last-child")
|
||||
CSS_ATOM(lastNodePseudo, ":last-node")
|
||||
CSS_ATOM(focusPseudo, ":focus")
|
||||
|
||||
|
|
|
@ -1373,6 +1373,7 @@ static PRBool IsPseudoClass(const nsIAtom* aAtom)
|
|||
(nsCSSAtoms::focusPseudo == aAtom) ||
|
||||
(nsCSSAtoms::hoverPseudo == aAtom) ||
|
||||
(nsCSSAtoms::langPseudo == aAtom) ||
|
||||
(nsCSSAtoms::lastChildPseudo == aAtom) ||
|
||||
(nsCSSAtoms::lastNodePseudo == aAtom) ||
|
||||
(nsCSSAtoms::linkPseudo == aAtom) ||
|
||||
(nsCSSAtoms::outOfDatePseudo == aAtom) ||
|
||||
|
|
|
@ -2980,7 +2980,7 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
PRInt32 index = -1;
|
||||
do {
|
||||
parent->ChildAt(++index, firstChild);
|
||||
if (firstChild) { // skip text & comments (and whitespace for firstNode as well)
|
||||
if (firstChild) { // stop at first non-comment and non-whitespace node (and non-text node for firstChild)
|
||||
if (IsSignificantChild(firstChild, (nsCSSAtoms::firstNodePseudo == pseudoClass->mAtom))) {
|
||||
break;
|
||||
}
|
||||
|
@ -2994,7 +2994,8 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
result = PRBool(localTrue == (data.mContent == firstChild));
|
||||
NS_IF_RELEASE(firstChild);
|
||||
}
|
||||
else if (nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom) {
|
||||
else if ((nsCSSAtoms::lastChildPseudo == pseudoClass->mAtom) ||
|
||||
(nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom)) {
|
||||
nsIContent* lastChild = nsnull;
|
||||
nsIContent* parent = data.mParentContent;
|
||||
if (parent) {
|
||||
|
@ -3002,8 +3003,8 @@ static PRBool SelectorMatches(SelectorMatchesData &data,
|
|||
parent->ChildCount(index);
|
||||
do {
|
||||
parent->ChildAt(--index, lastChild);
|
||||
if (lastChild) { // skip whitespace text & comments
|
||||
if (IsSignificantChild(lastChild, PR_TRUE)) {
|
||||
if (lastChild) { // stop at first non-comment and non-whitespace node (and non-text node for lastChild)
|
||||
if (IsSignificantChild(lastChild, (nsCSSAtoms::lastNodePseudo == pseudoClass->mAtom))) {
|
||||
break;
|
||||
}
|
||||
NS_RELEASE(lastChild);
|
||||
|
|
Загрузка…
Ссылка в новой задаче