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

Side by Side Diff: Source/core/editing/iterators/TextIterator.cpp

Issue 1213483003: Get rid of redundant parameter PositionIsOffsetInAnchor from PositionAlgorithm constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
3 * Copyright (C) 2005 Alexey Proskuryakov. 3 * Copyright (C) 2005 Alexey Proskuryakov.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 // Additionally, if the range we are iterating over contains huge sections o f unrendered content, 840 // Additionally, if the range we are iterating over contains huge sections o f unrendered content,
841 // we would create VisiblePositions on every call to this function without t his check. 841 // we would create VisiblePositions on every call to this function without t his check.
842 if (!m_node->layoutObject() || m_node->layoutObject()->style()->visibility() != VISIBLE 842 if (!m_node->layoutObject() || m_node->layoutObject()->style()->visibility() != VISIBLE
843 || (m_node->layoutObject()->isLayoutBlockFlow() && !toLayoutBlock(m_node ->layoutObject())->size().height() && !isHTMLBodyElement(*m_node))) 843 || (m_node->layoutObject()->isLayoutBlockFlow() && !toLayoutBlock(m_node ->layoutObject())->size().height() && !isHTMLBodyElement(*m_node)))
844 return false; 844 return false;
845 845
846 // The startPos.isNotNull() check is needed because the start could be befor e the body, 846 // The startPos.isNotNull() check is needed because the start could be befor e the body,
847 // and in that case we'll get null. We don't want to put in newlines at the start in that case. 847 // and in that case we'll get null. We don't want to put in newlines at the start in that case.
848 // The currPos.isNotNull() check is needed because positions in non-HTML con tent 848 // The currPos.isNotNull() check is needed because positions in non-HTML con tent
849 // (like SVG) do not have visible positions, and we don't want to emit for t hem either. 849 // (like SVG) do not have visible positions, and we don't want to emit for t hem either.
850 VisiblePosition startPos = VisiblePosition(Position(m_startContainer, m_star tOffset, Position::PositionIsOffsetInAnchor), DOWNSTREAM); 850 VisiblePosition startPos = VisiblePosition(Position(m_startContainer, m_star tOffset), DOWNSTREAM);
851 VisiblePosition currPos = VisiblePosition(positionBeforeNode(m_node), DOWNST REAM); 851 VisiblePosition currPos = VisiblePosition(positionBeforeNode(m_node), DOWNST REAM);
852 return startPos.isNotNull() && currPos.isNotNull() && !inSameLine(startPos, currPos); 852 return startPos.isNotNull() && currPos.isNotNull() && !inSameLine(startPos, currPos);
853 } 853 }
854 854
855 template<typename Strategy> 855 template<typename Strategy>
856 bool TextIteratorAlgorithm<Strategy>::shouldEmitSpaceBeforeAndAfterNode(Node* no de) 856 bool TextIteratorAlgorithm<Strategy>::shouldEmitSpaceBeforeAndAfterNode(Node* no de)
857 { 857 {
858 return isRenderedTableElement(node) && (node->layoutObject()->isInline() || emitsCharactersBetweenAllVisiblePositions()); 858 return isRenderedTableElement(node) && (node->layoutObject()->isInline() || emitsCharactersBetweenAllVisiblePositions());
859 } 859 }
860 860
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1101
1102 String plainText(const PositionInComposedTree& start, const PositionInComposedTr ee& end, TextIteratorBehaviorFlags behavior) 1102 String plainText(const PositionInComposedTree& start, const PositionInComposedTr ee& end, TextIteratorBehaviorFlags behavior)
1103 { 1103 {
1104 return createPlainText<EditingInComposedTreeStrategy>(start, end, behavior); 1104 return createPlainText<EditingInComposedTreeStrategy>(start, end, behavior);
1105 } 1105 }
1106 1106
1107 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>; 1107 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingStrategy>;
1108 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>; 1108 template class CORE_TEMPLATE_EXPORT TextIteratorAlgorithm<EditingInComposedTreeS trategy>;
1109 1109
1110 } // namespace blink 1110 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnitsTest.cpp ('k') | Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698