Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.h

Issue 1516723003: [Element / Autofill] Add boundsInViewportFloat() to fix <input> popup misalignment. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refator to use boundsInViewportFloat() eventually, but keep boundsInViewportInt(). Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 enum UrlFragmentBehavior { 253 enum UrlFragmentBehavior {
254 UrlFragmentScroll, 254 UrlFragmentScroll,
255 UrlFragmentDontScroll 255 UrlFragmentDontScroll
256 }; 256 };
257 bool processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll ); 257 bool processUrlFragment(const KURL&, UrlFragmentBehavior = UrlFragmentScroll );
258 void clearScrollAnchor(); 258 void clearScrollAnchor();
259 259
260 // Methods to convert points and rects between the coordinate space of the l ayoutObject, and this view. 260 // Methods to convert points and rects between the coordinate space of the l ayoutObject, and this view.
261 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const; 261 IntRect convertFromLayoutObject(const LayoutObject&, const IntRect&) const;
262 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const; 262 IntRect convertToLayoutObject(const LayoutObject&, const IntRect&) const;
263 FloatRect convertFromLayoutObject(const LayoutObject&, const FloatRect&) con st;
263 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const ; 264 IntPoint convertFromLayoutObject(const LayoutObject&, const IntPoint&) const ;
264 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const; 265 IntPoint convertToLayoutObject(const LayoutObject&, const IntPoint&) const;
265 266
266 bool isFrameViewScrollCorner(LayoutScrollbarPart* scrollCorner) const { retu rn m_scrollCorner == scrollCorner; } 267 bool isFrameViewScrollCorner(LayoutScrollbarPart* scrollCorner) const { retu rn m_scrollCorner == scrollCorner; }
267 268
268 enum ScrollingReasons { 269 enum ScrollingReasons {
269 Scrollable, 270 Scrollable,
270 NotScrollableNoOverflow, 271 NotScrollableNoOverflow,
271 NotScrollableNotVisible, 272 NotScrollableNotVisible,
272 NotScrollableExplicitlyDisabled 273 NotScrollableExplicitlyDisabled
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // Methods for converting between this frame and other coordinate spaces. 451 // Methods for converting between this frame and other coordinate spaces.
451 // For definitions and an explanation of the varous spaces, please see: 452 // For definitions and an explanation of the varous spaces, please see:
452 // http://www.chromium.org/developers/design-documents/blink-coordinate-spac es 453 // http://www.chromium.org/developers/design-documents/blink-coordinate-spac es
453 IntPoint rootFrameToContents(const IntPoint&) const; 454 IntPoint rootFrameToContents(const IntPoint&) const;
454 FloatPoint rootFrameToContents(const FloatPoint&) const; 455 FloatPoint rootFrameToContents(const FloatPoint&) const;
455 IntRect rootFrameToContents(const IntRect&) const; 456 IntRect rootFrameToContents(const IntRect&) const;
456 IntPoint contentsToRootFrame(const IntPoint&) const; 457 IntPoint contentsToRootFrame(const IntPoint&) const;
457 IntRect contentsToRootFrame(const IntRect&) const; 458 IntRect contentsToRootFrame(const IntRect&) const;
458 459
459 IntRect viewportToContents(const IntRect&) const; 460 IntRect viewportToContents(const IntRect&) const;
461 IntPoint viewportToContents(const IntPoint&) const;
460 IntRect contentsToViewport(const IntRect&) const; 462 IntRect contentsToViewport(const IntRect&) const;
463 FloatRect contentsToViewport(const FloatRect&) const;
461 IntPoint contentsToViewport(const IntPoint&) const; 464 IntPoint contentsToViewport(const IntPoint&) const;
462 IntPoint viewportToContents(const IntPoint&) const;
463 465
464 // FIXME: Some external callers expect to get back a rect that's positioned 466 // FIXME: Some external callers expect to get back a rect that's positioned
465 // in viewport space, but sized in CSS pixels. This is an artifact of the 467 // in viewport space, but sized in CSS pixels. This is an artifact of the
466 // old pinch-zoom path. These callers should be converted to expect a rect 468 // old pinch-zoom path. These callers should be converted to expect a rect
467 // fully in viewport space. crbug.com/459591. 469 // fully in viewport space. crbug.com/459591.
468 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const; 470 IntRect soonToBeRemovedContentsToUnscaledViewport(const IntRect&) const;
469 IntPoint soonToBeRemovedUnscaledViewportToContents(const IntPoint&) const; 471 IntPoint soonToBeRemovedUnscaledViewportToContents(const IntPoint&) const;
470 472
471 // Methods for converting between Frame and Content (i.e. Document) coordina tes. 473 // Methods for converting between Frame and Content (i.e. Document) coordina tes.
472 // Frame coordinates are relative to the top left corner of the frame and so 474 // Frame coordinates are relative to the top left corner of the frame and so
473 // they are affected by scroll offset. Content coordinates are relative to t he 475 // they are affected by scroll offset. Content coordinates are relative to t he
474 // document's top left corner and thus are not affected by scroll offset. 476 // document's top left corner and thus are not affected by scroll offset.
475 IntPoint contentsToFrame(const IntPoint&) const; 477 IntPoint contentsToFrame(const IntPoint&) const;
478 FloatPoint contentsToFrame(const FloatPoint&) const;
476 IntRect contentsToFrame(const IntRect&) const; 479 IntRect contentsToFrame(const IntRect&) const;
480 FloatRect contentsToFrame(const FloatRect&) const;
481
477 IntPoint frameToContents(const IntPoint&) const; 482 IntPoint frameToContents(const IntPoint&) const;
478 FloatPoint frameToContents(const FloatPoint&) const; 483 FloatPoint frameToContents(const FloatPoint&) const;
479 IntRect frameToContents(const IntRect&) const; 484 IntRect frameToContents(const IntRect&) const;
480 485
481 // Functions for converting to screen coordinates. 486 // Functions for converting to screen coordinates.
482 IntRect contentsToScreen(const IntRect&) const; 487 IntRect contentsToScreen(const IntRect&) const;
483 488
484 // These functions are used to enable scrollbars to avoid window resizer con trols that overlap the scroll view. 489 // These functions are used to enable scrollbars to avoid window resizer con trols that overlap the scroll view.
485 // This happens only on Mac OS X 10.6. 490 // This happens only on Mac OS X 10.6.
486 IntRect windowResizerRect() const; 491 IntRect windowResizerRect() const;
(...skipping 16 matching lines...) Expand all
503 508
504 IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) cons t override 509 IntPoint convertSelfToChild(const Widget* child, const IntPoint& point) cons t override
505 { 510 {
506 IntPoint newPoint = point; 511 IntPoint newPoint = point;
507 if (!isFrameViewScrollbar(child)) 512 if (!isFrameViewScrollbar(child))
508 newPoint = frameToContents(point); 513 newPoint = frameToContents(point);
509 newPoint.moveBy(-child->location()); 514 newPoint.moveBy(-child->location());
510 return newPoint; 515 return newPoint;
511 } 516 }
512 517
518 FloatPoint convertChildToSelf(const Widget* child, const FloatPoint& point) const override
519 {
520 FloatPoint newPoint = point;
521 if (!isFrameViewScrollbar(child))
522 newPoint = contentsToFrame(point);
523 newPoint.moveBy(child->location());
524 return newPoint;
525 }
526
513 // Widget override. Handles painting of the contents of the view as well as the scrollbars. 527 // Widget override. Handles painting of the contents of the view as well as the scrollbars.
514 void paint(GraphicsContext*, const CullRect&) const override; 528 void paint(GraphicsContext*, const CullRect&) const override;
515 void paint(GraphicsContext*, const GlobalPaintFlags, const CullRect&) const; 529 void paint(GraphicsContext*, const GlobalPaintFlags, const CullRect&) const;
516 void paintContents(GraphicsContext*, const GlobalPaintFlags, const IntRect& damageRect) const; 530 void paintContents(GraphicsContext*, const GlobalPaintFlags, const IntRect& damageRect) const;
517 531
518 // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden. 532 // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
519 void show() override; 533 void show() override;
520 void hide() override; 534 void hide() override;
521 void setParentVisible(bool) override; 535 void setParentVisible(bool) override;
522 536
523 bool isPointInScrollbarCorner(const IntPoint&); 537 bool isPointInScrollbarCorner(const IntPoint&);
524 bool scrollbarCornerPresent() const; 538 bool scrollbarCornerPresent() const;
525 IntRect scrollCornerRect() const override; 539 IntRect scrollCornerRect() const override;
526 540
527 IntRect convertFromScrollbarToContainingWidget(const Scrollbar*, const IntRe ct&) const override; 541 IntRect convertFromScrollbarToContainingWidget(const Scrollbar*, const IntRe ct&) const override;
528 IntRect convertFromContainingWidgetToScrollbar(const Scrollbar*, const IntRe ct&) const override; 542 IntRect convertFromContainingWidgetToScrollbar(const Scrollbar*, const IntRe ct&) const override;
543
544 FloatRect convertFromScrollbarToContainingWidget(const Scrollbar*, const Flo atRect&) const override;
545
529 IntPoint convertFromScrollbarToContainingWidget(const Scrollbar*, const IntP oint&) const override; 546 IntPoint convertFromScrollbarToContainingWidget(const Scrollbar*, const IntP oint&) const override;
530 IntPoint convertFromContainingWidgetToScrollbar(const Scrollbar*, const IntP oint&) const override; 547 IntPoint convertFromContainingWidgetToScrollbar(const Scrollbar*, const IntP oint&) const override;
531 548
532 bool isFrameView() const override { return true; } 549 bool isFrameView() const override { return true; }
533 550
534 DECLARE_VIRTUAL_TRACE(); 551 DECLARE_VIRTUAL_TRACE();
535 void notifyPageThatContentAreaWillPaint() const; 552 void notifyPageThatContentAreaWillPaint() const;
536 FrameView* parentFrameView() const; 553 FrameView* parentFrameView() const;
537 554
538 // Returns the scrollable area for the frame. For the root frame, this will 555 // Returns the scrollable area for the frame. For the root frame, this will
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 677
661 DocumentLifecycle& lifecycle() const; 678 DocumentLifecycle& lifecycle() const;
662 679
663 void contentsResized() override; 680 void contentsResized() override;
664 void scrollbarExistenceDidChange(); 681 void scrollbarExistenceDidChange();
665 682
666 // Override Widget methods to do point conversion via layoutObjects, in orde r to 683 // Override Widget methods to do point conversion via layoutObjects, in orde r to
667 // take transforms into account. 684 // take transforms into account.
668 IntRect convertToContainingWidget(const IntRect&) const override; 685 IntRect convertToContainingWidget(const IntRect&) const override;
669 IntRect convertFromContainingWidget(const IntRect&) const override; 686 IntRect convertFromContainingWidget(const IntRect&) const override;
687 FloatRect convertToContainingWidget(const FloatRect&) const override;
670 IntPoint convertToContainingWidget(const IntPoint&) const override; 688 IntPoint convertToContainingWidget(const IntPoint&) const override;
671 IntPoint convertFromContainingWidget(const IntPoint&) const override; 689 IntPoint convertFromContainingWidget(const IntPoint&) const override;
672 690
673 void updateWidgetPositionsIfNeeded(); 691 void updateWidgetPositionsIfNeeded();
674 692
675 bool wasViewportResized(); 693 bool wasViewportResized();
676 void sendResizeEventIfNeeded(); 694 void sendResizeEventIfNeeded();
677 695
678 void updateScrollableAreaSet(); 696 void updateScrollableAreaSet();
679 697
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 static const unsigned visualPixelThreshold = 32 * 32; 925 static const unsigned visualPixelThreshold = 32 * 32;
908 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold) 926 if (m_visuallyNonEmptyPixelCount > visualPixelThreshold)
909 setIsVisuallyNonEmpty(); 927 setIsVisuallyNonEmpty();
910 } 928 }
911 929
912 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView()); 930 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFra meView());
913 931
914 } // namespace blink 932 } // namespace blink
915 933
916 #endif // FrameView_h 934 #endif // FrameView_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698