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

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

Issue 1845563002: Make enclosingBlockFlowElement() to take const Node reference (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | no next file » | 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, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 Element* enclosingBlock(const Position& position, EditingBoundaryCrossingRule ru le) 711 Element* enclosingBlock(const Position& position, EditingBoundaryCrossingRule ru le)
712 { 712 {
713 return enclosingBlockAlgorithm<EditingStrategy>(position, rule); 713 return enclosingBlockAlgorithm<EditingStrategy>(position, rule);
714 } 714 }
715 715
716 Element* enclosingBlock(const PositionInFlatTree& position, EditingBoundaryCross ingRule rule) 716 Element* enclosingBlock(const PositionInFlatTree& position, EditingBoundaryCross ingRule rule)
717 { 717 {
718 return enclosingBlockAlgorithm<EditingInFlatTreeStrategy>(position, rule); 718 return enclosingBlockAlgorithm<EditingInFlatTreeStrategy>(position, rule);
719 } 719 }
720 720
721 Element* enclosingBlockFlowElement(Node& node) 721 Element* enclosingBlockFlowElement(const Node& node)
722 { 722 {
723 if (isBlockFlowElement(node)) 723 if (isBlockFlowElement(node))
724 return &toElement(node); 724 return const_cast<Element*>(&toElement(node));
725 725
726 for (Node* n = node.parentNode(); n; n = n->parentNode()) { 726 for (Node* n = node.parentNode(); n; n = n->parentNode()) {
727 if (isBlockFlowElement(*n) || isHTMLBodyElement(*n)) 727 if (isBlockFlowElement(*n) || isHTMLBodyElement(*n))
728 return toElement(n); 728 return toElement(n);
729 } 729 }
730 return 0; 730 return nullptr;
731 } 731 }
732 732
733 bool inSameContainingBlockFlowElement(Node* a, Node* b) 733 bool inSameContainingBlockFlowElement(Node* a, Node* b)
734 { 734 {
735 return a && b && enclosingBlockFlowElement(*a) == enclosingBlockFlowElement( *b); 735 return a && b && enclosingBlockFlowElement(*a) == enclosingBlockFlowElement( *b);
736 } 736 }
737 737
738 bool nodeIsUserSelectAll(const Node* node) 738 bool nodeIsUserSelectAll(const Node* node)
739 { 739 {
740 return RuntimeEnabledFeatures::userSelectAllEnabled() && node && node->layou tObject() && node->layoutObject()->style()->userSelect() == SELECT_ALL; 740 return RuntimeEnabledFeatures::userSelectAllEnabled() && node && node->layou tObject() && node->layoutObject()->style()->userSelect() == SELECT_ALL;
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 // instead of possibly at the end of the last node before the selection 1677 // instead of possibly at the end of the last node before the selection
1678 return mostForwardCaretPosition(visiblePosition.deepEquivalent()); 1678 return mostForwardCaretPosition(visiblePosition.deepEquivalent());
1679 } 1679 }
1680 1680
1681 bool isTextSecurityNode(const Node* node) 1681 bool isTextSecurityNode(const Node* node)
1682 { 1682 {
1683 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE; 1683 return node && node->layoutObject() && node->layoutObject()->style()->textSe curity() != TSNONE;
1684 } 1684 }
1685 1685
1686 } // namespace blink 1686 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698