summaryrefslogtreecommitdiffstats
path: root/widget/ContentData.cpp
blob: 529ccc5c0fb75bb5a1c3308537340122f16ab083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "ContentData.h"

#include "TextEvents.h"

namespace mozilla {

/******************************************************************************
 * ContentSelection
 ******************************************************************************/

ContentSelection::ContentSelection(
    const WidgetQueryContentEvent& aSelectedTextEvent)
    : mWritingMode(aSelectedTextEvent.mReply->WritingModeRef()) {
  MOZ_ASSERT(aSelectedTextEvent.mMessage == eQuerySelectedText);
  MOZ_ASSERT(aSelectedTextEvent.Succeeded());
  if (aSelectedTextEvent.mReply->mOffsetAndData.isSome()) {
    mOffsetAndData =
        Some(OffsetAndData<uint32_t>(aSelectedTextEvent.mReply->StartOffset(),
                                     aSelectedTextEvent.mReply->DataRef(),
                                     OffsetAndDataFor::SelectedString));
  }
}

}  // namespace mozilla