Bug 563878. Part 1c. Misc layout cleanup. r=mats

(transplanted from 2c4a36b7e9ea2125b9daaab242202be4c34e46a5)

--HG--
extra : transplant_source : %2CJ6%B7%E9%EA%21%25%B9%DA%AA%B2B%20%2B%E4%C3NF%A5
This commit is contained in:
Timothy Nikkel 2010-06-05 15:29:49 -05:00
parent 91df098dd6
commit a0bea31596
5 changed files with 37 additions and 23 deletions

View File

@ -86,9 +86,6 @@ struct nsCSSRendering {
* Render the border 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.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
static void PaintBorder(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -116,9 +113,6 @@ struct nsCSSRendering {
* 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.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
static void PaintOutline(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -227,9 +221,6 @@ struct nsCSSRendering {
/**
* Render the background for an element using css rendering rules
* for backgrounds.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
enum {
/**

View File

@ -1348,7 +1348,7 @@ nsDisplayTransform::GetFrameBoundsForTransform(const nsIFrame* aFrame)
#endif
/* Returns the delta specified by the -moz-tranform-origin property.
/* Returns the delta specified by the -moz-transform-origin property.
* This is a positive delta, meaning that it indicates the direction to move
* to get from (0, 0) of the frame to the transform origin.
*/

View File

@ -521,12 +521,13 @@ public:
virtual Type GetType() { return TYPE_GENERIC; }
/**
* This is called after we've constructed a display list for event handling.
* When this is called, we've already ensured that aPt is in the item's bounds.
* When this is called, we've already ensured that aRect intersects the
* item's bounds.
*
* @param aState must point to a HitTestState. If you don't have one,
* just create one with the default constructor and pass it in.
* @return the frame that the point is considered over, or nsnull if
* this is not over any frame
* @param aOutFrames each item appends the frame(s) in this display item that
* the rect is considered over (if any) to aOutFrames.
*/
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {}

View File

@ -916,9 +916,7 @@ public:
* Gets the closest frame (the frame passed in or one of its parents) that
* qualifies as a "layer"; used in DOM0 methods that depends upon that
* definition. This is the nearest frame that is either positioned or scrolled
* (the child of a scroll frame). In Gecko terms, it's approximately
* equivalent to having a view, at least for simple HTML. However, views are
* going away, so this is a cleaner definition.
* (the child of a scroll frame).
*/
static nsIFrame* GetClosestLayer(nsIFrame* aFrame);

View File

@ -3649,8 +3649,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
nsPoint offset(0,0);
if (mPresContext->IsScreen()) {
// Get the widget to create the rendering context for and calculate
// the offset from the frame to it. (Calculating the offset is important
// if the frame isn't the root frame.)
// the offset from the frame to it.
nsPoint viewOffset;
nsIView* view = aFrame->GetClosestView(&viewOffset);
nsPoint widgetOffset;
@ -5391,11 +5390,16 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
itemToInsert = new (aBuilder)nsDisplayClip(frame, frame, i, textRect);
}
}
else {
// Don't try to descend into subdocuments.
// If this ever changes we'd need to add handling for subdocuments with
// different zoom levels.
else if (content->GetCurrentDoc() ==
aRange->GetStartParent()->GetCurrentDoc()) {
// if the node is within the range, append it to the temporary list
PRBool before, after;
nsRange::CompareNodeToRange(content, aRange, &before, &after);
if (!before && !after) {
nsresult rv =
nsRange::CompareNodeToRange(content, aRange, &before, &after);
if (NS_SUCCEEDED(rv) && !before && !after) {
itemToInsert = i;
surfaceRect.UnionRect(surfaceRect, i->GetBounds(aBuilder));
}
@ -5425,6 +5429,12 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
return surfaceRect;
}
#ifdef DEBUG
#include <stdio.h>
static PRBool gDumpRangePaintList = PR_FALSE;
#endif
RangePaintInfo*
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect)
@ -5482,8 +5492,22 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
ancestorRect, &info->mList);
info->mBuilder.LeavePresShell(ancestorFrame, ancestorRect);
#ifdef DEBUG
if (gDumpRangePaintList) {
fprintf(stderr, "CreateRangePaintInfo --- before ClipListToRange:\n");
nsFrame::PrintDisplayList(&(info->mBuilder), info->mList);
}
#endif
nsRect rangeRect = ClipListToRange(&info->mBuilder, &info->mList, range);
#ifdef DEBUG
if (gDumpRangePaintList) {
fprintf(stderr, "CreateRangePaintInfo --- after ClipListToRange:\n");
nsFrame::PrintDisplayList(&(info->mBuilder), info->mList);
}
#endif
// determine the offset of the reference frame for the display list
// to the root frame. This will allow the coordinates used when painting
// to all be offset from the same point
@ -5658,8 +5682,8 @@ PresShell::RenderNode(nsIDOMNode* aNode,
return nsnull;
// move the region so that it is offset from the topleft corner of the surface
aRegion->MoveBy(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)),
-rrectPixels.y + (rrectPixels.y - pc->AppUnitsToDevPixels(area.y)));
aRegion->MoveBy(-pc->AppUnitsToDevPixels(area.x),
-pc->AppUnitsToDevPixels(area.y));
}
return PaintRangePaintInfo(&rangeItems, nsnull, aRegion, area, aPoint,