| Index: third_party/WebKit/Source/core/editing/iterators/BackwardsTextBuffer.cpp
|
| diff --git a/third_party/WebKit/Source/core/editing/iterators/BackwardsTextBuffer.cpp b/third_party/WebKit/Source/core/editing/iterators/BackwardsTextBuffer.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9d3cc06c2938363c081e92719f289e76593852d8
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/editing/iterators/BackwardsTextBuffer.cpp
|
| @@ -0,0 +1,27 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "core/editing/iterators/BackwardsTextBuffer.h"
|
| +
|
| +namespace blink {
|
| +
|
| +const UChar* BackwardsTextBuffer::data() const
|
| +{
|
| + return bufferEnd() - size();
|
| +}
|
| +
|
| +UChar* BackwardsTextBuffer::calcDestination(size_t length)
|
| +{
|
| + ASSERT(size() + length <= capacity());
|
| + return bufferEnd() - size() - length;
|
| +}
|
| +
|
| +void BackwardsTextBuffer::shiftData(size_t oldCapacity)
|
| +{
|
| + ASSERT(oldCapacity <= capacity());
|
| + ASSERT(size() <= oldCapacity);
|
| + std::copy_backward(bufferBegin() + oldCapacity - size(), bufferBegin() + oldCapacity, bufferEnd());
|
| +}
|
| +
|
| +} // namespace blink
|
|
|