diff --git a/layout/base/nsCSSRendering.h b/layout/base/nsCSSRendering.h index daa3ddabf9c4..ce8f3c6a9ecb 100644 --- a/layout/base/nsCSSRendering.h +++ b/layout/base/nsCSSRendering.h @@ -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 { /** diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index da61ea3b52e8..0e6afcaecec4 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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. */ diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 2ff8fd051c53..65a06e2689d6 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -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 *aOutFrames) {} diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index ec3a2c2da9a4..bc08936a4406 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -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); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 9996081ebf47..80ae9219e467 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -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 + +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,