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/12 17:06:48
Are you OK with having to maintain this in two pla
bokan
2015/03/14 01:12:57
Nope, I've added a link to http://www.chromium.org
| |
476 // The following methods convert coordinates between various spaces related | |
477 // to this frame. Note that Frame and Contents spaces are not in CSS pixels; | |
Rick Byers
2015/03/12 17:06:48
nit: say what they are, not what they're not. Mayb
bokan
2015/03/14 01:12:57
I added "unzoomed CSS pixel" and described it, see
| |
478 // therefore, to go from CSS pixels to device independent pixels (DIPs) you | |
479 // must apply browser zoom. Here's the definition for each coordinate space: | |
480 // | |
481 // Contents: The coordinate space of *this* FrameView's document, in scaled | |
Rick Byers
2015/03/12 17:06:48
"scaled DIPs" is an ambiguous term. Either re-use
bokan
2015/03/14 01:12:57
Done.
| |
482 // DIPs. The origin is the top left corner of the document. | |
483 // Therefore, this is the same as Frame coordinates but does not | |
484 // take the Frame's scroll offset into account. In Web/Javascript | |
485 // APIs this is referred to as "page coordinates" (e.g. | |
486 // MouseEvent.pageX). | |
Rick Byers
2015/03/12 17:06:48
You need to take browser zoom into account somehow
bokan
2015/03/14 01:12:57
Done.
| |
487 // | |
488 // Frame: The coordinate space of *this* FrameView in scaled DIPs. The | |
489 // origin is the top left corner of the frame. Therefore, scrolling | |
490 // the FrameView will change the Frame coordinates of elements on the | |
491 // page. In Web/Javascript APIs this is referred to as "client | |
492 // coordinates" (e.g. MouseEvent.clientX). | |
Rick Byers
2015/03/12 17:06:48
ditto two comments from above
bokan
2015/03/14 01:12:57
Done.
| |
493 // | |
494 // RootFrame: The Frame coordinates of the *top level* (i.e. main) frame. | |
495 // | |
496 // Viewport: The coordinate space of the visual viewport as seen by the | |
497 // user, in DIPs. The origin is at the top left corner of the | |
498 // browser view (Window or Screen). The difference between | |
499 // Viewport and RootFrame is the transformation applied by | |
500 // pinch-zoom. This is generally what you'd use to display | |
501 // something relative to the user's Window or Screen. | |
502 // | |
503 // Screen: The final screen space on the user's device, relative to the top | |
504 // left corner of the screen (i.e. if we're in a Window, this will | |
505 // include the window's offset from the top left of the screen). | |
506 // Note that this is in DIPs rather than physical pixels. | |
475 IntPoint rootFrameToContents(const IntPoint&) const; | 507 IntPoint rootFrameToContents(const IntPoint&) const; |
508 FloatPoint rootFrameToContents(const FloatPoint&) const; | |
476 IntRect rootFrameToContents(const IntRect&) const; | 509 IntRect rootFrameToContents(const IntRect&) const; |
477 IntPoint contentsToRootFrame(const IntPoint&) const; | 510 IntPoint contentsToRootFrame(const IntPoint&) const; |
478 IntRect contentsToRootFrame(const IntRect&) const; | 511 IntRect contentsToRootFrame(const IntRect&) const; |
479 | 512 |
480 // Event coordinates are assumed to be in the coordinate space of a window t hat contains | 513 IntRect viewportToContents(const IntRect&) const; |
481 // the entire widget hierarchy. It is up to the platform to decide what the precise definition | 514 IntRect contentsToViewport(const IntRect&) const; |
482 // of containing window is. (For example on Mac it is the containing NSWindo w.) | 515 IntPoint contentsToViewport(const IntPoint&) const; |
483 IntPoint windowToContents(const IntPoint&) const; | 516 IntPoint viewportToContents(const IntPoint&) const; |
484 FloatPoint windowToContents(const FloatPoint&) const; | 517 |
485 IntPoint contentsToWindow(const IntPoint&) const; | 518 // FIXME: Some external callers expect to get back a rect that's positioned |
486 IntRect windowToContents(const IntRect&) const; | 519 // in viewport space, but sized in CSS pixels. This is an artifact of the |
487 IntRect contentsToWindow(const IntRect&) const; | 520 // old pinch-zoom path. These callers should be converted to expect a rect |
521 // fully in viewport space. crbug.com/459591. | |
522 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const; | |
488 | 523 |
489 // Methods for converting between Frame and Content (i.e. Document) coordina tes. | 524 // 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 | 525 // 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 | 526 // 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. | 527 // document's top left corner and thus are not affected by scroll offset. |
493 IntPoint contentsToFrame(const IntPoint&) const; | 528 IntPoint contentsToFrame(const IntPoint&) const; |
494 IntRect contentsToFrame(const IntRect&) const; | 529 IntRect contentsToFrame(const IntRect&) const; |
495 IntPoint frameToContents(const IntPoint&) const; | 530 IntPoint frameToContents(const IntPoint&) const; |
496 FloatPoint frameToContents(const FloatPoint&) const; | 531 FloatPoint frameToContents(const FloatPoint&) const; |
497 IntRect frameToContents(const IntRect&) const; | 532 IntRect frameToContents(const IntRect&) const; |
498 | 533 |
499 // Functions for converting to screen coordinates. | 534 // Functions for converting to screen coordinates. |
500 IntRect contentsToScreen(const IntRect&) const; | 535 IntRect contentsToScreen(const IntRect&) const; |
501 | 536 |
502 // These functions are used to enable scrollbars to avoid window resizer con trols that overlap the scroll view. | 537 // 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. | 538 // This happens only on Mac OS X 10.6. |
504 IntRect windowResizerRect() const; | 539 IntRect windowResizerRect() const; |
505 bool containsScrollbarsAvoidingResizer() const; | 540 bool containsScrollbarsAvoidingResizer() const; |
506 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); | 541 void adjustScrollbarsAvoidingResizerCount(int overlapDelta); |
507 void windowResizerRectChanged(); | 542 void windowResizerRectChanged(); |
508 | 543 |
509 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32). | 544 // For platforms that need to hit test scrollbars from within the engine's e vent handlers (like Win32). |
510 Scrollbar* scrollbarAtWindowPoint(const IntPoint&); | 545 Scrollbar* scrollbarAtRootFramePoint(const IntPoint&); |
511 Scrollbar* scrollbarAtFramePoint(const IntPoint&); | 546 Scrollbar* scrollbarAtFramePoint(const IntPoint&); |
512 | 547 |
513 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override | 548 virtual IntPoint convertChildToSelf(const Widget* child, const IntPoint& poi nt) const override |
514 { | 549 { |
515 IntPoint newPoint = point; | 550 IntPoint newPoint = point; |
516 if (!isFrameViewScrollbar(child)) | 551 if (!isFrameViewScrollbar(child)) |
517 newPoint = contentsToFrame(point); | 552 newPoint = contentsToFrame(point); |
518 newPoint.moveBy(child->location()); | 553 newPoint.moveBy(child->location()); |
519 return newPoint; | 554 return newPoint; |
520 } | 555 } |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
866 static const unsigned visualPixelThreshold = 32 * 32; | 901 static const unsigned visualPixelThreshold = 32 * 32; |
867 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) | 902 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) |
868 setIsVisuallyNonEmpty(); | 903 setIsVisuallyNonEmpty(); |
869 } | 904 } |
870 | 905 |
871 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); | 906 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); |
872 | 907 |
873 } // namespace blink | 908 } // namespace blink |
874 | 909 |
875 #endif // FrameView_h | 910 #endif // FrameView_h |
OLD | NEW |