Closed Bug 369146 Opened 19 years ago Closed 19 years ago

nsCanvasRenderingContext2D::DrawWindow should flush layout on child frames

Categories

(Core :: Graphics: Canvas2D, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dbaron, Assigned: dbaron)

Details

(Whiteboard: [patch])

Attachments

(2 files, 1 obsolete file)

A possible cause for the reftest failure in bug 1156 comment 78 is that nsCanvasRenderingContext2D::DrawWindow does not flush layout on subframes. I haven't been able to get the failure to happen again, though, so I can't really be sure.
Attached patch possible patch (obsolete) — Splinter Review
I'm not sure how much error handling and null-checking I need to do when using the doc shell API.
Comment on attachment 253802 [details] [diff] [review] possible patch >diff -r 77cf62b10152 content/canvas/src/nsCanvasRenderingContext2D.cpp >+ if (domDoc) { >+ nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc); Don't really need to null-check |domDoc|, since do_QI is null-safe. >+ nsCOMPtr<nsIDocShellTreeNode> node = >+ do_QueryInterface(piWin->GetDocShell()); Do need to null-check |node| here, though. If the flush tore down an ancestor nsSubDocumentFrame and it was a <xul:iframe> or <xul:browser>, the window won't have a docshell. >+ if (shell) { >+ nsCOMPtr<nsIDOMWindow> win = do_GetInterface(shell); do_GetInterface is also null-safe. And the other null-checks I think you do need.
Attachment #253802 - Flags: superreview+
Attachment #253802 - Flags: review?(bzbarsky)
Attachment #253802 - Flags: review+
I should note that because FlushPendingNotifications flushes parents this is sorta O(N^2) in docshell tree depth. But the tree never gets all that deep, hopefully.... If we care about that, we should only flush on docshells which have no kids we flushed on.
Assignee: nobody → dbaron
Attachment #253802 - Attachment is obsolete: true
Status: NEW → ASSIGNED
OS: Linux → All
Hardware: PC → All
Whiteboard: [patch]
Checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attached patch TestcaseSplinter Review
If you happen to have a tree from before this change, does this testcase fail?
Attachment #253831 - Flags: review?(dbaron)
Comment on attachment 253831 [details] [diff] [review] Testcase I don't have a tree from before the change; probably the easiest way to get one is to comment out the bottom part of FlushLayoutToTree that makes the recursive calls. It would be good to double-check that the testcase fails pre-patch (could you comment on the bug if you do?), but probably good to get it checked in either way.
Attachment #253831 - Flags: review?(dbaron) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: