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

Side by Side Diff: Source/core/editing/VisiblePosition.cpp

Issue 1308323004: Introduce absoluteCaretBoundsOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T19:12:35 Rebase Created 5 years, 3 months 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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. 3 * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 { 685 {
686 return previousPositionOf(*this).characterAfter(); 686 return previousPositionOf(*this).characterAfter();
687 } 687 }
688 688
689 LayoutRect VisiblePosition::localCaretRect(LayoutObject*& layoutObject) const 689 LayoutRect VisiblePosition::localCaretRect(LayoutObject*& layoutObject) const
690 { 690 {
691 PositionWithAffinity positionWithAffinity(m_deepPosition, m_affinity); 691 PositionWithAffinity positionWithAffinity(m_deepPosition, m_affinity);
692 return localCaretRectOfPosition(positionWithAffinity, layoutObject); 692 return localCaretRectOfPosition(positionWithAffinity, layoutObject);
693 } 693 }
694 694
695 IntRect VisiblePosition::absoluteCaretBounds() const 695 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition)
696 { 696 {
697 LayoutObject* layoutObject; 697 LayoutObject* layoutObject;
698 LayoutRect localRect = localCaretRect(layoutObject); 698 LayoutRect localRect = visiblePosition.localCaretRect(layoutObject);
699 if (localRect.isEmpty() || !layoutObject) 699 if (localRect.isEmpty() || !layoutObject)
700 return IntRect(); 700 return IntRect();
701 701
702 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox(); 702 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox();
703 } 703 }
704 704
705 // TODO(yosin) We should move a global function 705 // TODO(yosin) We should move a global function
706 // |lineDirectionPointForBlockDirectionNavigationOf()| to "FrameSelection.h" 706 // |lineDirectionPointForBlockDirectionNavigationOf()| to "FrameSelection.h"
707 // as static function. 707 // as static function.
708 int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition& visib lePosition) 708 int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition& visib lePosition)
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 else 777 else
778 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); 778 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n");
779 } 779 }
780 780
781 void showTree(const blink::VisiblePosition& vpos) 781 void showTree(const blink::VisiblePosition& vpos)
782 { 782 {
783 vpos.showTreeForThis(); 783 vpos.showTreeForThis();
784 } 784 }
785 785
786 #endif 786 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | Source/core/editing/commands/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698