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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 2641053005: Brush up localSelectionRectOfPositionTemplate (Closed)
Patch Set: Created 3 years, 11 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 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * 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 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 // using the line top value instead of the selection top. 2557 // using the line top value instead of the selection top.
2558 template <typename Strategy> 2558 template <typename Strategy>
2559 LayoutRect localSelectionRectOfPositionTemplate( 2559 LayoutRect localSelectionRectOfPositionTemplate(
2560 const PositionWithAffinityTemplate<Strategy>& position, 2560 const PositionWithAffinityTemplate<Strategy>& position,
2561 LayoutObject*& layoutObject) { 2561 LayoutObject*& layoutObject) {
2562 LayoutRect rect = localCaretRectOfPositionTemplate(position, layoutObject); 2562 LayoutRect rect = localCaretRectOfPositionTemplate(position, layoutObject);
2563 2563
2564 if (rect.isEmpty()) 2564 if (rect.isEmpty())
2565 return rect; 2565 return rect;
2566 2566
2567 InlineBoxPosition boxPosition = 2567 const InlineBoxPosition boxPosition =
2568 computeInlineBoxPosition(position.position(), position.affinity()); 2568 computeInlineBoxPosition(position.position(), position.affinity());
2569 2569
2570 InlineTextBox* box = toInlineTextBox(boxPosition.inlineBox); 2570 InlineBox* const box = boxPosition.inlineBox;
yosin_UTC9 2017/01/20 05:59:53 Please see also https://codereview.chromium.org/26
2571 if (layoutObject->style()->isHorizontalWritingMode()) { 2571 if (layoutObject->style()->isHorizontalWritingMode()) {
2572 rect.setY(box->root().selectionTop()); 2572 rect.setY(box->root().selectionTop());
2573 rect.setHeight(box->root().selectionHeight()); 2573 rect.setHeight(box->root().selectionHeight());
2574 return rect; 2574 return rect;
2575 } 2575 }
2576 2576
2577 rect.setX(box->root().selectionTop()); 2577 rect.setX(box->root().selectionTop());
2578 rect.setWidth(box->root().selectionHeight()); 2578 rect.setWidth(box->root().selectionHeight());
2579 return rect; 2579 return rect;
2580 } 2580 }
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
3902 3902
3903 VisiblePositionInFlatTree previousPositionOf( 3903 VisiblePositionInFlatTree previousPositionOf(
3904 const VisiblePositionInFlatTree& visiblePosition, 3904 const VisiblePositionInFlatTree& visiblePosition,
3905 EditingBoundaryCrossingRule rule) { 3905 EditingBoundaryCrossingRule rule) {
3906 DCHECK(visiblePosition.isValid()) << visiblePosition; 3906 DCHECK(visiblePosition.isValid()) << visiblePosition;
3907 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>( 3907 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(
3908 visiblePosition.deepEquivalent(), rule); 3908 visiblePosition.deepEquivalent(), rule);
3909 } 3909 }
3910 3910
3911 } // namespace blink 3911 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698