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

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

Issue 1833653002: Move LayoutObject::nextOffset/previousOffset() to editing utility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test cases. Created 4 years, 9 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) 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 3227 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 3238
3239 int LayoutObject::caretMaxOffset() const 3239 int LayoutObject::caretMaxOffset() const
3240 { 3240 {
3241 if (isAtomicInlineLevel()) 3241 if (isAtomicInlineLevel())
3242 return node() ? std::max(1U, node()->countChildren()) : 1; 3242 return node() ? std::max(1U, node()->countChildren()) : 1;
3243 if (isHR()) 3243 if (isHR())
3244 return 1; 3244 return 1;
3245 return 0; 3245 return 0;
3246 } 3246 }
3247 3247
3248 int LayoutObject::previousOffset(int current) const
3249 {
3250 return current - 1;
3251 }
3252
3253 int LayoutObject::previousOffsetForBackwardDeletion(int current) const 3248 int LayoutObject::previousOffsetForBackwardDeletion(int current) const
3254 { 3249 {
3255 return current - 1; 3250 return current - 1;
3256 } 3251 }
3257 3252
3258 int LayoutObject::nextOffset(int current) const
3259 {
3260 return current + 1;
3261 }
3262
3263 bool LayoutObject::isInert() const 3253 bool LayoutObject::isInert() const
3264 { 3254 {
3265 const LayoutObject* layoutObject = this; 3255 const LayoutObject* layoutObject = this;
3266 while (!layoutObject->node()) 3256 while (!layoutObject->node())
3267 layoutObject = layoutObject->parent(); 3257 layoutObject = layoutObject->parent();
3268 return layoutObject->node()->isInert(); 3258 return layoutObject->node()->isInert();
3269 } 3259 }
3270 3260
3271 void LayoutObject::imageChanged(ImageResource* image, const IntRect* rect) 3261 void LayoutObject::imageChanged(ImageResource* image, const IntRect* rect)
3272 { 3262 {
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
3737 const blink::LayoutObject* root = object1; 3727 const blink::LayoutObject* root = object1;
3738 while (root->parent()) 3728 while (root->parent())
3739 root = root->parent(); 3729 root = root->parent();
3740 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3730 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3741 } else { 3731 } else {
3742 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3732 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3743 } 3733 }
3744 } 3734 }
3745 3735
3746 #endif 3736 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698