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

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

Issue 2291883003: Ensure clean layout before calling TextIterator::rangeLength in editing code (Closed)
Patch Set: Created 4 years, 3 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 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 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 1695
1696 Position p(visiblePosition.deepEquivalent()); 1696 Position p(visiblePosition.deepEquivalent());
1697 Document& document = *p.document(); 1697 Document& document = *p.document();
1698 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot(); 1698 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot();
1699 1699
1700 if (shadowRoot) 1700 if (shadowRoot)
1701 scope = shadowRoot; 1701 scope = shadowRoot;
1702 else 1702 else
1703 scope = document.documentElement(); 1703 scope = document.documentElement();
1704 1704
1705 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1706 // needs to be audited. See http://crbug.com/590369 for more details.
1707 document.updateStyleAndLayoutIgnorePendingStylesheets();
yosin_UTC9 2016/08/30 07:40:24 I hope following patch will hoist this updateLayou
Xiaocheng 2016/08/30 07:42:52 Yeah, there will be such a patch.
1708
1709 // TODO(xiaochengh): We should use EphemeralRange here.
1705 Range* range = Range::create(document, Position::firstPositionInNode(scope), p.parentAnchoredEquivalent()); 1710 Range* range = Range::create(document, Position::firstPositionInNode(scope), p.parentAnchoredEquivalent());
1706 1711
1707 return TextIterator::rangeLength(range->startPosition(), range->endPosition( ), true); 1712 return TextIterator::rangeLength(range->startPosition(), range->endPosition( ), true);
1708 } 1713 }
1709 1714
1710 EphemeralRange makeRange(const VisiblePosition &start, const VisiblePosition &en d) 1715 EphemeralRange makeRange(const VisiblePosition &start, const VisiblePosition &en d)
1711 { 1716 {
1712 if (start.isNull() || end.isNull()) 1717 if (start.isNull() || end.isNull())
1713 return EphemeralRange(); 1718 return EphemeralRange();
1714 1719
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 return InputType::DeleteWordBackward; 1921 return InputType::DeleteWordBackward;
1917 if (granularity == LineBoundary) 1922 if (granularity == LineBoundary)
1918 return InputType::DeleteLineBackward; 1923 return InputType::DeleteLineBackward;
1919 return InputType::DeleteContentBackward; 1924 return InputType::DeleteContentBackward;
1920 default: 1925 default:
1921 return InputType::None; 1926 return InputType::None;
1922 } 1927 }
1923 } 1928 }
1924 1929
1925 } // namespace blink 1930 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698