diff options
author | vitalybuka <vitalybuka@chromium.org> | 2015-08-04 16:19:02 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-04 23:20:47 +0000 |
commit | 0bb69c7f9ab18c6e79dd607ee6ab405231964dac (patch) | |
tree | 40b05aa3555cb0d35a95170992fdb7347d85c174 | |
parent | 2bcebfbff86ffc73ee01f58a67e15541ffa4a150 (diff) | |
download | chromium_src-0bb69c7f9ab18c6e79dd607ee6ab405231964dac.zip chromium_src-0bb69c7f9ab18c6e79dd607ee6ab405231964dac.tar.gz chromium_src-0bb69c7f9ab18c6e79dd607ee6ab405231964dac.tar.bz2 |
Revert of Add a scroll offset to PDF documents to account for the top material design toolbar. (patchset #7 id:120001 of https://codereview.chromium.org/1255403002/ )
Reason for revert:
This patch breaks print preview.
BUG=516829
Original issue's description:
> Add a scroll offset to PDF documents to account for the top material design toolbar.
>
> Previously the toolbar in the material design PDF UI would always cover the top
> of pages when it was first loaded or when a page was navigated to using the
> page selector. Now we ensure that a blank region is left at the very top of
> the document when it is first loaded. This is the region that the toolbar
> covers, so the document is not obscured at all. When pages are navigated to, we
> ensure that the top of the selected page is always underneath the toolbar
> so that it is not obscured. The one exception to this is when in fit-to-page
> mode which causes the page to be zoomed to cover the entire screen, ignoring
> the toolbar. This is so that users can take advantaging of filling all of the
> screen real-estate with a page when that is what they want.
>
> This is implemented by initially scrolling the document to a negative offset
> (which is equal to the toolbar height). All subsequent scrolls are relative
> to this initial scroll. A few small bugs that assumed there was no blank space
> above the first page have also been fixed.
>
> BUG=439114
>
> Committed: https://crrev.com/daad0f1f879b13c8b55797ae5ce106d382283047
> Cr-Commit-Position: refs/heads/master@{#341685}
TBR=sammc@chromium.org,tsergeant@chromium.org,raymes@chromium.org
BUG=439114
Review URL: https://codereview.chromium.org/1267553004
Cr-Commit-Position: refs/heads/master@{#341820}
-rw-r--r-- | chrome/browser/resources/pdf/pdf.js | 16 | ||||
-rw-r--r-- | chrome/browser/resources/pdf/viewport.js | 53 | ||||
-rw-r--r-- | chrome/test/data/pdf/basic_plugin_test.js | 3 | ||||
-rw-r--r-- | chrome/test/data/pdf/navigator_test.js | 2 | ||||
-rw-r--r-- | chrome/test/data/pdf/viewport_test.js | 63 | ||||
-rw-r--r-- | pdf/out_of_process_instance.cc | 34 | ||||
-rw-r--r-- | pdf/out_of_process_instance.h | 4 | ||||
-rw-r--r-- | pdf/pdf_engine.h | 3 | ||||
-rw-r--r-- | pdf/pdfium/pdfium_engine.cc | 9 | ||||
-rw-r--r-- | pdf/pdfium/pdfium_engine.h | 5 |
10 files changed, 44 insertions, 148 deletions
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js index 3fb6148..dfa2d31 100644 --- a/chrome/browser/resources/pdf/pdf.js +++ b/chrome/browser/resources/pdf/pdf.js @@ -75,12 +75,6 @@ function shouldIgnoreKeyEvents(activeElement) { PDFViewer.MIN_TOOLBAR_OFFSET = 15; /** - * The height of the toolbar along the top of the page. The document will be - * shifted down by this much in the viewport. - */ -PDFViewer.MATERIAL_TOOLBAR_HEIGHT = 64; - -/** * Creates a new PDFViewer. There should only be one of these objects per * document. * @constructor @@ -110,16 +104,13 @@ function PDFViewer(browserApi) { this.errorScreen_ = $('error-screen'); // Create the viewport. - var topToolbarHeight = - this.isMaterial_ ? PDFViewer.MATERIAL_TOOLBAR_HEIGHT : 0; this.viewport_ = new Viewport(window, this.sizer_, this.viewportChanged_.bind(this), this.beforeZoom_.bind(this), this.afterZoom_.bind(this), getScrollbarWidth(), - this.browserApi_.getDefaultZoom(), - topToolbarHeight); + this.browserApi_.getDefaultZoom()); // Create the plugin object dynamically so we can set its src. The plugin // element is sized to fill the entire window and is set to be fixed @@ -152,11 +143,8 @@ function PDFViewer(browserApi) { } this.plugin_.setAttribute('headers', headers); - if (this.isMaterial_) { + if (this.isMaterial_) this.plugin_.setAttribute('is-material', ''); - this.plugin_.setAttribute('top-toolbar-height', - PDFViewer.MATERIAL_TOOLBAR_HEIGHT); - } if (!this.browserApi_.getStreamInfo().embedded) this.plugin_.setAttribute('full-frame', ''); diff --git a/chrome/browser/resources/pdf/viewport.js b/chrome/browser/resources/pdf/viewport.js index 35a5f65..47c2507 100644 --- a/chrome/browser/resources/pdf/viewport.js +++ b/chrome/browser/resources/pdf/viewport.js @@ -25,8 +25,6 @@ function getIntersectionHeight(rect1, rect2) { * @param {Function} afterZoomCallback is run after a change in zoom * @param {number} scrollbarWidth the width of scrollbars on the page * @param {number} defaultZoom The default zoom level. - * @param {number} topToolbarHeight The number of pixels that should initially - * be left blank above the document for the toolbar. */ function Viewport(window, sizer, @@ -34,8 +32,7 @@ function Viewport(window, beforeZoomCallback, afterZoomCallback, scrollbarWidth, - defaultZoom, - topToolbarHeight) { + defaultZoom) { this.window_ = window; this.sizer_ = sizer; this.viewportChangedCallback_ = viewportChangedCallback; @@ -48,7 +45,6 @@ function Viewport(window, this.scrollbarWidth_ = scrollbarWidth; this.fittingType_ = Viewport.FittingType.NONE; this.defaultZoom_ = defaultZoom; - this.topToolbarHeight_ = topToolbarHeight; window.addEventListener('scroll', this.updateViewport_.bind(this)); window.addEventListener('resize', this.resize_.bind(this)); @@ -143,8 +139,8 @@ Viewport.prototype = { if (this.documentDimensions_) { this.sizer_.style.width = this.documentDimensions_.width * this.zoom_ + 'px'; - this.sizer_.style.height = this.documentDimensions_.height * this.zoom_ + - this.topToolbarHeight_ + 'px'; + this.sizer_.style.height = + this.documentDimensions_.height * this.zoom_ + 'px'; } }, @@ -175,7 +171,7 @@ Viewport.prototype = { get position() { return { x: this.window_.pageXOffset, - y: this.window_.pageYOffset - this.topToolbarHeight_ + y: this.window_.pageYOffset }; }, @@ -184,7 +180,7 @@ Viewport.prototype = { * @type {Object} position the position to scroll to. */ set position(position) { - this.window_.scrollTo(position.x, position.y + this.topToolbarHeight_); + this.window_.scrollTo(position.x, position.y); }, /** @@ -233,17 +229,15 @@ Viewport.prototype = { 'Viewport.mightZoom_.'; } // Record the scroll position (relative to the top-left of the window). - var currentScrollPos = { - x: this.position.x / this.zoom_, - y: this.position.y / this.zoom_ - }; + var currentScrollPos = [ + this.window_.pageXOffset / this.zoom_, + this.window_.pageYOffset / this.zoom_ + ]; this.zoom_ = newZoom; this.contentSizeChanged_(); // Scroll to the scaled scroll position. - this.position = { - x: currentScrollPos.x * newZoom, - y: currentScrollPos.y * newZoom - }; + this.window_.scrollTo(currentScrollPos[0] * newZoom, + currentScrollPos[1] * newZoom); }, /** @@ -432,12 +426,8 @@ Viewport.prototype = { height: this.pageDimensions_[page].height, }; this.setZoomInternal_(this.computeFittingZoom_(dimensions, false)); - if (scrollToTopOfPage) { - this.position = { - x: 0, - y: this.pageDimensions_[page].y * this.zoom_ - }; - } + if (scrollToTopOfPage) + this.window_.scrollTo(0, this.pageDimensions_[page].y * this.zoom_); this.updateViewport_(); }.bind(this)); }, @@ -495,16 +485,8 @@ Viewport.prototype = { if (page >= this.pageDimensions_.length) page = this.pageDimensions_.length - 1; var dimensions = this.pageDimensions_[page]; - var toolbarOffset = 0; - // Unless we're in fit to page mode, scroll above the page by - // |this.topToolbarHeight_| so that the toolbar isn't covering it - // initially. - if (this.fittingType_ != Viewport.FittingType.FIT_TO_PAGE) - toolbarOffset = this.topToolbarHeight_; - this.position = { - x: dimensions.x * this.zoom_, - y: dimensions.y * this.zoom_ - toolbarOffset - }; + this.window_.scrollTo(dimensions.x * this.zoom_, + dimensions.y * this.zoom_); this.updateViewport_(); }.bind(this)); }, @@ -522,10 +504,7 @@ Viewport.prototype = { this.setZoomInternal_( Math.min(this.defaultZoom_, this.computeFittingZoom_(this.documentDimensions_, true))); - this.position = { - x: 0, - y: -this.topToolbarHeight_ - }; + this.window_.scrollTo(0, 0); } this.contentSizeChanged_(); this.resize_(); diff --git a/chrome/test/data/pdf/basic_plugin_test.js b/chrome/test/data/pdf/basic_plugin_test.js index fc73d54..08d2714 100644 --- a/chrome/test/data/pdf/basic_plugin_test.js +++ b/chrome/test/data/pdf/basic_plugin_test.js @@ -18,8 +18,7 @@ var tests = [ viewer.viewport.setZoom(1); var sizer = document.getElementById('sizer'); chrome.test.assertEq(826, sizer.offsetWidth); - chrome.test.assertEq(1066 + viewer.viewport.topToolbarHeight_, - sizer.offsetHeight); + chrome.test.assertEq(1066, sizer.offsetHeight); chrome.test.succeed(); }, diff --git a/chrome/test/data/pdf/navigator_test.js b/chrome/test/data/pdf/navigator_test.js index a7ffbbb..149fe2f 100644 --- a/chrome/test/data/pdf/navigator_test.js +++ b/chrome/test/data/pdf/navigator_test.js @@ -32,7 +32,7 @@ var tests = [ var mockSizer = new MockSizer(); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var paramsParser = new OpenPDFParamsParser(function(name) { if (name == 'US') diff --git a/chrome/test/data/pdf/viewport_test.js b/chrome/test/data/pdf/viewport_test.js index 1a45c63..a513de9 100644 --- a/chrome/test/data/pdf/viewport_test.js +++ b/chrome/test/data/pdf/viewport_test.js @@ -6,7 +6,7 @@ var tests = [ function testDocumentNeedsScrollbars() { var viewport = new Viewport(new MockWindow(100, 100), new MockSizer(), function() {}, - function() {}, function() {}, 10, 1, 0); + function() {}, function() {}, 10, 1); var scrollbars; viewport.setDocumentDimensions(new MockDocumentDimensions(90, 90)); @@ -61,7 +61,7 @@ var tests = [ var mockWindow = new MockWindow(100, 100, mockSizer); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); // Test setting the zoom without the document dimensions set. The sizer // shouldn't change size. @@ -136,7 +136,7 @@ var tests = [ function testGetMostVisiblePage() { var mockWindow = new MockWindow(100, 100); var viewport = new Viewport(mockWindow, new MockSizer(), function() {}, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var documentDimensions = new MockDocumentDimensions(100, 100); documentDimensions.addPage(50, 100); @@ -186,7 +186,7 @@ var tests = [ var mockSizer = new MockSizer(); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var documentDimensions = new MockDocumentDimensions(); // Test with a document width which matches the window width. @@ -245,7 +245,7 @@ var tests = [ // fit to width, which will cause the page height to span outside of the // viewport, triggering 15px scrollbars to be shown. viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 15, 1, 0); + function() {}, function() {}, 15, 1); documentDimensions.reset(); documentDimensions.addPage(50, 100); viewport.setDocumentDimensions(documentDimensions); @@ -264,7 +264,7 @@ var tests = [ var mockSizer = new MockSizer(); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var documentDimensions = new MockDocumentDimensions(); // Test with a page size which matches the window size. @@ -373,7 +373,7 @@ var tests = [ var mockSizer = new MockSizer(); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var documentDimensions = new MockDocumentDimensions(); documentDimensions.addPage(100, 100); @@ -414,7 +414,7 @@ var tests = [ var mockSizer = new MockSizer(); var mockCallback = new MockViewportChangedCallback(); var viewport = new Viewport(mockWindow, mockSizer, mockCallback.callback, - function() {}, function() {}, 0, 1, 0); + function() {}, function() {}, 0, 1); var documentDimensions = new MockDocumentDimensions(); documentDimensions.addPage(100, 100); documentDimensions.addPage(200, 200); @@ -469,7 +469,7 @@ var tests = [ chrome.test.assertEq(1, viewport.zoom); }; viewport = new Viewport(mockWindow, mockSizer, function() {}, - beforeZoom, afterZoom, 0, 1, 0); + beforeZoom, afterZoom, 0, 1); viewport.setZoom(0.5); chrome.test.succeed(); }, @@ -477,7 +477,7 @@ var tests = [ function testInitialSetDocumentDimensionsZoomConstrained() { var viewport = new Viewport(new MockWindow(100, 100), new MockSizer(), function() {}, - function() {}, function() {}, 0, 1.2, 0); + function() {}, function() {}, 0, 1.2); viewport.setDocumentDimensions(new MockDocumentDimensions(50, 50)); chrome.test.assertEq(1.2, viewport.zoom); chrome.test.succeed(); @@ -486,52 +486,11 @@ var tests = [ function testInitialSetDocumentDimensionsZoomUnconstrained() { var viewport = new Viewport( new MockWindow(100, 100), - new MockSizer(), function() {}, function() {}, function() {}, 0, 3, 0); + new MockSizer(), function() {}, function() {}, function() {}, 0, 3); viewport.setDocumentDimensions(new MockDocumentDimensions(50, 50)); chrome.test.assertEq(2, viewport.zoom); chrome.test.succeed(); }, - - function testToolbarHeightOffset() { - var mockSizer = new MockSizer(); - var mockWindow = new MockWindow(100, 100); - var viewport = new Viewport(mockWindow, - mockSizer, function() {}, function() {}, function() {}, 0, 1, 50); - var documentDimensions = new MockDocumentDimensions(0, 0); - documentDimensions.addPage(50, 500); - viewport.setDocumentDimensions(documentDimensions); - viewport.setZoom(1); - - // Check that the sizer incorporates the toolbar height. - chrome.test.assertEq('550px', mockSizer.style.height); - chrome.test.assertEq('50px', mockSizer.style.width); - chrome.test.assertEq(0, viewport.position.x); - - // Check the sizer incorporates the toolbar height correctly even if zoomed. - viewport.setZoom(2); - chrome.test.assertEq('1050px', mockSizer.style.height); - chrome.test.assertEq('100px', mockSizer.style.width); - - // Test that the viewport scrolls to the correct offset when fit-to-page is - // enabled. The top of the viewport should be at the start of the document. - viewport.fitToPage(); - chrome.test.assertEq(0, viewport.position.y); - - // Check that going to a page scrolls to the correct offset when fit-to-page - // is enabled. The top of the viewport should be at the start of the - // document. - mockWindow.scrollTo(0, 100); - viewport.goToPage(0); - chrome.test.assertEq(0, viewport.position.y); - - // Check that going to a page scrolls to the correct offset when fit-to-page - // is not enabled. The top of the viewport should be before start of the - // document. - viewport.setZoom(1); - viewport.goToPage(0); - chrome.test.assertEq(-50, viewport.position.y); - chrome.test.succeed(); - } ]; chrome.test.runTests(tests); diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc index 0637845..df18f17 100644 --- a/pdf/out_of_process_instance.cc +++ b/pdf/out_of_process_instance.cc @@ -278,8 +278,7 @@ OutOfProcessInstance::OutOfProcessInstance(PP_Instance instance) received_viewport_message_(false), did_call_start_loading_(false), stop_scrolling_(false), - background_color_(kBackgroundColor), - top_toolbar_height_(0) { + background_color_(kBackgroundColor) { loader_factory_.Initialize(this); timer_factory_.Initialize(this); form_factory_.Initialize(this); @@ -356,8 +355,6 @@ bool OutOfProcessInstance::Init(uint32_t argc, headers = argv[i]; else if (strcmp(argn[i], "is-material") == 0) is_material = true; - else if (strcmp(argn[i], "top-toolbar-height") == 0) - base::StringToInt(argv[i], &top_toolbar_height_); } if (is_material) @@ -595,12 +592,8 @@ void OutOfProcessInstance::DidChangeView(const pp::View& view) { if (!stop_scrolling_) { pp::Point scroll_offset(view.GetScrollOffset()); - // Because view messages come from the DOM, the coordinates of the viewport - // are 0-based (i.e. they do not correspond to the viewport's coordinates in - // JS), so we need to subtract the toolbar height to convert them into - // viewport coordinates. pp::FloatPoint scroll_offset_float(scroll_offset.x(), - scroll_offset.y() - top_toolbar_height_); + scroll_offset.y()); scroll_offset_float = BoundScrollOffsetToDocument(scroll_offset_float); engine_->ScrolledToXPosition(scroll_offset_float.x() * device_scale_); engine_->ScrolledToYPosition(scroll_offset_float.y() * device_scale_); @@ -733,15 +726,6 @@ void OutOfProcessInstance::OnPaint( } } - // Ensure the region above the first page (if any) is filled; - int32_t first_page_ypos = engine_->GetPageScreenRect(0).y(); - if (rect.y() < first_page_ypos) { - pp::Rect region = rect.Intersect(pp::Rect( - pp::Point(), pp::Size(plugin_size_.width(), first_page_ypos))); - ready->push_back(PaintManager::ReadyRect(region, image_data_, false)); - FillRect(region, background_color_); - } - for (size_t j = 0; j < background_parts_.size(); ++j) { pp::Rect intersection = background_parts_[j].location.Intersect(rect); if (!intersection.IsEmpty()) { @@ -1153,7 +1137,8 @@ void OutOfProcessInstance::DocumentLoadComplete(int page_count) { pp::PDF::SetContentRestriction(this, content_restrictions); - uma_.HistogramCustomCounts("PDF.PageCount", page_count, 1, 1000000, 50); + uma_.HistogramCustomCounts("PDF.PageCount", page_count, + 1, 1000000, 50); } void OutOfProcessInstance::RotateClockwise() { @@ -1299,10 +1284,10 @@ void OutOfProcessInstance::OnGeometryChanged(double old_zoom, available_area_.Offset((available_area_.width() - doc_width) / 2, 0); available_area_.set_width(doc_width); } - int bottom_of_document = - GetDocumentPixelHeight() + (top_toolbar_height_ * device_scale_); - if (bottom_of_document < available_area_.height()) - available_area_.set_height(bottom_of_document); + int doc_height = GetDocumentPixelHeight(); + if (doc_height < available_area_.height()) { + available_area_.set_height(doc_height); + } CalculateBackgroundParts(); engine_->PageOffsetUpdated(available_area_.point()); @@ -1428,9 +1413,8 @@ pp::FloatPoint OutOfProcessInstance::BoundScrollOffsetToDocument( const pp::FloatPoint& scroll_offset) { float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); - float min_y = -top_toolbar_height_; float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); - float y = std::max(std::min(scroll_offset.y(), max_y), min_y); + float y = std::max(std::min(scroll_offset.y(), max_y), 0.0f); return pp::FloatPoint(x, y); } diff --git a/pdf/out_of_process_instance.h b/pdf/out_of_process_instance.h index 1215f19..8a3de66 100644 --- a/pdf/out_of_process_instance.h +++ b/pdf/out_of_process_instance.h @@ -333,10 +333,6 @@ class OutOfProcessInstance : public pp::Instance, // The background color of the PDF viewer. uint32 background_color_; - // The blank space above the first page of the document reserved for the - // toolbar. - int top_toolbar_height_; - DISALLOW_COPY_AND_ASSIGN(OutOfProcessInstance); }; diff --git a/pdf/pdf_engine.h b/pdf/pdf_engine.h index 24c69b5..857db88 100644 --- a/pdf/pdf_engine.h +++ b/pdf/pdf_engine.h @@ -233,9 +233,6 @@ class PDFEngine { virtual pp::Rect GetPageRect(int index) = 0; // Gets the rectangle of the page excluding any additional areas. virtual pp::Rect GetPageContentsRect(int index) = 0; - // Returns a page's rect in screen coordinates, as well as its surrounding - // border areas and bottom separator. - virtual pp::Rect GetPageScreenRect(int page_index) const = 0; // Gets the offset of the vertical scrollbar from the top in document // coordinates. virtual int GetVerticalScrollbarYPosition() = 0; diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc index fc36c1e..89fa7eb 100644 --- a/pdf/pdfium/pdfium_engine.cc +++ b/pdf/pdfium/pdfium_engine.cc @@ -1071,15 +1071,6 @@ void PDFiumEngine::Paint(const pp::Rect& rect, if (dirty_in_screen.IsEmpty()) continue; - // Compute the leftover dirty region. The first page may have blank space - // above it, in which case we also need to subtract that space from the - // dirty region. - if (i == 0) { - pp::Rect blank_space_in_screen = dirty_in_screen; - blank_space_in_screen.set_y(0); - blank_space_in_screen.set_height(dirty_in_screen.y()); - leftover = leftover.Subtract(blank_space_in_screen); - } leftover = leftover.Subtract(dirty_in_screen); if (pages_[index]->available()) { diff --git a/pdf/pdfium/pdfium_engine.h b/pdf/pdfium/pdfium_engine.h index c8ee6bd..ff45f45 100644 --- a/pdf/pdfium/pdfium_engine.h +++ b/pdf/pdfium/pdfium_engine.h @@ -84,7 +84,6 @@ class PDFiumEngine : public PDFEngine, virtual int GetMostVisiblePage(); virtual pp::Rect GetPageRect(int index); virtual pp::Rect GetPageContentsRect(int index); - virtual pp::Rect GetPageScreenRect(int page_index) const; virtual int GetVerticalScrollbarYPosition() { return position_.y(); } virtual void PaintThumbnail(pp::ImageData* image_data, int index); virtual void SetGrayscale(bool grayscale); @@ -374,6 +373,10 @@ class PDFiumEngine : public PDFEngine, // Returns the currently visible rectangle in document coordinates. pp::Rect GetVisibleRect() const; + // Returns a page's rect in screen coordinates, as well as its surrounding + // border areas and bottom separator. + pp::Rect GetPageScreenRect(int page_index) const; + // Given a rectangle in document coordinates, returns the rectange into screen // coordinates (i.e. 0,0 is top left corner of plugin area). If it's not // visible, an empty rectangle is returned. |