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

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

Issue 1324463002: Introduce lineDirectionPointForBlockDirectionNavigationOf() for VisiblePosition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-28T17:32:46 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
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 IntRect VisiblePosition::absoluteCaretBounds() const 690 IntRect VisiblePosition::absoluteCaretBounds() const
691 { 691 {
692 LayoutObject* layoutObject; 692 LayoutObject* layoutObject;
693 LayoutRect localRect = localCaretRect(layoutObject); 693 LayoutRect localRect = localCaretRect(layoutObject);
694 if (localRect.isEmpty() || !layoutObject) 694 if (localRect.isEmpty() || !layoutObject)
695 return IntRect(); 695 return IntRect();
696 696
697 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox(); 697 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox();
698 } 698 }
699 699
700 int VisiblePosition::lineDirectionPointForBlockDirectionNavigation() const 700 // TODO(yosin) We should move a global function
701 // |lineDirectionPointForBlockDirectionNavigationOf()| to "FrameSelection.h"
702 // as static function.
703 int lineDirectionPointForBlockDirectionNavigationOf(const VisiblePosition& visib lePosition)
701 { 704 {
702 if (isNull()) 705 if (visiblePosition.isNull())
703 return 0; 706 return 0;
704 707
705 LayoutObject* layoutObject; 708 LayoutObject* layoutObject;
706 LayoutRect localRect = localCaretRect(layoutObject); 709 LayoutRect localRect = visiblePosition.localCaretRect(layoutObject);
707 if (localRect.isEmpty() || !layoutObject) 710 if (localRect.isEmpty() || !layoutObject)
708 return 0; 711 return 0;
709 712
710 // This ignores transforms on purpose, for now. Vertical navigation is done 713 // This ignores transforms on purpose, for now. Vertical navigation is done
711 // without consulting transforms, so that 'up' in transformed text is 'up' 714 // without consulting transforms, so that 'up' in transformed text is 'up'
712 // relative to the text, not absolute 'up'. 715 // relative to the text, not absolute 'up'.
713 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l ocation())); 716 FloatPoint caretPoint = layoutObject->localToAbsolute(FloatPoint(localRect.l ocation()));
714 LayoutObject* containingBlock = layoutObject->containingBlock(); 717 LayoutObject* containingBlock = layoutObject->containingBlock();
715 if (!containingBlock) 718 if (!containingBlock)
716 containingBlock = layoutObject; // Just use ourselves to determine the w riting mode if we have no containing block. 719 containingBlock = layoutObject; // Just use ourselves to determine the w riting mode if we have no containing block.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 else 772 else
770 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); 773 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n");
771 } 774 }
772 775
773 void showTree(const blink::VisiblePosition& vpos) 776 void showTree(const blink::VisiblePosition& vpos)
774 { 777 {
775 vpos.showTreeForThis(); 778 vpos.showTreeForThis();
776 } 779 }
777 780
778 #endif 781 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698