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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.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) 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 PreviousPositionOf(end, PositionMoveType::kCodeUnit)) && 308 PreviousPositionOf(end, PositionMoveType::kCodeUnit)) &&
309 IsNewLineAtPosition(end)) 309 IsNewLineAtPosition(end))
310 end = Position(end.ComputeContainerNode(), end_offset + 1); 310 end = Position(end.ComputeContainerNode(), end_offset + 1);
311 if (is_end_and_end_of_last_paragraph_on_same_node && 311 if (is_end_and_end_of_last_paragraph_on_same_node &&
312 end.OffsetInContainerNode() >= 312 end.OffsetInContainerNode() >=
313 end_of_last_paragraph.OffsetInContainerNode()) 313 end_of_last_paragraph.OffsetInContainerNode())
314 end_of_last_paragraph = end; 314 end_of_last_paragraph = end;
315 } 315 }
316 316
317 // If end is in the middle of a text node, split. 317 // If end is in the middle of a text node, split.
318 if (end_style->UserModify() != READ_ONLY && 318 if (end_style->UserModify() != EUserModify::kReadOnly &&
319 !end_style->CollapseWhiteSpace() && end.OffsetInContainerNode() && 319 !end_style->CollapseWhiteSpace() && end.OffsetInContainerNode() &&
320 end.OffsetInContainerNode() < 320 end.OffsetInContainerNode() <
321 end.ComputeContainerNode()->MaxCharacterOffset()) { 321 end.ComputeContainerNode()->MaxCharacterOffset()) {
322 Text* end_container = ToText(end.ComputeContainerNode()); 322 Text* end_container = ToText(end.ComputeContainerNode());
323 SplitTextNode(end_container, end.OffsetInContainerNode()); 323 SplitTextNode(end_container, end.OffsetInContainerNode());
324 GetDocument().UpdateStyleAndLayoutTree(); 324 GetDocument().UpdateStyleAndLayoutTree();
325 325
326 if (is_start_and_end_on_same_node) 326 if (is_start_and_end_on_same_node)
327 start = FirstPositionInOrBeforeNode(end_container->previousSibling()); 327 start = FirstPositionInOrBeforeNode(end_container->previousSibling());
328 if (is_end_and_end_of_last_paragraph_on_same_node) { 328 if (is_end_and_end_of_last_paragraph_on_same_node) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 } 411 }
412 412
413 HTMLElement* ApplyBlockElementCommand::CreateBlockElement() const { 413 HTMLElement* ApplyBlockElementCommand::CreateBlockElement() const {
414 HTMLElement* element = CreateHTMLElement(GetDocument(), tag_name_); 414 HTMLElement* element = CreateHTMLElement(GetDocument(), tag_name_);
415 if (inline_style_.length()) 415 if (inline_style_.length())
416 element->setAttribute(styleAttr, inline_style_); 416 element->setAttribute(styleAttr, inline_style_);
417 return element; 417 return element;
418 } 418 }
419 419
420 } // namespace blink 420 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698