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

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

Issue 2878333002: Make ETextModify an enum class. (Closed)
Patch Set: Created 3 years, 7 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return false; 325 return false;
326 326
327 // Ideally we'd call DCHECK(!needsStyleRecalc()) here, but 327 // Ideally we'd call DCHECK(!needsStyleRecalc()) here, but
328 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion 328 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion
329 // would fire in the middle of Document::setFocusedNode(). 329 // would fire in the middle of Document::setFocusedNode().
330 330
331 for (const Node& ancestor : NodeTraversal::InclusiveAncestorsOf(node)) { 331 for (const Node& ancestor : NodeTraversal::InclusiveAncestorsOf(node)) {
332 if ((ancestor.IsHTMLElement() || ancestor.IsDocumentNode()) && 332 if ((ancestor.IsHTMLElement() || ancestor.IsDocumentNode()) &&
333 ancestor.GetLayoutObject()) { 333 ancestor.GetLayoutObject()) {
334 switch (ancestor.GetLayoutObject()->Style()->UserModify()) { 334 switch (ancestor.GetLayoutObject()->Style()->UserModify()) {
335 case READ_ONLY: 335 case EUserModify::kReadOnly:
336 return false; 336 return false;
337 case READ_WRITE: 337 case EUserModify::kReadWrite:
338 return true; 338 return true;
339 case READ_WRITE_PLAINTEXT_ONLY: 339 case EUserModify::kReadWritePlaintextOnly:
340 return editable_level != kRichlyEditable; 340 return editable_level != kRichlyEditable;
341 } 341 }
342 NOTREACHED(); 342 NOTREACHED();
343 return false; 343 return false;
344 } 344 }
345 } 345 }
346 346
347 return false; 347 return false;
348 } 348 }
349 349
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 return nullptr; 978 return nullptr;
979 } 979 }
980 980
981 EUserSelect UsedValueOfUserSelect(const Node& node) { 981 EUserSelect UsedValueOfUserSelect(const Node& node) {
982 if (node.IsHTMLElement() && ToHTMLElement(node).IsTextControl()) 982 if (node.IsHTMLElement() && ToHTMLElement(node).IsTextControl())
983 return SELECT_TEXT; 983 return SELECT_TEXT;
984 if (!node.GetLayoutObject()) 984 if (!node.GetLayoutObject())
985 return SELECT_NONE; 985 return SELECT_NONE;
986 986
987 const ComputedStyle* style = node.GetLayoutObject()->Style(); 987 const ComputedStyle* style = node.GetLayoutObject()->Style();
988 if (style->UserModify() != READ_ONLY) 988 if (style->UserModify() != EUserModify::kReadOnly)
989 return SELECT_TEXT; 989 return SELECT_TEXT;
990 990
991 return style->UserSelect(); 991 return style->UserSelect();
992 } 992 }
993 993
994 template <typename Strategy> 994 template <typename Strategy>
995 TextDirection DirectionOfEnclosingBlockAlgorithm( 995 TextDirection DirectionOfEnclosingBlockAlgorithm(
996 const PositionTemplate<Strategy>& position) { 996 const PositionTemplate<Strategy>& position) {
997 Element* enclosing_block_element = 997 Element* enclosing_block_element =
998 EnclosingBlock(PositionTemplate<Strategy>::FirstPositionInOrBeforeNode( 998 EnclosingBlock(PositionTemplate<Strategy>::FirstPositionInOrBeforeNode(
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 return InputType::kDeleteSoftLineBackward; 2205 return InputType::kDeleteSoftLineBackward;
2206 if (granularity == kParagraphBoundary) 2206 if (granularity == kParagraphBoundary)
2207 return InputType::kDeleteHardLineBackward; 2207 return InputType::kDeleteHardLineBackward;
2208 return InputType::kDeleteContentBackward; 2208 return InputType::kDeleteContentBackward;
2209 default: 2209 default:
2210 return InputType::kNone; 2210 return InputType::kNone;
2211 } 2211 }
2212 } 2212 }
2213 2213
2214 } // namespace blink 2214 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698