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

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

Issue 2772233002: EXPERIMENT Make toPositionInFlatTree() to return null for DOM position not in flat tree (Closed)
Patch Set: 2017-03-27T18:24:23 Created 3 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) 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // children of shadow host. 534 // children of shadow host.
535 // e.g. "foo",0 in <progress>foo</progress> 535 // e.g. "foo",0 in <progress>foo</progress>
536 if (anchor->isShadowRoot()) 536 if (anchor->isShadowRoot())
537 return PositionInFlatTree(anchor->ownerShadowHost(), 537 return PositionInFlatTree(anchor->ownerShadowHost(),
538 PositionAnchorType::AfterChildren); 538 PositionAnchorType::AfterChildren);
539 return PositionInFlatTree(anchor, PositionAnchorType::AfterChildren); 539 return PositionInFlatTree(anchor, PositionAnchorType::AfterChildren);
540 } 540 }
541 541
542 if (anchor->isShadowRoot()) 542 if (anchor->isShadowRoot())
543 return PositionInFlatTree(anchor->ownerShadowHost(), pos.anchorType()); 543 return PositionInFlatTree(anchor->ownerShadowHost(), pos.anchorType());
544 if (anchor->canParticipateInFlatTree() &&
545 !FlatTreeTraversal::parent(*anchor)) {
546 // Since this function is a primitive function, we do not adjust |pos|
547 // to somewhere in flat tree.
548 return PositionInFlatTree();
549 }
544 // TODO(yosin): Once we have a test case for SLOT or active insertion point, 550 // TODO(yosin): Once we have a test case for SLOT or active insertion point,
545 // this function should handle it. 551 // this function should handle it.
546 return PositionInFlatTree(anchor, pos.anchorType()); 552 return PositionInFlatTree(anchor, pos.anchorType());
547 } 553 }
548 554
549 Position toPositionInDOMTree(const Position& position) { 555 Position toPositionInDOMTree(const Position& position) {
550 return position; 556 return position;
551 } 557 }
552 558
553 Position toPositionInDOMTree(const PositionInFlatTree& position) { 559 Position toPositionInDOMTree(const PositionInFlatTree& position) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 } 684 }
679 685
680 void showTree(const blink::Position* pos) { 686 void showTree(const blink::Position* pos) {
681 if (pos) 687 if (pos)
682 pos->showTreeForThis(); 688 pos->showTreeForThis();
683 else 689 else
684 LOG(INFO) << "Cannot showTree for <null>"; 690 LOG(INFO) << "Cannot showTree for <null>";
685 } 691 }
686 692
687 #endif 693 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698