OLD | NEW |
---|---|
1 /* | 1 /* |
2 Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 (C) 1998 Waldo Bastian (bastian@kde.org) | 3 (C) 1998 Waldo Bastian (bastian@kde.org) |
4 (C) 1998, 1999 Torben Weis (weis@kde.org) | 4 (C) 1998, 1999 Torben Weis (weis@kde.org) |
5 (C) 1999 Lars Knoll (knoll@kde.org) | 5 (C) 1999 Lars Knoll (knoll@kde.org) |
6 (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 7 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
8 | 8 |
9 This library is free software; you can redistribute it and/or | 9 This library is free software; you can redistribute it and/or |
10 modify it under the terms of the GNU Library General Public | 10 modify it under the terms of the GNU Library General Public |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 | 465 |
466 // Scroll the actual contents of the view (either blitting or invalidating a s needed). | 466 // Scroll the actual contents of the view (either blitting or invalidating a s needed). |
467 void scrollContents(const IntSize& scrollDelta); | 467 void scrollContents(const IntSize& scrollDelta); |
468 | 468 |
469 // This gives us a means of blocking painting on our scrollbars until the fi rst layout has occurred. | 469 // This gives us a means of blocking painting on our scrollbars until the fi rst layout has occurred. |
470 void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = fal se); | 470 void setScrollbarsSuppressed(bool suppressed, bool repaintOnUnsuppress = fal se); |
471 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } | 471 bool scrollbarsSuppressed() const { return m_scrollbarsSuppressed; } |
472 | 472 |
473 bool drawPanScrollIcon() { return m_shouldDrawPanScrollIcon; } | 473 bool drawPanScrollIcon() { return m_shouldDrawPanScrollIcon; } |
474 | 474 |
475 // Coordinate space transform methods. | |
Rick Byers
2015/03/07 15:44:08
These comments are great, thanks! Make sure to li
bokan
2015/03/09 13:44:33
You're right, I thought it didn't matter since con
| |
476 // The following methods convert coordinates between various spaces related | |
477 // to this frame. Here's the definition for each coordinate space: | |
478 // | |
479 // Contents: The coordinate space of *this* FrameView's document, in CSS | |
480 // pixels. The origin is the top left corner of the document. | |
481 // Therefore, this is the same as Frame coordinates but does not | |
482 // take the Frame's scroll offset into account. | |
483 // | |
484 // Frame: The coordinate space of *this* FrameView in CSS pixels. The origin | |
485 // is the top left corner of the frame. Therefore, scrolling the | |
486 // FrameView will change the Frame coordinates of elements on the | |
487 // page. | |
488 // | |
489 // RootFrame: The Frame coordinates of the *top level* (i.e. main) frame. | |
490 // | |
491 // Viewport: The coordinate space of the viewport as seen by the user, in | |
Rick Byers
2015/03/07 15:44:08
nit: "visual viewport" perhaps since you use that
bokan
2015/03/09 13:44:33
Done.
| |
492 // device independent pixels (DIPs). The origin is at the top | |
493 // left corner of the browser view (Window or Screen). The | |
494 // difference between Viewport and RootFrame is the | |
495 // transformation applied by pinch-zoom. This is generally what | |
496 // you'd use to display something relative to the user's Window | |
497 // or Screen. | |
498 // | |
499 // Screen: The final screen space on the user's device, relative to the top | |
500 // left corner of the screen (i.e. if we're in a Window, this will | |
501 // include the window's offset from the top left of the screen). | |
502 // Note that, oddly enough, it seems this is actually in DIPs rather | |
503 // than physical pixels. | |
Rick Byers
2015/03/07 15:44:08
I don't think this is odd actually. High-dpi supp
bokan
2015/03/09 13:44:33
Yah, you're right, I've removed the "oddly enough"
| |
475 IntPoint rootFrameToContents(const IntPoint&) const; | 504 IntPoint rootFrameToContents(const IntPoint&) const; |
505 FloatPoint rootFrameToContents(const FloatPoint&) const; | |
476 IntRect rootFrameToContents(const IntRect&) const; | 506 IntRect rootFrameToContents(const IntRect&) const; |
477 IntPoint contentsToRootFrame(const IntPoint&) const; | 507 IntPoint contentsToRootFrame(const IntPoint&) const; |
478 IntRect contentsToRootFrame(const IntRect&) const; | 508 IntRect contentsToRootFrame(const IntRect&) const; |
479 | 509 |
480 // Event coordinates are assumed to be in the coordinate space of a window t hat contains | 510 IntRect viewportToContents(const IntRect&) const; |
481 // the entire widget hierarchy. It is up to the platform to decide what the precise definition | 511 IntRect contentsToViewport(const IntRect&) const; |
482 // of containing window is. (For example on Mac it is the containing NSWindo w.) | 512 IntPoint contentsToViewport(const IntPoint&) const; |
483 IntPoint windowToContents(const IntPoint&) const; | 513 IntPoint viewportToContents(const IntPoint&) const; |
484 FloatPoint windowToContents(const FloatPoint&) const; | 514 |
485 IntPoint contentsToWindow(const IntPoint&) const; | 515 // FIXME: Some external callers expect to get back a rect that's positioned |
486 IntRect windowToContents(const IntRect&) const; | 516 // in viewport space, but sized in CSS pixels. This is an artifact of the |
487 IntRect contentsToWindow(const IntRect&) const; | 517 // old pinch-zoom path. These callers should be converted to expect a rect |
518 // fully in viewport space. crbug.com/459591. | |
519 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const; | |
488 | 520 |
489 // Methods for converting between Frame and Content (i.e. Document) coordina tes. | 521 // Methods for converting between Frame and Content (i.e. Document) coordina tes. |
490 // Frame coordinates are relative to the top left corner of the frame and so | 522 // Frame coordinates are relative to the top left corner of the frame and so |
491 // they are affected by scroll offset. Content coordinates are relative to t he | 523 // they are affected by scroll offset. Content coordinates are relative to t he |
492 // document's top left corner and thus are not affected by scroll offset. | 524 // document's top left corner and thus are not affected by scroll offset. |
493 IntPoint contentsToFrame(const IntPoint&) const; | 525 IntPoint contentsToFrame(const IntPoint&) const; |
494 IntRect contentsToFrame(const IntRect&) const; | 526 IntRect contentsToFrame(const IntRect&) const; |
495 IntPoint frameToContents(const IntPoint&) const; | 527 IntPoint frameToContents(const IntPoint&) const; |
496 FloatPoint frameToContents(const FloatPoint&) const; | 528 FloatPoint frameToContents(const FloatPoint&) const; |
497 IntRect frameToContents(const IntRect&) const; | 529 IntRect frameToContents(const IntRect&) const; |
498 | 530 |
499 // Functions for converting to screen coordinates. | 531 // Functions for converting to screen coordinates. |
500 IntRect contentsToScreen(const IntRect&) const; | 532 IntRect contentsToScreen(const IntRect&) const; |
501 | 533 |
502 // These functions are used to enable scrollbars to avoid window resizer con trols that overlap the scroll view. | 534 // These functions are used to enable scrollbars to avoid window resizer con trols that overlap the scroll view. |
503 // This happens only on Mac OS X 10.6. | 535 // This happens only on Mac OS X 10.6. |
504 IntRect windowResizerRect() const; | 536 IntRect windowResizerRect() const; |
505 bool containsScrollbarsAvoidingResizer() const; | 537 bool containsScrollbarsAvoidingResizer() const; |
506 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); | 538 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); |
507 void windowResizerRectChanged(); | 539 void windowResizerRectChanged(); |
508 | 540 |
509 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32). | 541 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32). |
510 Scrollbar* scrollbarAtWindowPoint(const IntPoint&); | 542 Scrollbar* scrollbarAtRootFramePoint(const IntPoint&); |
511 Scrollbar* scrollbarAtFramePoint(const IntPoint&); | 543 Scrollbar* scrollbarAtFramePoint(const IntPoint&); |
512 | 544 |
513 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override | 545 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override |
514 { | 546 { |
515 IntPoint newPoint = point; | 547 IntPoint newPoint = point; |
516 if (!isFrameViewScrollbar(child)) | 548 if (!isFrameViewScrollbar(child)) |
517 newPoint = contentsToFrame(point); | 549 newPoint = contentsToFrame(point); |
518 newPoint.moveBy(child->location()); | 550 newPoint.moveBy(child->location()); |
519 return newPoint; | 551 return newPoint; |
520 } | 552 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
866 static const unsigned visualPixelThreshold = 32 * 32; | 898 static const unsigned visualPixelThreshold = 32 * 32; |
867 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 899 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
868 setIsVisuallyNonEmpty(); | 900 setIsVisuallyNonEmpty(); |
869 } | 901 } |
870 | 902 |
871 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); | 903 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); |
872 | 904 |
873 } // namespace blink | 905 } // namespace blink |
874 | 906 |
875 #endif // FrameView_h | 907 #endif // FrameView_h |
OLD | NEW |