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

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

Issue 1287053007: Move rootUserSelectAllForNode() to EditingStrategy template class from PositionAlgorithm template cl (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-20T17:38:38 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/editing/Position.h ('k') | Source/core/editing/SelectionController.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, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 if ((o->isText() && boundingBoxLogicalHeight(o, toLayoutText(o)->lin esBoundingBox())) 542 if ((o->isText() && boundingBoxLogicalHeight(o, toLayoutText(o)->lin esBoundingBox()))
543 || (o->isBox() && toLayoutBox(o)->pixelSnappedLogicalHeight()) 543 || (o->isBox() && toLayoutBox(o)->pixelSnappedLogicalHeight())
544 || (o->isLayoutInline() && isEmptyInline(LineLayoutItem(o)) && b oundingBoxLogicalHeight(o, toLayoutInline(o)->linesBoundingBox()))) 544 || (o->isLayoutInline() && isEmptyInline(LineLayoutItem(o)) && b oundingBoxLogicalHeight(o, toLayoutInline(o)->linesBoundingBox())))
545 return true; 545 return true;
546 } 546 }
547 } 547 }
548 return false; 548 return false;
549 } 549 }
550 550
551 template <typename Strategy> 551 template <typename Strategy>
552 Node* PositionAlgorithm<Strategy>::rootUserSelectAllForNode(Node* node)
553 {
554 if (!node || !nodeIsUserSelectAll(node))
555 return 0;
556 Node* parent = Strategy::parent(*node);
557 if (!parent)
558 return node;
559
560 Node* candidateRoot = node;
561 while (parent) {
562 if (!parent->layoutObject()) {
563 parent = Strategy::parent(*parent);
564 continue;
565 }
566 if (!nodeIsUserSelectAll(parent))
567 break;
568 candidateRoot = parent;
569 parent = Strategy::parent(*candidateRoot);
570 }
571 return candidateRoot;
572 }
573
574 template <typename Strategy>
575 bool PositionAlgorithm<Strategy>::isCandidate() const 552 bool PositionAlgorithm<Strategy>::isCandidate() const
576 { 553 {
577 if (isNull()) 554 if (isNull())
578 return false; 555 return false;
579 556
580 LayoutObject* layoutObject = anchorNode()->layoutObject(); 557 LayoutObject* layoutObject = anchorNode()->layoutObject();
581 if (!layoutObject) 558 if (!layoutObject)
582 return false; 559 return false;
583 560
584 if (layoutObject->style()->visibility() != VISIBLE) 561 if (layoutObject->style()->visibility() != VISIBLE)
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1046
1070 void showTree(const blink::Position* pos) 1047 void showTree(const blink::Position* pos)
1071 { 1048 {
1072 if (pos) 1049 if (pos)
1073 pos->showTreeForThis(); 1050 pos->showTreeForThis();
1074 else 1051 else
1075 fprintf(stderr, "Cannot showTree for (nil)\n"); 1052 fprintf(stderr, "Cannot showTree for (nil)\n");
1076 } 1053 }
1077 1054
1078 #endif 1055 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/Position.h ('k') | Source/core/editing/SelectionController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698