1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "third_party/blink/renderer/core/editing/commands/delete_selection_options.h" 6 7 namespace blink { 8 9 DeleteSelectionOptions::DeleteSelectionOptions(const DeleteSelectionOptions&) = 10 default; 11 DeleteSelectionOptions::DeleteSelectionOptions() = default; 12 IsExpandForSpecialElements() const13bool DeleteSelectionOptions::IsExpandForSpecialElements() const { 14 return is_expand_for_special_elements_; 15 } IsMergeBlocksAfterDelete() const16bool DeleteSelectionOptions::IsMergeBlocksAfterDelete() const { 17 return is_merge_blocks_after_delete_; 18 } IsSanitizeMarkup() const19bool DeleteSelectionOptions::IsSanitizeMarkup() const { 20 return is_sanitize_markup_; 21 } IsSmartDelete() const22bool DeleteSelectionOptions::IsSmartDelete() const { 23 return is_smart_delete_; 24 } 25 26 // static NormalDelete()27DeleteSelectionOptions DeleteSelectionOptions::NormalDelete() { 28 return Builder() 29 .SetMergeBlocksAfterDelete(true) 30 .SetExpandForSpecialElements(true) 31 .SetSanitizeMarkup(true) 32 .Build(); 33 } 34 SmartDelete()35DeleteSelectionOptions DeleteSelectionOptions::SmartDelete() { 36 return Builder() 37 .SetSmartDelete(true) 38 .SetMergeBlocksAfterDelete(true) 39 .SetExpandForSpecialElements(true) 40 .SetSanitizeMarkup(true) 41 .Build(); 42 } 43 44 // ---- 45 DeleteSelectionOptions::Builder::Builder() = default; 46 Build() const47DeleteSelectionOptions DeleteSelectionOptions::Builder::Build() const { 48 return options_; 49 } 50 51 DeleteSelectionOptions::Builder& SetExpandForSpecialElements(bool value)52DeleteSelectionOptions::Builder::SetExpandForSpecialElements(bool value) { 53 options_.is_expand_for_special_elements_ = value; 54 return *this; 55 } 56 57 DeleteSelectionOptions::Builder& SetMergeBlocksAfterDelete(bool value)58DeleteSelectionOptions::Builder::SetMergeBlocksAfterDelete(bool value) { 59 options_.is_merge_blocks_after_delete_ = value; 60 return *this; 61 } 62 63 DeleteSelectionOptions::Builder& SetSanitizeMarkup(bool value)64DeleteSelectionOptions::Builder::SetSanitizeMarkup(bool value) { 65 options_.is_sanitize_markup_ = value; 66 return *this; 67 } 68 69 DeleteSelectionOptions::Builder& SetSmartDelete(bool value)70DeleteSelectionOptions::Builder::SetSmartDelete(bool value) { 71 options_.is_smart_delete_ = value; 72 return *this; 73 } 74 75 } // namespace blink 76