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

Side by Side Diff: Source/core/editing/Position.h

Issue 1303173002: Move computeInlineBoxPosition() to VisibleUnits.{cpp,h} from Position.{cpp,h} and VisiblePosition.h (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-21T13:45:14 Created 5 years, 4 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 | « no previous file | Source/core/editing/Position.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, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
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 21 matching lines...) Expand all
32 #include "core/editing/EditingStrategy.h" 32 #include "core/editing/EditingStrategy.h"
33 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
34 #include "platform/text/TextDirection.h" 34 #include "platform/text/TextDirection.h"
35 #include "wtf/Assertions.h" 35 #include "wtf/Assertions.h"
36 #include "wtf/PassRefPtr.h" 36 #include "wtf/PassRefPtr.h"
37 #include "wtf/RefPtr.h" 37 #include "wtf/RefPtr.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class Element; 41 class Element;
42 class InlineBox;
43 class Node; 42 class Node;
44 class LayoutObject; 43 class LayoutObject;
45 class Text; 44 class Text;
46 enum class TextAffinity; 45 enum class TextAffinity;
47 class TreeScope; 46 class TreeScope;
48 47
49 struct InlineBoxPosition {
50 InlineBox* inlineBox;
51 int offsetInBox;
52
53 InlineBoxPosition()
54 : inlineBox(nullptr), offsetInBox(0)
55 {
56 }
57
58 InlineBoxPosition(InlineBox* inlineBox, int offsetInBox)
59 : inlineBox(inlineBox), offsetInBox(offsetInBox)
60 {
61 }
62 };
63
64 enum PositionMoveType { 48 enum PositionMoveType {
65 CodePoint, // Move by a single code point. 49 CodePoint, // Move by a single code point.
66 Character, // Move to the next Unicode character break. 50 Character, // Move to the next Unicode character break.
67 BackwardDeletion // Subject to platform conventions. 51 BackwardDeletion // Subject to platform conventions.
68 }; 52 };
69 53
70 enum class PositionAnchorType : unsigned { 54 enum class PositionAnchorType : unsigned {
71 OffsetInAnchor, 55 OffsetInAnchor,
72 BeforeAnchor, 56 BeforeAnchor,
73 AfterAnchor, 57 AfterAnchor,
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 { 400 {
417 return position; 401 return position;
418 } 402 }
419 403
420 template <> 404 template <>
421 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg y>(const Position& position) 405 inline PositionInComposedTree fromPositionInDOMTree<EditingInComposedTreeStrateg y>(const Position& position)
422 { 406 {
423 return toPositionInComposedTree(position); 407 return toPositionInComposedTree(position);
424 } 408 }
425 409
426 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
427 // |VisiblePosition::characterAfter()| and |VisiblePosition::characterBefore()|.
428 // TODO(yosin) We should move |isRenderedCharacter()| to "VisibleUnits.cpp",
429 // since it is used only in "editing/commands/"
430 CORE_EXPORT bool isRenderedCharacter(const Position&);
431 // TODO(yosin) We should move |computeInlineBoxPosition()| to "VisibleUnits.cpp"
432 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const Position&, TextAffi nity);
433 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const Position&, TextAffi nity, TextDirection primaryDirection);
434 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const PositionInComposedT ree&, TextAffinity);
435 CORE_EXPORT InlineBoxPosition computeInlineBoxPosition(const PositionInComposedT ree&, TextAffinity, TextDirection primaryDirection);
436
437 // TODO(yosin) We should move |inRenderedText()| to "VisibleUnits.h" for 410 // TODO(yosin) We should move |inRenderedText()| to "VisibleUnits.h" for
438 // reduce dependency of |LayoutObject| in |Position| class. 411 // reduce dependency of |LayoutObject| in |Position| class.
439 CORE_EXPORT bool inRenderedText(const Position&); 412 CORE_EXPORT bool inRenderedText(const Position&);
440 CORE_EXPORT bool inRenderedText(const PositionInComposedTree&); 413 CORE_EXPORT bool inRenderedText(const PositionInComposedTree&);
441 414
442 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current); 415 CORE_EXPORT int uncheckedPreviousOffset(const Node*, int current);
443 CORE_EXPORT int uncheckedNextOffset(const Node*, int current); 416 CORE_EXPORT int uncheckedNextOffset(const Node*, int current);
444 417
445 // TODO(yosin) We should move |isVisuallyEquivalentCandidate()| to 418 // TODO(yosin) We should move |isVisuallyEquivalentCandidate()| to
446 // "VisibleUnits.cpp" to reduce |LayoutObject| dependency in "Position.cpp". 419 // "VisibleUnits.cpp" to reduce |LayoutObject| dependency in "Position.cpp".
447 CORE_EXPORT bool isVisuallyEquivalentCandidate(const Position&); 420 CORE_EXPORT bool isVisuallyEquivalentCandidate(const Position&);
448 CORE_EXPORT bool isVisuallyEquivalentCandidate(const PositionInComposedTree&); 421 CORE_EXPORT bool isVisuallyEquivalentCandidate(const PositionInComposedTree&);
449 422
450 } // namespace blink 423 } // namespace blink
451 424
452 #ifndef NDEBUG 425 #ifndef NDEBUG
453 // Outside the WebCore namespace for ease of invocation from gdb. 426 // Outside the WebCore namespace for ease of invocation from gdb.
454 void showTree(const blink::Position&); 427 void showTree(const blink::Position&);
455 void showTree(const blink::Position*); 428 void showTree(const blink::Position*);
456 #endif 429 #endif
457 430
458 #endif // Position_h 431 #endif // Position_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698