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

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

Issue 1324873002: Move absoluteCaretBoundsOf() for VisiblePosition to VisibleUnits.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-01T16:18:49 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') | Source/core/editing/VisibleUnits.h » ('j') | 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 { 488 {
489 return visiblePositionOf(positionWithAffinity.position(), positionWithAffini ty.affinity()); 489 return visiblePositionOf(positionWithAffinity.position(), positionWithAffini ty.affinity());
490 } 490 }
491 491
492 VisiblePosition visiblePositionOf(const PositionInComposedTree& position, TextAf finity affinity) 492 VisiblePosition visiblePositionOf(const PositionInComposedTree& position, TextAf finity affinity)
493 { 493 {
494 PositionInComposedTreeWithAffinity canonicalized = visiblePositionOfAlgorith m<EditingInComposedTreeStrategy>(position, affinity); 494 PositionInComposedTreeWithAffinity canonicalized = visiblePositionOfAlgorith m<EditingInComposedTreeStrategy>(position, affinity);
495 return VisiblePosition::createWithoutCanonicalization(PositionWithAffinity(t oPositionInDOMTree(canonicalized.position()), canonicalized.affinity())); 495 return VisiblePosition::createWithoutCanonicalization(PositionWithAffinity(t oPositionInDOMTree(canonicalized.position()), canonicalized.affinity()));
496 } 496 }
497 497
498 IntRect absoluteCaretBoundsOf(const VisiblePosition& visiblePosition)
499 {
500 LayoutObject* layoutObject;
501 LayoutRect localRect = localCaretRectOfPosition(visiblePosition.toPositionWi thAffinity(), layoutObject);
502 if (localRect.isEmpty() || !layoutObject)
503 return IntRect();
504
505 return layoutObject->localToAbsoluteQuad(FloatRect(localRect)).enclosingBoun dingBox();
506 }
507
508 #ifndef NDEBUG 498 #ifndef NDEBUG
509 499
510 void VisiblePosition::debugPosition(const char* msg) const 500 void VisiblePosition::debugPosition(const char* msg) const
511 { 501 {
512 if (isNull()) { 502 if (isNull()) {
513 fprintf(stderr, "Position [%s]: null\n", msg); 503 fprintf(stderr, "Position [%s]: null\n", msg);
514 return; 504 return;
515 } 505 }
516 m_deepPosition.debugPosition(msg); 506 m_deepPosition.debugPosition(msg);
517 } 507 }
(...skipping 26 matching lines...) Expand all
544 else 534 else
545 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n"); 535 fprintf(stderr, "Cannot showTree for (nil) VisiblePosition.\n");
546 } 536 }
547 537
548 void showTree(const blink::VisiblePosition& vpos) 538 void showTree(const blink::VisiblePosition& vpos)
549 { 539 {
550 vpos.showTreeForThis(); 540 vpos.showTreeForThis();
551 } 541 }
552 542
553 #endif 543 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisiblePosition.h ('k') | Source/core/editing/VisibleUnits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698