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

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

Issue 1123563003: Improving direction-based selection strategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removing anonymous namespace and marking functions static instead. Created 5 years, 6 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/VisibleUnits.h ('k') | Source/web/WebLocalFrameImpl.cpp » ('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 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 16 matching lines...) Expand all
27 #include "core/editing/VisibleUnits.h" 27 #include "core/editing/VisibleUnits.h"
28 28
29 #include "bindings/core/v8/ExceptionState.h" 29 #include "bindings/core/v8/ExceptionState.h"
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/Element.h" 33 #include "core/dom/Element.h"
34 #include "core/dom/NodeTraversal.h" 34 #include "core/dom/NodeTraversal.h"
35 #include "core/dom/Position.h" 35 #include "core/dom/Position.h"
36 #include "core/dom/Text.h" 36 #include "core/dom/Text.h"
37 #include "core/editing/FrameSelection.h"
37 #include "core/editing/RenderedPosition.h" 38 #include "core/editing/RenderedPosition.h"
38 #include "core/editing/VisiblePosition.h" 39 #include "core/editing/VisiblePosition.h"
39 #include "core/editing/htmlediting.h" 40 #include "core/editing/htmlediting.h"
40 #include "core/editing/iterators/BackwardsCharacterIterator.h" 41 #include "core/editing/iterators/BackwardsCharacterIterator.h"
41 #include "core/editing/iterators/CharacterIterator.h" 42 #include "core/editing/iterators/CharacterIterator.h"
42 #include "core/editing/iterators/SimplifiedBackwardsTextIterator.h" 43 #include "core/editing/iterators/SimplifiedBackwardsTextIterator.h"
43 #include "core/editing/iterators/TextIterator.h" 44 #include "core/editing/iterators/TextIterator.h"
44 #include "core/html/HTMLBRElement.h" 45 #include "core/html/HTMLBRElement.h"
46 #include "core/layout/HitTestRequest.h"
47 #include "core/layout/HitTestResult.h"
45 #include "core/layout/LayoutBlockFlow.h" 48 #include "core/layout/LayoutBlockFlow.h"
46 #include "core/layout/LayoutObject.h" 49 #include "core/layout/LayoutObject.h"
50 #include "core/layout/LayoutView.h"
47 #include "core/layout/line/InlineTextBox.h" 51 #include "core/layout/line/InlineTextBox.h"
52 #include "core/paint/DeprecatedPaintLayer.h"
48 #include "platform/RuntimeEnabledFeatures.h" 53 #include "platform/RuntimeEnabledFeatures.h"
49 #include "platform/heap/Handle.h" 54 #include "platform/heap/Handle.h"
50 #include "platform/text/TextBoundaries.h" 55 #include "platform/text/TextBoundaries.h"
51 56
52 namespace blink { 57 namespace blink {
53 58
54 using namespace HTMLNames; 59 using namespace HTMLNames;
55 using namespace WTF::Unicode; 60 using namespace WTF::Unicode;
56 61
57 static Node* previousLeafWithSameEditability(Node* node, EditableType editableTy pe) 62 static Node* previousLeafWithSameEditability(Node* node, EditableType editableTy pe)
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 InlineBox* inlineBox; 1410 InlineBox* inlineBox;
1406 int caretOffset; 1411 int caretOffset;
1407 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca retOffset); 1412 position.position().getInlineBoxAndOffset(position.affinity(), inlineBox, ca retOffset);
1408 1413
1409 if (inlineBox) 1414 if (inlineBox)
1410 layoutObject = &inlineBox->layoutObject(); 1415 layoutObject = &inlineBox->layoutObject();
1411 1416
1412 return layoutObject->localCaretRect(inlineBox, caretOffset); 1417 return layoutObject->localCaretRect(inlineBox, caretOffset);
1413 } 1418 }
1414 1419
1420 VisiblePosition visiblePositionForContentsPoint(const IntPoint& contentsPoint, L ocalFrame* frame)
1421 {
1422 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H itTestRequest::Active | HitTestRequest::IgnoreClipping;
1423 HitTestResult result(request, contentsPoint);
1424 frame->document()->layoutView()->hitTest(result);
1425
1426 if (Node* node = result.innerNode())
1427 return frame->selection().selection().visiblePositionRespectingEditingBo undary(result.localPoint(), node);
1428 return VisiblePosition();
1415 } 1429 }
1430
1431 }
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnits.h ('k') | Source/web/WebLocalFrameImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698