1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 /* rendering object that goes directly inside the document's scrollbars */
40 #include "nsCanvasFrame.h"
41 #include "nsIServiceManager.h"
42 #include "nsHTMLParts.h"
43 #include "nsHTMLContainerFrame.h"
44 #include "nsCSSRendering.h"
45 #include "nsPresContext.h"
46 #include "nsStyleContext.h"
47 #include "nsIRenderingContext.h"
48 #include "nsGUIEvent.h"
49 #include "nsStyleConsts.h"
50 #include "nsGkAtoms.h"
51 #include "nsIEventStateManager.h"
52 #include "nsIDeviceContext.h"
53 #include "nsIPresShell.h"
54 #include "nsIScrollPositionListener.h"
55 #include "nsDisplayList.h"
56 #include "nsAbsoluteContainingBlock.h"
57 #include "nsCSSFrameConstructor.h"
58 #include "nsFrameManager.h"
61 #include "nsIDOMWindowInternal.h"
62 #include "nsIScrollableFrame.h"
63 #include "nsIDocShell.h"
66 //#define DEBUG_CANVAS_FOCUS
69 #define CANVAS_ABS_POS_CHILD_LIST NS_CONTAINER_LIST_COUNT_INCL_OC
73 NS_NewCanvasFrame(nsIPresShell
* aPresShell
, nsStyleContext
* aContext
)
75 return new (aPresShell
) nsCanvasFrame(aContext
);
78 NS_IMPL_FRAMEARENA_HELPERS(nsCanvasFrame
)
80 NS_QUERYFRAME_HEAD(nsCanvasFrame
)
81 NS_QUERYFRAME_ENTRY(nsCanvasFrame
)
82 NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame
)
85 nsCanvasFrame::DestroyFrom(nsIFrame
* aDestructRoot
)
87 mAbsoluteContainer
.DestroyFrames(this, aDestructRoot
);
89 nsIScrollableFrame
* sf
=
90 PresContext()->GetPresShell()->GetRootScrollFrameAsScrollable();
92 sf
->RemoveScrollPositionListener(this);
95 nsHTMLContainerFrame::DestroyFrom(aDestructRoot
);
99 nsCanvasFrame::ScrollPositionWillChange(nscoord aX
, nscoord aY
)
102 mDoPaintFocus
= PR_FALSE
;
103 PresContext()->FrameManager()->GetRootFrame()->InvalidateOverflowRect();
108 nsCanvasFrame::SetHasFocus(PRBool aHasFocus
)
110 if (mDoPaintFocus
!= aHasFocus
) {
111 mDoPaintFocus
= aHasFocus
;
112 PresContext()->FrameManager()->GetRootFrame()->InvalidateOverflowRect();
114 if (!mAddedScrollPositionListener
) {
115 nsIScrollableFrame
* sf
=
116 PresContext()->GetPresShell()->GetRootScrollFrameAsScrollable();
118 sf
->AddScrollPositionListener(this);
119 mAddedScrollPositionListener
= PR_TRUE
;
127 nsCanvasFrame::SetInitialChildList(nsIAtom
* aListName
,
128 nsFrameList
& aChildList
)
130 if (nsGkAtoms::absoluteList
== aListName
)
131 return mAbsoluteContainer
.SetInitialChildList(this, aListName
, aChildList
);
133 NS_ASSERTION(aListName
|| aChildList
.IsEmpty() || aChildList
.OnlyChild(),
134 "Primary child list can have at most one frame in it");
135 return nsHTMLContainerFrame::SetInitialChildList(aListName
, aChildList
);
139 nsCanvasFrame::AppendFrames(nsIAtom
* aListName
,
140 nsFrameList
& aFrameList
)
142 if (nsGkAtoms::absoluteList
== aListName
)
143 return mAbsoluteContainer
.AppendFrames(this, aListName
, aFrameList
);
145 NS_ASSERTION(!aListName
, "unexpected child list name");
146 NS_PRECONDITION(mFrames
.IsEmpty(), "already have a child frame");
148 // We only support unnamed principal child list
149 return NS_ERROR_INVALID_ARG
;
152 if (!mFrames
.IsEmpty()) {
153 // We only allow a single child frame
154 return NS_ERROR_INVALID_ARG
;
157 // Insert the new frames
158 NS_ASSERTION(aFrameList
.FirstChild() == aFrameList
.LastChild(),
159 "Only one principal child frame allowed");
161 nsFrame::VerifyDirtyBitSet(aFrameList
);
163 mFrames
.AppendFrames(nsnull
, aFrameList
);
165 PresContext()->PresShell()->
166 FrameNeedsReflow(this, nsIPresShell::eTreeChange
,
167 NS_FRAME_HAS_DIRTY_CHILDREN
);
173 nsCanvasFrame::InsertFrames(nsIAtom
* aListName
,
174 nsIFrame
* aPrevFrame
,
175 nsFrameList
& aFrameList
)
177 if (nsGkAtoms::absoluteList
== aListName
)
178 return mAbsoluteContainer
.InsertFrames(this, aListName
, aPrevFrame
, aFrameList
);
180 // Because we only support a single child frame inserting is the same
182 NS_PRECONDITION(!aPrevFrame
, "unexpected previous sibling frame");
184 return NS_ERROR_UNEXPECTED
;
186 return AppendFrames(aListName
, aFrameList
);
190 nsCanvasFrame::RemoveFrame(nsIAtom
* aListName
,
193 if (nsGkAtoms::absoluteList
== aListName
) {
194 mAbsoluteContainer
.RemoveFrame(this, aListName
, aOldFrame
);
198 NS_ASSERTION(!aListName
, "unexpected child list name");
200 // We only support the unnamed principal child list
201 return NS_ERROR_INVALID_ARG
;
204 if (aOldFrame
!= mFrames
.FirstChild())
205 return NS_ERROR_FAILURE
;
207 // It's our one and only child frame
208 // Damage the area occupied by the deleted frame
209 // The child of the canvas probably can't have an outline, but why bother
210 // thinking about that?
211 Invalidate(aOldFrame
->GetOverflowRect() + aOldFrame
->GetPosition());
213 // Remove the frame and destroy it
214 mFrames
.DestroyFrame(aOldFrame
);
216 PresContext()->PresShell()->
217 FrameNeedsReflow(this, nsIPresShell::eTreeChange
,
218 NS_FRAME_HAS_DIRTY_CHILDREN
);
223 nsCanvasFrame::GetAdditionalChildListName(PRInt32 aIndex
) const
225 if (CANVAS_ABS_POS_CHILD_LIST
== aIndex
)
226 return nsGkAtoms::absoluteList
;
228 return nsHTMLContainerFrame::GetAdditionalChildListName(aIndex
);
232 nsCanvasFrame::GetChildList(nsIAtom
* aListName
) const
234 if (nsGkAtoms::absoluteList
== aListName
)
235 return mAbsoluteContainer
.GetChildList();
237 return nsHTMLContainerFrame::GetChildList(aListName
);
240 nsRect
nsCanvasFrame::CanvasArea() const
242 nsRect
result(GetOverflowRect());
244 nsIScrollableFrame
*scrollableFrame
= do_QueryFrame(GetParent());
245 if (scrollableFrame
) {
246 nsRect portRect
= scrollableFrame
->GetScrollPortRect();
247 result
.UnionRect(result
, nsRect(nsPoint(0, 0), portRect
.Size()));
253 nsDisplayCanvasBackground::Paint(nsDisplayListBuilder
* aBuilder
,
254 nsIRenderingContext
* aCtx
)
256 nsCanvasFrame
* frame
= static_cast<nsCanvasFrame
*>(mFrame
);
257 nsPoint offset
= ToReferenceFrame();
258 nsRect bgClipRect
= frame
->CanvasArea() + offset
;
260 if (NS_GET_A(mExtraBackgroundColor
) > 0) {
261 aCtx
->SetColor(mExtraBackgroundColor
);
262 aCtx
->FillRect(bgClipRect
);
265 nsCSSRendering::PaintBackground(mFrame
->PresContext(), *aCtx
, mFrame
,
267 nsRect(offset
, mFrame
->GetSize()),
268 aBuilder
->GetBackgroundPaintFlags(),
273 * A display item to paint the focus ring for the document.
275 * The only reason this can't use nsDisplayGeneric is overriding GetBounds.
277 class nsDisplayCanvasFocus
: public nsDisplayItem
{
279 nsDisplayCanvasFocus(nsDisplayListBuilder
* aBuilder
, nsCanvasFrame
*aFrame
)
280 : nsDisplayItem(aBuilder
, aFrame
)
282 MOZ_COUNT_CTOR(nsDisplayCanvasFocus
);
284 virtual ~nsDisplayCanvasFocus() {
285 MOZ_COUNT_DTOR(nsDisplayCanvasFocus
);
288 virtual nsRect
GetBounds(nsDisplayListBuilder
* aBuilder
)
290 // This is an overestimate, but that's not a problem.
291 nsCanvasFrame
* frame
= static_cast<nsCanvasFrame
*>(mFrame
);
292 return frame
->CanvasArea() + ToReferenceFrame();
295 virtual void Paint(nsDisplayListBuilder
* aBuilder
,
296 nsIRenderingContext
* aCtx
)
298 nsCanvasFrame
* frame
= static_cast<nsCanvasFrame
*>(mFrame
);
299 frame
->PaintFocus(*aCtx
, ToReferenceFrame());
302 NS_DISPLAY_DECL_NAME("CanvasFocus", TYPE_CANVAS_FOCUS
)
306 nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
307 const nsRect
& aDirtyRect
,
308 const nsDisplayListSet
& aLists
)
312 if (GetPrevInFlow()) {
313 DisplayOverflowContainers(aBuilder
, aDirtyRect
, aLists
);
316 aBuilder
->MarkFramesForDisplayList(this, mAbsoluteContainer
.GetChildList(),
319 // Force a background to be shown. We may have a background propagated to us,
320 // in which case GetStyleBackground wouldn't have the right background
321 // and the code in nsFrame::DisplayBorderBackgroundOutline might not give us
323 // We don't have any border or outline, and our background draws over
324 // the overflow area, so just add nsDisplayCanvasBackground instead of
325 // calling DisplayBorderBackgroundOutline.
326 if (IsVisibleForPainting(aBuilder
)) {
327 rv
= aLists
.BorderBackground()->AppendNewToTop(new (aBuilder
)
328 nsDisplayCanvasBackground(aBuilder
, this));
329 NS_ENSURE_SUCCESS(rv
, rv
);
333 for (kid
= GetFirstChild(nsnull
); kid
; kid
= kid
->GetNextSibling()) {
334 // Put our child into its own pseudo-stack.
335 rv
= BuildDisplayListForChild(aBuilder
, kid
, aDirtyRect
, aLists
);
336 NS_ENSURE_SUCCESS(rv
, rv
);
339 #ifdef DEBUG_CANVAS_FOCUS
340 nsCOMPtr
<nsIContent
> focusContent
;
341 aPresContext
->EventStateManager()->
342 GetFocusedContent(getter_AddRefs(focusContent
));
344 PRBool hasFocus
= PR_FALSE
;
345 nsCOMPtr
<nsISupports
> container
;
346 aPresContext
->GetContainer(getter_AddRefs(container
));
347 nsCOMPtr
<nsIDocShell
> docShell(do_QueryInterface(container
));
349 docShell
->GetHasFocus(&hasFocus
);
350 printf("%p - nsCanvasFrame::Paint R:%d,%d,%d,%d DR: %d,%d,%d,%d\n", this,
351 mRect
.x
, mRect
.y
, mRect
.width
, mRect
.height
,
352 aDirtyRect
.x
, aDirtyRect
.y
, aDirtyRect
.width
, aDirtyRect
.height
);
354 printf("%p - Focus: %s c: %p DoPaint:%s\n", docShell
.get(), hasFocus
?"Y":"N",
355 focusContent
.get(), mDoPaintFocus
?"Y":"N");
360 // Only paint the focus if we're visible
361 if (!GetStyleVisibility()->IsVisible())
364 return aLists
.Outlines()->AppendNewToTop(new (aBuilder
)
365 nsDisplayCanvasFocus(aBuilder
, this));
369 nsCanvasFrame::PaintFocus(nsIRenderingContext
& aRenderingContext
, nsPoint aPt
)
371 nsRect
focusRect(aPt
, GetSize());
373 nsIScrollableFrame
*scrollableFrame
= do_QueryFrame(GetParent());
374 if (scrollableFrame
) {
375 nsRect portRect
= scrollableFrame
->GetScrollPortRect();
376 focusRect
.width
= portRect
.width
;
377 focusRect
.height
= portRect
.height
;
378 focusRect
.MoveBy(scrollableFrame
->GetScrollPosition());
381 // XXX use the root frame foreground color, but should we find BODY frame
382 // for HTML documents?
383 nsIFrame
* root
= mFrames
.FirstChild();
384 const nsStyleColor
* color
=
385 root
? root
->GetStyleContext()->GetStyleColor() :
386 mStyleContext
->GetStyleColor();
388 NS_ERROR("current color cannot be found");
392 nsCSSRendering::PaintFocus(PresContext(), aRenderingContext
,
393 focusRect
, color
->mColor
);
396 /* virtual */ nscoord
397 nsCanvasFrame::GetMinWidth(nsIRenderingContext
*aRenderingContext
)
400 DISPLAY_MIN_WIDTH(this, result
);
401 if (mFrames
.IsEmpty())
404 result
= mFrames
.FirstChild()->GetMinWidth(aRenderingContext
);
408 /* virtual */ nscoord
409 nsCanvasFrame::GetPrefWidth(nsIRenderingContext
*aRenderingContext
)
412 DISPLAY_PREF_WIDTH(this, result
);
413 if (mFrames
.IsEmpty())
416 result
= mFrames
.FirstChild()->GetPrefWidth(aRenderingContext
);
421 nsCanvasFrame::Reflow(nsPresContext
* aPresContext
,
422 nsHTMLReflowMetrics
& aDesiredSize
,
423 const nsHTMLReflowState
& aReflowState
,
424 nsReflowStatus
& aStatus
)
426 DO_GLOBAL_REFLOW_COUNT("nsCanvasFrame");
427 DISPLAY_REFLOW(aPresContext
, this, aReflowState
, aDesiredSize
, aStatus
);
428 NS_FRAME_TRACE_REFLOW_IN("nsCanvasFrame::Reflow");
430 // Initialize OUT parameter
431 aStatus
= NS_FRAME_COMPLETE
;
433 nsCanvasFrame
* prevCanvasFrame
= static_cast<nsCanvasFrame
*>
435 if (prevCanvasFrame
) {
436 nsAutoPtr
<nsFrameList
> overflow(prevCanvasFrame
->StealOverflowFrames());
438 NS_ASSERTION(overflow
->OnlyChild(),
439 "must have doc root as canvas frame's only child");
440 nsHTMLContainerFrame::ReparentFrameViewList(aPresContext
, *overflow
,
441 prevCanvasFrame
, this);
442 // Prepend overflow to the our child list. There may already be
443 // children placeholders for fixed-pos elements, which don't get
444 // reflowed but must not be lost until the canvas frame is destroyed.
445 mFrames
.InsertFrames(this, nsnull
, *overflow
);
449 // Set our size up front, since some parts of reflow depend on it
450 // being already set. Note that the computed height may be
451 // unconstrained; that's ok. Consumers should watch out for that.
452 SetSize(nsSize(aReflowState
.ComputedWidth(), aReflowState
.ComputedHeight()));
454 // Reflow our one and only normal child frame. It's either the root
455 // element's frame or a placeholder for that frame, if the root element
456 // is abs-pos or fixed-pos. We may have additional children which
457 // are placeholders for continuations of fixed-pos content, but those
458 // don't need to be reflowed. The normal child is always comes before
459 // the fixed-pos placeholders, because we insert it at the start
460 // of the child list, above.
461 nsHTMLReflowMetrics kidDesiredSize
;
462 if (mFrames
.IsEmpty()) {
463 // We have no child frame, so return an empty size
464 aDesiredSize
.width
= aDesiredSize
.height
= 0;
466 nsIFrame
* kidFrame
= mFrames
.FirstChild();
467 nsRect oldKidRect
= kidFrame
->GetRect();
468 PRBool kidDirty
= (kidFrame
->GetStateBits() & NS_FRAME_IS_DIRTY
) != 0;
470 nsHTMLReflowState
kidReflowState(aPresContext
, aReflowState
, kidFrame
,
471 nsSize(aReflowState
.availableWidth
,
472 aReflowState
.availableHeight
));
474 if (aReflowState
.mFlags
.mVResize
&&
475 (kidFrame
->GetStateBits() & NS_FRAME_CONTAINS_RELATIVE_HEIGHT
)) {
476 // Tell our kid it's being vertically resized too. Bit of a
477 // hack for framesets.
478 kidReflowState
.mFlags
.mVResize
= PR_TRUE
;
481 nsPoint
kidPt(kidReflowState
.mComputedMargin
.left
,
482 kidReflowState
.mComputedMargin
.top
);
483 // Apply CSS relative positioning
484 const nsStyleDisplay
* styleDisp
= kidFrame
->GetStyleDisplay();
485 if (NS_STYLE_POSITION_RELATIVE
== styleDisp
->mPosition
) {
486 kidPt
+= nsPoint(kidReflowState
.mComputedOffsets
.left
,
487 kidReflowState
.mComputedOffsets
.top
);
491 ReflowChild(kidFrame
, aPresContext
, kidDesiredSize
, kidReflowState
,
492 kidPt
.x
, kidPt
.y
, 0, aStatus
);
494 // Complete the reflow and position and size the child frame
495 FinishReflowChild(kidFrame
, aPresContext
, &kidReflowState
, kidDesiredSize
,
496 kidPt
.x
, kidPt
.y
, 0);
498 if (!NS_FRAME_IS_FULLY_COMPLETE(aStatus
)) {
499 nsIFrame
* nextFrame
= kidFrame
->GetNextInFlow();
500 NS_ASSERTION(nextFrame
|| aStatus
& NS_FRAME_REFLOW_NEXTINFLOW
,
501 "If it's incomplete and has no nif yet, it must flag a nif reflow.");
503 nsresult rv
= aPresContext
->PresShell()->FrameConstructor()->
504 CreateContinuingFrame(aPresContext
, kidFrame
, this, &nextFrame
);
505 NS_ENSURE_SUCCESS(rv
, rv
);
506 SetOverflowFrames(aPresContext
, nsFrameList(nextFrame
, nextFrame
));
507 // Root overflow containers will be normal children of
508 // the canvas frame, but that's ok because there
509 // aren't any other frames we need to isolate them from
512 if (NS_FRAME_OVERFLOW_IS_INCOMPLETE(aStatus
)) {
513 nextFrame
->AddStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER
);
517 // If the child frame was just inserted, then we're responsible for making sure
520 // But we have a new child, which will affect our background, so
521 // invalidate our whole rect.
522 // Note: Even though we request to be sized to our child's size, our
523 // scroll frame ensures that we are always the size of the viewport.
524 // Also note: GetPosition() on a CanvasFrame is always going to return
525 // (0, 0). We only want to invalidate GetRect() since GetOverflowRect()
526 // could also include overflow to our top and left (out of the viewport)
527 // which doesn't need to be painted.
528 nsIFrame
* viewport
= PresContext()->GetPresShell()->GetRootFrame();
529 viewport
->Invalidate(nsRect(nsPoint(0, 0), viewport
->GetSize()));
531 nsRect newKidRect
= kidFrame
->GetRect();
532 if (newKidRect
.TopLeft() == oldKidRect
.TopLeft()) {
533 InvalidateRectDifference(oldKidRect
, kidFrame
->GetRect());
535 Invalidate(oldKidRect
);
536 Invalidate(newKidRect
);
540 // Return our desired size. Normally it's what we're told, but
541 // sometimes we can be given an unconstrained height (when a window
542 // is sizing-to-content), and we should compute our desired height.
543 aDesiredSize
.width
= aReflowState
.ComputedWidth();
544 if (aReflowState
.ComputedHeight() == NS_UNCONSTRAINEDSIZE
) {
545 aDesiredSize
.height
= kidFrame
->GetRect().height
+
546 kidReflowState
.mComputedMargin
.TopBottom();
548 aDesiredSize
.height
= aReflowState
.ComputedHeight();
551 aDesiredSize
.mOverflowArea
.UnionRect(
552 nsRect(0, 0, aDesiredSize
.width
, aDesiredSize
.height
),
553 kidDesiredSize
.mOverflowArea
+ kidPt
);
555 if (mAbsoluteContainer
.HasAbsoluteFrames()) {
556 PRBool widthChanged
= aDesiredSize
.width
!= mRect
.width
;
557 PRBool heightChanged
= aDesiredSize
.height
!= mRect
.height
;
559 mAbsoluteContainer
.Reflow(this, aPresContext
, aReflowState
, aStatus
,
560 aDesiredSize
.width
, aDesiredSize
.height
,
561 PR_TRUE
, widthChanged
, heightChanged
,
563 aDesiredSize
.mOverflowArea
.UnionRect(aDesiredSize
.mOverflowArea
, absPosBounds
);
566 // Handle invalidating fixed-attachment backgrounds propagated to the
567 // canvas when the canvas size (and therefore the background positioning
568 // area's size) changes. Such backgrounds are not invalidated in the
569 // normal manner because the size of the original frame for that background
570 // may not have changed.
572 // This isn't the right fix for this issue, taken more generally. In
573 // particular, this doesn't handle fixed-attachment backgrounds that are *not*
574 // propagated. If a layer with the characteristics tested for below exists
575 // in a non-propagated background, we should invalidate the "corresponding"
576 // frame (which subsumes this special case if defined broadly). For now,
577 // however, this addresses the most common case. Given that this behavior has
578 // long been broken (non-zero percent background-size may be a new instance,
579 // but non-zero percent background-position is longstanding), we defer a
580 // fully correct fix until later.
581 if (nsSize(aDesiredSize
.width
, aDesiredSize
.height
) != GetSize()) {
582 nsIFrame
* rootElementFrame
=
583 aPresContext
->PresShell()->FrameConstructor()->GetRootElementStyleFrame();
584 nsStyleContext
* bgSC
=
585 nsCSSRendering::FindCanvasBackground(this, rootElementFrame
);
586 const nsStyleBackground
* bg
= bgSC
->GetStyleBackground();
587 if (!bg
->IsTransparent()) {
588 NS_FOR_VISIBLE_BACKGROUND_LAYERS_BACK_TO_FRONT(i
, bg
) {
589 const nsStyleBackground::Layer
& layer
= bg
->mLayers
[i
];
590 if (layer
.mAttachment
== NS_STYLE_BG_ATTACHMENT_FIXED
&&
591 layer
.RenderingMightDependOnFrameSize()) {
592 Invalidate(nsRect(nsPoint(0, 0), GetSize()));
600 if (prevCanvasFrame
) {
601 ReflowOverflowContainerChildren(aPresContext
, aReflowState
,
602 aDesiredSize
.mOverflowArea
, 0,
606 FinishAndStoreOverflow(&aDesiredSize
);
608 NS_FRAME_TRACE_REFLOW_OUT("nsCanvasFrame::Reflow", aStatus
);
609 NS_FRAME_SET_TRUNCATION(aStatus
, aReflowState
, aDesiredSize
);
614 nsCanvasFrame::GetSkipSides() const
620 nsCanvasFrame::GetType() const
622 return nsGkAtoms::canvasFrame
;
626 nsCanvasFrame::GetContentForEvent(nsPresContext
* aPresContext
,
628 nsIContent
** aContent
)
630 NS_ENSURE_ARG_POINTER(aContent
);
631 nsresult rv
= nsFrame::GetContentForEvent(aPresContext
,
634 if (NS_FAILED(rv
) || !*aContent
) {
635 nsIFrame
* kid
= mFrames
.FirstChild();
637 rv
= kid
->GetContentForEvent(aPresContext
,
648 nsCanvasFrame::GetFrameName(nsAString
& aResult
) const
650 return MakeFrameName(NS_LITERAL_STRING("Canvas"), aResult
);