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

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

Issue 2425543003: Ensure clean layout for VisibleSelection::selectionFromContentsOfNode (Closed)
Patch Set: 201610171619 Created 4 years, 2 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) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 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 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after
1946 // break. It would probably be safe to move the line break so that we 1946 // break. It would probably be safe to move the line break so that we
1947 // could still avoid the anchor here. 1947 // could still avoid the anchor here.
1948 Position downstream( 1948 Position downstream(
1949 mostForwardCaretPosition(visiblePos.deepEquivalent())); 1949 mostForwardCaretPosition(visiblePos.deepEquivalent()));
1950 if (lineBreakExistsAtVisiblePosition(visiblePos) && 1950 if (lineBreakExistsAtVisiblePosition(visiblePos) &&
1951 downstream.anchorNode()->isDescendantOf(enclosingAnchor)) 1951 downstream.anchorNode()->isDescendantOf(enclosingAnchor))
1952 return original; 1952 return original;
1953 1953
1954 result = Position::inParentAfterNode(*enclosingAnchor); 1954 result = Position::inParentAfterNode(*enclosingAnchor);
1955 } 1955 }
1956
1957 document().updateStyleAndLayoutIgnorePendingStylesheets();
1958
1956 // If visually just before an anchor, insert *outside* the anchor unless 1959 // If visually just before an anchor, insert *outside* the anchor unless
1957 // it's the first VisiblePosition in a paragraph, to match NSTextView. 1960 // it's the first VisiblePosition in a paragraph, to match NSTextView.
1958 if (visiblePos.deepEquivalent() == firstInAnchor.deepEquivalent()) { 1961 if (visiblePos.deepEquivalent() == firstInAnchor.deepEquivalent()) {
1959 // Make sure anchors are pushed down before avoiding them so that we don't 1962 // Make sure anchors are pushed down before avoiding them so that we don't
1960 // also avoid structural elements like lists and blocks (5142012). 1963 // also avoid structural elements like lists and blocks (5142012).
1961 if (original.anchorNode() != enclosingAnchor && 1964 if (original.anchorNode() != enclosingAnchor &&
1962 original.anchorNode()->parentNode() != enclosingAnchor) { 1965 original.anchorNode()->parentNode() != enclosingAnchor) {
1963 pushAnchorElementDown(enclosingAnchor, editingState); 1966 pushAnchorElementDown(enclosingAnchor, editingState);
1964 if (editingState->isAborted()) 1967 if (editingState->isAborted())
1965 return original; 1968 return original;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 return node; 2017 return node;
2015 } 2018 }
2016 2019
2017 DEFINE_TRACE(CompositeEditCommand) { 2020 DEFINE_TRACE(CompositeEditCommand) {
2018 visitor->trace(m_commands); 2021 visitor->trace(m_commands);
2019 visitor->trace(m_composition); 2022 visitor->trace(m_composition);
2020 EditCommand::trace(visitor); 2023 EditCommand::trace(visitor);
2021 } 2024 }
2022 2025
2023 } // namespace blink 2026 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698