chromium/third_party/blink/renderer/core/editing/dom_selection.cc

/*
 * Copyright (C) 2007, 2009 Apple Inc. All rights reserved.
 * Copyright (C) 2012 Google Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1.  Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 * 2.  Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 *     its contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/renderer/core/editing/dom_selection.h"

#include "third_party/blink/renderer/bindings/core/v8/v8_get_composed_ranges_options.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/range.h"
#include "third_party/blink/renderer/core/dom/tree_scope.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/ephemeral_range.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/editing/iterators/text_iterator.h"
#include "third_party/blink/renderer/core/editing/position.h"
#include "third_party/blink/renderer/core/editing/selection_modifier.h"
#include "third_party/blink/renderer/core/editing/selection_template.h"
#include "third_party/blink/renderer/core/editing/set_selection_options.h"
#include "third_party/blink/renderer/core/editing/visible_selection.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"

namespace blink {

DOMSelection::DOMSelection(const TreeScope* tree_scope)
    :{}

void DOMSelection::ClearTreeScope() {}

FrameSelection& DOMSelection::Selection() const {}

// TODO(editing-dev): The behavior after loosing browsing context is not
// specified. https://github.com/w3c/selection-api/issues/82
bool DOMSelection::IsAvailable() const {}

void DOMSelection::UpdateFrameSelection(
    const SelectionInDOMTree& selection,
    Range* new_cached_range,
    const SetSelectionOptions& passed_options) const {}

VisibleSelection DOMSelection::GetVisibleSelection() const {}

bool DOMSelection::IsAnchorFirstInSelection() const {}

Node* DOMSelection::anchorNode() const {}

unsigned DOMSelection::anchorOffset() const {}

Node* DOMSelection::focusNode() const {}

unsigned DOMSelection::focusOffset() const {}

Node* DOMSelection::baseNode() const {}

unsigned DOMSelection::baseOffset() const {}

Node* DOMSelection::extentNode() const {}

unsigned DOMSelection::extentOffset() const {}

bool DOMSelection::isCollapsed() const {}

String DOMSelection::type() const {}

String DOMSelection::direction() const {}

unsigned DOMSelection::rangeCount() const {}

// https://www.w3.org/TR/selection-api/#dom-selection-collapse
void DOMSelection::collapse(Node* node,
                            unsigned offset,
                            ExceptionState& exception_state) {}

// https://www.w3.org/TR/selection-api/#dom-selection-collapsetoend
void DOMSelection::collapseToEnd(ExceptionState& exception_state) {}

// https://www.w3.org/TR/selection-api/#dom-selection-collapsetostart
void DOMSelection::collapseToStart(ExceptionState& exception_state) {}

void DOMSelection::empty() {}

// https://www.w3.org/TR/selection-api/#dom-selection-setbaseandextent
void DOMSelection::setBaseAndExtent(Node* base_node,
                                    unsigned base_offset,
                                    Node* extent_node,
                                    unsigned extent_offset,
                                    ExceptionState& exception_state) {}

void DOMSelection::modify(const String& alter_string,
                          const String& direction_string,
                          const String& granularity_string) {}

// https://www.w3.org/TR/selection-api/#dom-selection-extend
void DOMSelection::extend(Node* node,
                          unsigned offset,
                          ExceptionState& exception_state) {}

Range* DOMSelection::getRangeAt(unsigned index,
                                ExceptionState& exception_state) const {}

// https://www.w3.org/TR/selection-api/#dom-selection-getcomposedranges
const StaticRangeVector DOMSelection::getComposedRanges(
    const GetComposedRangesOptions* options) const {}

// If isEnd is false, rescope following spec step 3.
// Else, Rescope following sepc step 5.
// https://www.w3.org/TR/selection-api/#dom-selection-getcomposedranges
void DOMSelection::Rescope(Node*& node,
                           unsigned& offset,
                           const HeapVector<Member<ShadowRoot>>& shadowRoots,
                           bool isEnd) const {}

Range* DOMSelection::PrimaryRangeOrNull() const {}

EphemeralRange DOMSelection::CreateRangeFromSelectionEditor() const {}

bool DOMSelection::IsSelectionOfDocument() const {}

void DOMSelection::CacheRangeIfSelectionOfDocument(Range* range) const {}

Range* DOMSelection::DocumentCachedRange() const {}

void DOMSelection::ClearCachedRangeIfSelectionOfDocument() {}

void DOMSelection::removeRange(Range* range) {}

void DOMSelection::removeAllRanges() {}

void DOMSelection::addRange(Range* new_range) {}

// https://www.w3.org/TR/selection-api/#dom-selection-deletefromdocument
void DOMSelection::deleteFromDocument() {}

bool DOMSelection::containsNode(const Node* n, bool allow_partial) const {}

void DOMSelection::selectAllChildren(Node* n, ExceptionState& exception_state) {}

String DOMSelection::toString() {}

Node* DOMSelection::ShadowAdjustedNode(const Position& position) const {}

unsigned DOMSelection::ShadowAdjustedOffset(const Position& position) const {}

bool DOMSelection::IsValidForPosition(Node* node) const {}

void DOMSelection::AddConsoleWarning(const String& message) {}

void DOMSelection::Trace(Visitor* visitor) const {}

DOMSelection::TemporaryRange::TemporaryRange(const DOMSelection* selection,
                                             Range* range) {}

DOMSelection::TemporaryRange::~TemporaryRange() {}

Range* DOMSelection::TemporaryRange::GetRange() {}

}  // namespace blink