Closed Bug 1657515 Opened 4 years ago Closed 4 years ago

Add nsIWebBrowserPrint.printPreviewCurrentPageNumber

Categories

(Core :: Printing: Setup, task, P2)

task

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: jwatt, Assigned: hiro)

References

(Blocks 1 open bug)

Details

(Whiteboard: [print2020_v81])

Attachments

(4 files, 1 obsolete file)

We currently have nsIWebBrowserPrint.printPreviewScrollToPage to allow the frontend to implement UI to allow the user to jump (scroll) to a specific page (sheet). However, if the user scrolls with the mouse wheel, say, the frontend has no way to know which page is currently being displayed.

The new tab-modal print UI should display the current page number to the user to help them locate where they are in document, but currently there is no way for the frontend code to determine the information that it needs. We should provide this information to the frontend code.

The most obvious solution seem to be to add an nsIWebBrowserPrint.printPreviewCurrentPageNumber attribute.

I guess if we're adding a printPreviewCurrentPageNumber attribute, then at that point it might make sense to make the attribute mutable, and to remove printPreviewScrollToPage. The navigation constants that are passed to that function aren't really necessary. We could have:

printPreviewCurrentPageNumber -= 1  # instead of PRINTPREVIEW_PREV_PAGE
printPreviewCurrentPageNumber += 1  # instead of PRINTPREVIEW_NEXT_PAGE
printPreviewCurrentPageNumber  = 0  # instead of PRINTPREVIEW_HOME
printPreviewCurrentPageNumber = -1  # (or =printPreviewNumPages) instead of PRINTPREVIEW_END

As long as we support that functionality, we could do the actual removal of printPreviewScrollToPage later in a separate bug once the frontend has been switched over.

Regarding the criteria for what constitutes the "current page", I would guess it makes sense to make it whichever PrintedSheetFrame intersects (or is closest to) the top edge of the viewport.

Status: NEW → ASSIGNED

Okay, I am going to simply add the "current page" as an initial step.
If there is an on-going asyncronous scrolling happening, the number wouldn't match the visually showing page, that would be OK?

CCing mstriemer, if you have any concerns please let me know.

Since bug 1652278, it's not a page frame.

Depends on D86147

I am going to use it for printPreviewCurrentPageNumber function.

Depends on D86149

Attachment #9168379 - Attachment is obsolete: true
Pushed by hikezoe.birchill@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3d6e70da931e
Rename `pt` to `currentScrollPosition` in PrintPreviewScrollToPage. r=jwatt
https://hg.mozilla.org/integration/autoland/rev/961b5198a1ea
Rename `pageFrame` to `sheetFrame` in PrintPreviewScrollToPage. r=TYLin
https://hg.mozilla.org/integration/autoland/rev/007497d442be
Constify some nsIDocumentViewerPrint methods. r=jwatt
https://hg.mozilla.org/integration/autoland/rev/9eb50000762d
Add nsIWebBrowserPrint.printPreviewCurrentPageNumber. r=emilio
Pushed by malexandru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/35c4666eb742
Fix bustages regarding nsDocumentViewer.cpp and 'pageCount'. a=bustage-fix
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: