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

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

Issue 2731393004: Use EphemeralRange to construct StaticRange (Closed)
Patch Set: 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, 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 2069 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 return isHTMLInputElement(textControl) && 2080 return isHTMLInputElement(textControl) &&
2081 toHTMLInputElement(textControl)->type() == InputTypeNames::password; 2081 toHTMLInputElement(textControl)->type() == InputTypeNames::password;
2082 } 2082 }
2083 2083
2084 bool isTextSecurityNode(const Node* node) { 2084 bool isTextSecurityNode(const Node* node) {
2085 return node && node->layoutObject() && 2085 return node && node->layoutObject() &&
2086 node->layoutObject()->style()->textSecurity() != TSNONE; 2086 node->layoutObject()->style()->textSecurity() != TSNONE;
2087 } 2087 }
2088 2088
2089 const StaticRangeVector* targetRangesForInputEvent(const Node& node) { 2089 const StaticRangeVector* targetRangesForInputEvent(const Node& node) {
2090 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
2091 // needs to be audited. see http://crbug.com/590369 for more details.
2092 node.document().updateStyleAndLayoutIgnorePendingStylesheets();
2090 if (!hasRichlyEditableStyle(node)) 2093 if (!hasRichlyEditableStyle(node))
2091 return nullptr; 2094 return nullptr;
2092 Range* range = createRange( 2095 EphemeralRange range =
yosin_UTC9 2017/03/08 07:35:51 nit: s/EphmeralRange/const EphemeralRange&/ to avo
chongz 2017/03/08 18:31:09 Done.
2093 firstEphemeralRangeOf(node.document() 2096 firstEphemeralRangeOf(node.document()
2094 .frame() 2097 .frame()
2095 ->selection() 2098 ->selection()
2096 .computeVisibleSelectionInDOMTreeDeprecated())); 2099 .computeVisibleSelectionInDOMTreeDeprecated());
2097 if (!range) 2100 if (range.isNull())
2098 return nullptr; 2101 return nullptr;
2099 return new StaticRangeVector(1, StaticRange::create(range)); 2102 return new StaticRangeVector(1, StaticRange::create(range));
2100 } 2103 }
2101 2104
2102 DispatchEventResult dispatchBeforeInputInsertText(Node* target, 2105 DispatchEventResult dispatchBeforeInputInsertText(Node* target,
2103 const String& data) { 2106 const String& data) {
2104 if (!RuntimeEnabledFeatures::inputEventEnabled()) 2107 if (!RuntimeEnabledFeatures::inputEventEnabled())
2105 return DispatchEventResult::NotCanceled; 2108 return DispatchEventResult::NotCanceled;
2106 if (!target) 2109 if (!target)
2107 return DispatchEventResult::NotCanceled; 2110 return DispatchEventResult::NotCanceled;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2179 return InputType::DeleteWordBackward; 2182 return InputType::DeleteWordBackward;
2180 if (granularity == LineBoundary) 2183 if (granularity == LineBoundary)
2181 return InputType::DeleteLineBackward; 2184 return InputType::DeleteLineBackward;
2182 return InputType::DeleteContentBackward; 2185 return InputType::DeleteContentBackward;
2183 default: 2186 default:
2184 return InputType::None; 2187 return InputType::None;
2185 } 2188 }
2186 } 2189 }
2187 2190
2188 } // namespace blink 2191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698