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

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

Issue 1245843003: [CodeHealth] Use Position::anchorNode instead of deprecatedNode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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/input/EventHandler.cpp ('k') | Source/core/layout/LayoutTreeAsText.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 2934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 } 2945 }
2946 2946
2947 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, EAffin ity affinity) 2947 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset, EAffin ity affinity)
2948 { 2948 {
2949 // If this is a non-anonymous layoutObject in an editable area, then it's si mple. 2949 // If this is a non-anonymous layoutObject in an editable area, then it's si mple.
2950 if (Node* node = nonPseudoNode()) { 2950 if (Node* node = nonPseudoNode()) {
2951 if (!node->hasEditableStyle()) { 2951 if (!node->hasEditableStyle()) {
2952 // If it can be found, we prefer a visually equivalent position that is editable. 2952 // If it can be found, we prefer a visually equivalent position that is editable.
2953 Position position = createLegacyEditingPosition(node, offset); 2953 Position position = createLegacyEditingPosition(node, offset);
2954 Position candidate = position.downstream(CanCrossEditingBoundary); 2954 Position candidate = position.downstream(CanCrossEditingBoundary);
2955 if (candidate.deprecatedNode()->hasEditableStyle()) 2955 if (candidate.anchorNode()->hasEditableStyle())
2956 return PositionWithAffinity(candidate, affinity); 2956 return PositionWithAffinity(candidate, affinity);
2957 candidate = position.upstream(CanCrossEditingBoundary); 2957 candidate = position.upstream(CanCrossEditingBoundary);
2958 if (candidate.deprecatedNode()->hasEditableStyle()) 2958 if (candidate.anchorNode()->hasEditableStyle())
2959 return PositionWithAffinity(candidate, affinity); 2959 return PositionWithAffinity(candidate, affinity);
2960 } 2960 }
2961 // FIXME: Eliminate legacy editing positions 2961 // FIXME: Eliminate legacy editing positions
2962 return PositionWithAffinity(createLegacyEditingPosition(node, offset), a ffinity); 2962 return PositionWithAffinity(createLegacyEditingPosition(node, offset), a ffinity);
2963 } 2963 }
2964 2964
2965 // We don't want to cross the boundary between editable and non-editable 2965 // We don't want to cross the boundary between editable and non-editable
2966 // regions of the document, but that is either impossible or at least 2966 // regions of the document, but that is either impossible or at least
2967 // extremely unlikely in any normal case because we stop as soon as we 2967 // extremely unlikely in any normal case because we stop as soon as we
2968 // find a single non-anonymous layoutObject. 2968 // find a single non-anonymous layoutObject.
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
3355 const blink::LayoutObject* root = object1; 3355 const blink::LayoutObject* root = object1;
3356 while (root->parent()) 3356 while (root->parent())
3357 root = root->parent(); 3357 root = root->parent();
3358 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3358 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3359 } else { 3359 } else {
3360 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3360 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3361 } 3361 }
3362 } 3362 }
3363 3363
3364 #endif 3364 #endif
OLDNEW
« no previous file with comments | « Source/core/input/EventHandler.cpp ('k') | Source/core/layout/LayoutTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698