From fd1f07fa3a1ab5df43d5d3d105d262e740119aa3 Mon Sep 17 00:00:00 2001 From: "kin%netscape.com" Date: Wed, 21 Nov 2001 14:24:59 +0000 Subject: [PATCH] Fix for bug #71979:

inside link displays additional hr upon each mouseover Modified FindFrameWithContent() to skip over sibling :before pseudo frames when looking for the primary frame for non-splittable-element aContent. r=dbaron@fas.harvard.edu sr=waterson@netscape.com git-svn-id: svn://10.0.0.236/trunk@108697 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/base/nsCSSFrameConstructor.cpp | 23 +++++++++++++++++++ .../html/style/src/nsCSSFrameConstructor.cpp | 23 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index c9a00e5b3d8..73b31fd6a9f 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -11154,6 +11154,29 @@ keepLooking: // Ignore the placeholder and return the out-of-flow frame instead return ((nsPlaceholderFrame*)kidFrame)->GetOutOfFlowFrame(); } else { + // Check if kidframe is the :before pseudo frame for aContent. If it + // is, and aContent is an element, then aContent might be a + // non-splittable-element, so the real primary frame could be the + // next sibling. + + if (aContent->IsContentOfType(nsIContent::eELEMENT) && + IsGeneratedContentFor(aContent, kidFrame, nsCSSAtoms::beforePseudo)) { + nsIFrame *nextSibling = nsnull; + + kidFrame->GetNextSibling(&nextSibling); + if (nextSibling) { + nsCOMPtr nextSiblingContent; + nextSibling->GetContent(getter_AddRefs(nextSiblingContent)); + + // Make sure the content matches, and because I'm paranoid, + // make sure it's not the :after pseudo frame. + + if (nextSiblingContent.get() == aContent && + !IsGeneratedContentFor(aContent, nextSibling, nsCSSAtoms::afterPseudo)) + kidFrame = nextSibling; + } + } + // Return the matching child frame return kidFrame; } diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index c9a00e5b3d8..73b31fd6a9f 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -11154,6 +11154,29 @@ keepLooking: // Ignore the placeholder and return the out-of-flow frame instead return ((nsPlaceholderFrame*)kidFrame)->GetOutOfFlowFrame(); } else { + // Check if kidframe is the :before pseudo frame for aContent. If it + // is, and aContent is an element, then aContent might be a + // non-splittable-element, so the real primary frame could be the + // next sibling. + + if (aContent->IsContentOfType(nsIContent::eELEMENT) && + IsGeneratedContentFor(aContent, kidFrame, nsCSSAtoms::beforePseudo)) { + nsIFrame *nextSibling = nsnull; + + kidFrame->GetNextSibling(&nextSibling); + if (nextSibling) { + nsCOMPtr nextSiblingContent; + nextSibling->GetContent(getter_AddRefs(nextSiblingContent)); + + // Make sure the content matches, and because I'm paranoid, + // make sure it's not the :after pseudo frame. + + if (nextSiblingContent.get() == aContent && + !IsGeneratedContentFor(aContent, nextSibling, nsCSSAtoms::afterPseudo)) + kidFrame = nextSibling; + } + } + // Return the matching child frame return kidFrame; }