| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "core/editing/markers/DocumentMarker.h" | 31 #include "core/editing/markers/DocumentMarker.h" |
| 32 | 32 |
| 33 #include "core/editing/markers/TextMatchMarker.h" | 33 #include "core/editing/markers/TextMatchMarker.h" |
| 34 #include "platform/wtf/StdLibExtras.h" | 34 #include "platform/wtf/StdLibExtras.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 DocumentMarker::~DocumentMarker() = default; | 38 DocumentMarker::~DocumentMarker() = default; |
| 39 | 39 |
| 40 DocumentMarker::DocumentMarker(MarkerType type, | 40 DocumentMarker::DocumentMarker(unsigned start_offset, unsigned end_offset) |
| 41 unsigned start_offset, | 41 : start_offset_(start_offset), end_offset_(end_offset) { |
| 42 unsigned end_offset) | |
| 43 : type_(type), start_offset_(start_offset), end_offset_(end_offset) { | |
| 44 DCHECK_LT(start_offset_, end_offset_); | 42 DCHECK_LT(start_offset_, end_offset_); |
| 45 } | 43 } |
| 46 | 44 |
| 47 Optional<DocumentMarker::MarkerOffsets> | 45 Optional<DocumentMarker::MarkerOffsets> |
| 48 DocumentMarker::ComputeOffsetsAfterShift(unsigned offset, | 46 DocumentMarker::ComputeOffsetsAfterShift(unsigned offset, |
| 49 unsigned old_length, | 47 unsigned old_length, |
| 50 unsigned new_length) const { | 48 unsigned new_length) const { |
| 51 MarkerOffsets result; | 49 MarkerOffsets result; |
| 52 result.start_offset = StartOffset(); | 50 result.start_offset = StartOffset(); |
| 53 result.end_offset = EndOffset(); | 51 result.end_offset = EndOffset(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 87 |
| 90 return result; | 88 return result; |
| 91 } | 89 } |
| 92 | 90 |
| 93 void DocumentMarker::ShiftOffsets(int delta) { | 91 void DocumentMarker::ShiftOffsets(int delta) { |
| 94 start_offset_ += delta; | 92 start_offset_ += delta; |
| 95 end_offset_ += delta; | 93 end_offset_ += delta; |
| 96 } | 94 } |
| 97 | 95 |
| 98 } // namespace blink | 96 } // namespace blink |
| OLD | NEW |