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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1302353002: Get rid of redundant member function PositionAlgorithm<Strategy>::{upstream,downstream} (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-22T04:51:20 Rebase 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 | « Source/core/layout/HitTestResult.cpp ('k') | Source/core/layout/LayoutView.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 2974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2985 return node && node->isElementNode() ? toElement(node) : nullptr; 2985 return node && node->isElementNode() ? toElement(node) : nullptr;
2986 } 2986 }
2987 2987
2988 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf finity affinity) 2988 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, TextAf finity affinity)
2989 { 2989 {
2990 // If this is a non-anonymous layoutObject in an editable area, then it's si mple. 2990 // If this is a non-anonymous layoutObject in an editable area, then it's si mple.
2991 if (Node* node = nonPseudoNode()) { 2991 if (Node* node = nonPseudoNode()) {
2992 if (!node->hasEditableStyle()) { 2992 if (!node->hasEditableStyle()) {
2993 // If it can be found, we prefer a visually equivalent position that is editable. 2993 // If it can be found, we prefer a visually equivalent position that is editable.
2994 const Position position = Position(node, offset); 2994 const Position position = Position(node, offset);
2995 Position candidate = position.downstream(CanCrossEditingBoundary); 2995 Position candidate = mostForwardCaretPosition(position, CanCrossEdit ingBoundary);
2996 if (candidate.anchorNode()->hasEditableStyle()) 2996 if (candidate.anchorNode()->hasEditableStyle())
2997 return PositionWithAffinity(candidate, affinity); 2997 return PositionWithAffinity(candidate, affinity);
2998 candidate = position.upstream(CanCrossEditingBoundary); 2998 candidate = mostBackwardCaretPosition(position, CanCrossEditingBound ary);
2999 if (candidate.anchorNode()->hasEditableStyle()) 2999 if (candidate.anchorNode()->hasEditableStyle())
3000 return PositionWithAffinity(candidate, affinity); 3000 return PositionWithAffinity(candidate, affinity);
3001 } 3001 }
3002 // FIXME: Eliminate legacy editing positions 3002 // FIXME: Eliminate legacy editing positions
3003 return PositionWithAffinity(Position::editingPositionOf(node, offset), a ffinity); 3003 return PositionWithAffinity(Position::editingPositionOf(node, offset), a ffinity);
3004 } 3004 }
3005 3005
3006 // We don't want to cross the boundary between editable and non-editable 3006 // We don't want to cross the boundary between editable and non-editable
3007 // regions of the document, but that is either impossible or at least 3007 // regions of the document, but that is either impossible or at least
3008 // extremely unlikely in any normal case because we stop as soon as we 3008 // extremely unlikely in any normal case because we stop as soon as we
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3403 const blink::LayoutObject* root = object1; 3403 const blink::LayoutObject* root = object1;
3404 while (root->parent()) 3404 while (root->parent())
3405 root = root->parent(); 3405 root = root->parent();
3406 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3406 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3407 } else { 3407 } else {
3408 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3408 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3409 } 3409 }
3410 } 3410 }
3411 3411
3412 #endif 3412 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/HitTestResult.cpp ('k') | Source/core/layout/LayoutView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698