Created
April 29, 2013 00:41
-
-
Save thomaslee/5479054 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 9d8977cbbfc6 layout/base/nsCSSRendering.cpp | |
--- a/layout/base/nsCSSRendering.cpp Sat Apr 27 18:21:15 2013 -0400 | |
+++ b/layout/base/nsCSSRendering.cpp Sun Apr 28 17:37:59 2013 -0700 | |
@@ -756,17 +756,28 @@ | |
SN(); | |
} | |
-static nsRect | |
-GetOutlineInnerRect(nsIFrame* aFrame) | |
+nsRect | |
+nsCSSRendering::GetOutlineArea(nsIFrame* aFrame) | |
{ | |
- nsRect* savedOutlineInnerRect = static_cast<nsRect*> | |
- (aFrame->Properties().Get(nsIFrame::OutlineInnerRectProperty())); | |
- if (savedOutlineInnerRect) | |
- return *savedOutlineInnerRect; | |
- // FIXME (bug 599652): We probably want something narrower than either | |
- // overflow rect here, but for now use the visual overflow in order to | |
- // be consistent with ComputeOutlineAndEffectsRect in nsFrame.cpp. | |
- return aFrame->GetVisualOverflowRect(); | |
+ nsRect outlineArea(aFrame->GetRect()); | |
+ nsIFrame *currentFrame = aFrame->GetFirstPrincipalChild(); | |
+ while (currentFrame != NULL) { | |
+ // | |
+ // If the overflow area is the same as currentFrame's area, | |
+ // we know there's nothing in the descendants that's worth traversing. | |
+ // | |
+ const nsRect testRect(nsPoint(0, 0), currentFrame->GetSize()); | |
+ if (testRect == currentFrame->GetScrollableOverflowRect() || | |
+ testRect == currentFrame->GetVisualOverflowRect()) { | |
+ outlineArea.UnionRect(outlineArea, GetOutlineArea(currentFrame)); | |
+ } | |
+ else { | |
+ outlineArea.UnionRect(outlineArea, currentFrame->GetRect()); | |
+ } | |
+ | |
+ currentFrame = currentFrame->GetNextSibling(); | |
+ } | |
+ return outlineArea; | |
} | |
void | |
@@ -812,18 +823,17 @@ | |
frameForArea = frameForArea->GetFirstPrincipalChild(); | |
NS_ASSERTION(frameForArea, "anonymous block with no children?"); | |
} while (frameForArea); | |
- nsRect innerRect; // relative to aBorderArea.TopLeft() | |
+ | |
+ nsRect innerRect; | |
if (frameForArea == aForFrame) { | |
- innerRect = GetOutlineInnerRect(aForFrame); | |
+ innerRect = GetOutlineArea(aForFrame); | |
} else { | |
for (; frameForArea; frameForArea = frameForArea->GetNextSibling()) { | |
// The outline has already been included in aForFrame's overflow | |
// area, but not in those of its descendants, so we have to | |
// include it. Otherwise we'll end up drawing the outline inside | |
// the border. | |
- nsRect r(GetOutlineInnerRect(frameForArea) + | |
- frameForArea->GetOffsetTo(aForFrame)); | |
- innerRect.UnionRect(innerRect, r); | |
+ innerRect.UnionRect(innerRect, GetOutlineArea(frameForArea)); | |
} | |
} | |
diff -r 9d8977cbbfc6 layout/base/nsCSSRendering.h | |
--- a/layout/base/nsCSSRendering.h Sat Apr 27 18:21:15 2013 -0400 | |
+++ b/layout/base/nsCSSRendering.h Sun Apr 28 17:37:59 2013 -0700 | |
@@ -192,6 +192,12 @@ | |
/** | |
+ * Get the bounds describing the outline of an nsIFrame. | |
+ */ | |
+ static nsRect | |
+ GetOutlineArea(nsIFrame* aFrame); | |
+ | |
+ /** | |
* Render the outline for an element using css rendering rules | |
* for borders. aSkipSides is a bitmask of the sides to skip | |
* when rendering. If 0 then no sides are skipped. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment