MFH: r466515

www/waterfox: apply some FF60 fixes

Approved by:	ports-secteam blanket
This commit is contained in:
Jan Beich 2018-04-05 00:44:31 +00:00
parent cb14849d9e
commit a7acb1fad0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/branches/2018Q2/; revision=466517
4 changed files with 634 additions and 1 deletions

View File

@ -2,7 +2,7 @@
PORTNAME= waterfox
DISTVERSION= 56.1.0
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= www ipv6
MAINTAINER= jbeich@FreeBSD.org

View File

@ -0,0 +1,504 @@
commit 8ed454acd81e
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Fri Mar 16 15:57:00 2018 -0400
Bug 1346535 - atk: Introduce U+FEFF characters to match AT-SPI offsets with DOM offsets. r=surkov, r=dbaron a=jcristau
--HG--
extra : source : 6f9396e9ea0a261c881dfafbfce894d7138beb6f
---
accessible/atk/DOMtoATK.cpp | 161 +++++++++++++++++++++++++++++++++
accessible/atk/DOMtoATK.h | 163 ++++++++++++++++++++++++++++++++++
accessible/atk/moz.build | 1 +
accessible/atk/nsMaiInterfaceText.cpp | 40 ++++-----
xpcom/string/nsUTF8Utils.h | 24 +++++
5 files changed, 369 insertions(+), 20 deletions(-)
diff --git accessible/atk/DOMtoATK.cpp accessible/atk/DOMtoATK.cpp
new file mode 100644
index 000000000000..ea9fa543186c
--- /dev/null
+++ accessible/atk/DOMtoATK.cpp
@@ -0,0 +1,161 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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 "DOMtoATK.h"
+#include "nsUTF8Utils.h"
+
+namespace mozilla {
+namespace a11y {
+
+namespace DOMtoATK {
+
+void
+AddBOMs(nsACString& aDest, const nsACString& aSource)
+{
+ uint32_t destlength = 0;
+
+ // First compute how much room we will need.
+ for (uint32_t srci = 0; srci < aSource.Length(); ) {
+ int bytes = UTF8traits::bytes(aSource[srci]);
+ if (bytes >= 4) {
+ // Non-BMP character, will add a BOM after it.
+ destlength += 3;
+ }
+ // Skip whole character encoding.
+ srci += bytes;
+ destlength += bytes;
+ }
+
+ uint32_t desti = 0; // Index within aDest.
+
+ // Add BOMs after non-BMP characters.
+ aDest.SetLength(destlength);
+ for (uint32_t srci = 0; srci < aSource.Length(); ) {
+ uint32_t bytes = UTF8traits::bytes(aSource[srci]);
+
+ MOZ_ASSERT(bytes <= aSource.Length() - srci, "We should have the whole sequence");
+
+ // Copy whole sequence.
+ aDest.Replace(desti, bytes, Substring(aSource, srci, bytes));
+ desti += bytes;
+ srci += bytes;
+
+ if (bytes >= 4) {
+ // More than 4 bytes in UTF-8 encoding exactly means more than 16 encoded
+ // bits. This is thus a non-BMP character which needed a surrogate
+ // pair to get encoded in UTF-16, add a BOM after it.
+
+ // And add a BOM after it.
+ aDest.Replace(desti, 3, "\xEF\xBB\xBF");
+ desti += 3;
+ }
+ }
+ MOZ_ASSERT(desti == destlength, "Incoherency between computed length"
+ "and actually translated length");
+}
+
+void
+ATKStringConverterHelper::AdjustOffsets(gint* aStartOffset, gint* aEndOffset,
+ gint count)
+{
+ MOZ_ASSERT(!mAdjusted, "DOMtoATK::ATKStringConverterHelper::AdjustOffsets needs to be called only once");
+
+ if (*aStartOffset > 0) {
+ (*aStartOffset)--;
+ mStartShifted = true;
+ }
+
+ if (*aEndOffset != -1 && *aEndOffset < count) {
+ (*aEndOffset)++;
+ mEndShifted = true;
+ }
+
+#ifdef DEBUG
+ mAdjusted = true;
+#endif
+}
+
+gchar*
+ATKStringConverterHelper::FinishUTF16toUTF8(nsCString& aStr)
+{
+ int skip = 0;
+
+ if (mStartShifted) {
+ // AdjustOffsets added a leading character.
+
+ MOZ_ASSERT(aStr.Length() > 0, "There should be a leading character");
+ MOZ_ASSERT(static_cast<int>(aStr.Length()) >= UTF8traits::bytes(aStr.CharAt(0)),
+ "The leading character should be complete");
+
+ // drop first character
+ skip = UTF8traits::bytes(aStr.CharAt(0));
+ }
+
+ if (mEndShifted) {
+ // AdjustOffsets added a trailing character.
+
+ MOZ_ASSERT(aStr.Length() > 0, "There should be a trailing character");
+
+ int trail = -1;
+ // Find beginning of last character.
+ for (trail = aStr.Length() - 1; trail >= 0; trail--) {
+ if (!UTF8traits::isInSeq(aStr.CharAt(trail))) {
+ break;
+ }
+ }
+ MOZ_ASSERT(trail >= 0,
+ "There should be at least a whole trailing character");
+ MOZ_ASSERT(trail + UTF8traits::bytes(aStr.CharAt(trail)) == static_cast<int>(aStr.Length()),
+ "The trailing character should be complete");
+
+ // Drop the last character.
+ aStr.Truncate(trail);
+ }
+
+ // copy and return, libspi will free it
+ return g_strdup(aStr.get() + skip);
+}
+
+gchar*
+ATKStringConverterHelper::ConvertAdjusted(const nsAString& aStr)
+{
+ MOZ_ASSERT(mAdjusted, "DOMtoATK::ATKStringConverterHelper::AdjustOffsets needs to be called before ATKStringConverterHelper::ConvertAdjusted");
+
+ NS_ConvertUTF16toUTF8 cautoStr(aStr);
+ if (!cautoStr.get()) {
+ return nullptr;
+ }
+
+ nsAutoCString cautoStrBOMs;
+ AddBOMs(cautoStrBOMs, cautoStr);
+ return FinishUTF16toUTF8(cautoStrBOMs);
+}
+
+gchar*
+Convert(const nsAString& aStr)
+{
+ NS_ConvertUTF16toUTF8 cautoStr(aStr);
+ if (!cautoStr.get()) {
+ return nullptr;
+ }
+
+ nsAutoCString cautoStrBOMs;
+ AddBOMs(cautoStrBOMs, cautoStr);
+ return g_strdup(cautoStrBOMs.get());
+}
+
+void
+ConvertTexttoAsterisks(nsAString& aString)
+{
+ for (uint32_t i = 0; i < aString.Length(); i++) {
+ aString.ReplaceLiteral(i, 1, u"*");
+ }
+}
+
+}
+
+} // namespace a11y
+} // namespace mozilla
diff --git accessible/atk/DOMtoATK.h accessible/atk/DOMtoATK.h
new file mode 100644
index 000000000000..1f1b125ebbbe
--- /dev/null
+++ accessible/atk/DOMtoATK.h
@@ -0,0 +1,163 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* 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 "AccessibleWrap.h"
+#include "nsString.h"
+#include "nsMai.h"
+
+/**
+ * ATK offsets are counted in unicode codepoints, while DOM offsets are counted
+ * in UTF-16 code units. That makes a difference for non-BMP characters,
+ * which need two UTF-16 code units to be represented (a pair of surrogates),
+ * while they are just one unicode character.
+ *
+ * To keep synchronization between ATK offsets (unicode codepoints) and DOM
+ * offsets (UTF-16 code units), after translation from UTF-16 to UTF-8 we add a
+ * BOM after each non-BMP character (which would otherwise use 2 UTF-16
+ * code units for only 1 unicode codepoint).
+ *
+ * BOMs (Byte Order Marks, U+FEFF, also known as ZERO WIDTH NO-BREAK SPACE, but
+ * that usage is deprecated) normally only appear at the beginning of unicode
+ * files, but their occurrence within text (notably after cut&paste) is not
+ * uncommon, and are thus considered as non-text.
+ *
+ * Since the selection requested through ATK may not contain both surrogates
+ * at the ends of the selection, we need to fetch one UTF-16 code point more
+ * on both side, and get rid of it before returning the string to ATK. The
+ * ATKStringConverterHelper class maintains this, NewATKString should be used
+ * to call it properly.
+ *
+ * In the end,
+ * - if the start is between the high and low surrogates, the UTF-8 result
+ * includes a BOM from it but not the character
+ * - if the end is between the high and low surrogates, the UTF-8 result
+ * includes the character but *not* the BOM
+ * - all non-BMP characters that are fully in the string are in the UTF-8 result
+ * as character followed by BOM
+ */
+namespace mozilla {
+namespace a11y {
+
+namespace DOMtoATK
+{
+
+ /**
+ * Converts a string of accessible text into ATK gchar* string (by adding
+ * BOMs). This can be used when offsets do not need to be adjusted because
+ * ends of the string can not fall between surrogates.
+ */
+ gchar* Convert(const nsAString& aStr);
+
+ /**
+ * Add a BOM after each non-BMP character.
+ */
+ void AddBOMs(nsACString& aDest, const nsACString& aSource);
+
+ /**
+ * Replace all characters with asterisks (e.g. for password fields).
+ */
+ void ConvertTexttoAsterisks(nsAString& aString);
+
+ /**
+ * Parameterize conversion.
+ */
+ enum class AtkStringConvertFlags : uint32_t {
+ None = 0,
+ ConvertTextToAsterisks = 1 << 0,
+ };
+
+ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AtkStringConvertFlags)
+
+ class ATKStringConverterHelper {
+ public:
+ ATKStringConverterHelper(void) :
+#ifdef DEBUG
+ mAdjusted (false),
+#endif
+ mStartShifted (false),
+ mEndShifted (false) { }
+
+ /**
+ * In order to properly get non-BMP values, offsets need to be changed
+ * to get one character more on each end, so that ConvertUTF16toUTF8 can
+ * convert surrogates even if the originally requested offsets fall between
+ * them.
+ */
+ void AdjustOffsets(gint* aStartOffset, gint* aEndOffset, gint count);
+
+ /**
+ * Converts a string of accessible text with adjusted offsets into ATK
+ * gchar* string (by adding BOMs). Note, AdjustOffsets has to be called
+ * before getting the text passed to this.
+ */
+ gchar* ConvertAdjusted(const nsAString& aStr);
+
+ private:
+ /**
+ * Remove the additional characters requested by PrepareUTF16toUTF8.
+ */
+ gchar* FinishUTF16toUTF8(nsCString& aStr);
+
+#ifdef DEBUG
+ bool mAdjusted;
+#endif
+ bool mStartShifted;
+ bool mEndShifted;
+ };
+
+ /**
+ * Get text from aAccessible, using ATKStringConverterHelper to properly
+ * introduce appropriate BOMs.
+ */
+ template <class AccessibleOrProxy>
+ gchar* NewATKString(AccessibleOrProxy* aAccessible,
+ gint aStartOffset, gint aEndOffset,
+ AtkStringConvertFlags aFlags)
+ {
+ gint startOffset = aStartOffset, endOffset = aEndOffset;
+ ATKStringConverterHelper converter;
+ converter.AdjustOffsets(&startOffset, &endOffset,
+ gint(aAccessible->CharacterCount()));
+ nsAutoString str;
+ aAccessible->TextSubstring(startOffset, endOffset, str);
+ if (aFlags & AtkStringConvertFlags::ConvertTextToAsterisks)
+ ConvertTexttoAsterisks(str);
+ return converter.ConvertAdjusted(str);
+ }
+
+ /**
+ * Get a character from aAccessible, fetching more data as appropriate to
+ * properly get non-BMP characters or a BOM as appropriate.
+ */
+ template <class AccessibleCharAt>
+ gunichar ATKCharacter(AccessibleCharAt* aAccessible, gint aOffset)
+ {
+ // char16_t is unsigned short in Mozilla, gnuichar is guint32 in glib.
+ gunichar character = static_cast<gunichar>(aAccessible->CharAt(aOffset));
+
+ if (NS_IS_LOW_SURROGATE(character)) {
+ // Trailing surrogate, return BOM instead.
+ return 0xFEFF;
+ }
+
+ if (NS_IS_HIGH_SURROGATE(character)) {
+ // Heading surrogate, get the trailing surrogate and combine them.
+ gunichar characterLow = static_cast<gunichar>(aAccessible->CharAt(aOffset + 1));
+
+ if (!NS_IS_LOW_SURROGATE(characterLow)) {
+ // It should have been a trailing surrogate... Flag the error.
+ return 0xFFFD;
+ }
+ return SURROGATE_TO_UCS4(character, characterLow);
+ }
+
+ return character;
+ }
+
+}
+
+} // namespace a11y
+} // namespace mozilla
diff --git accessible/atk/moz.build accessible/atk/moz.build
index baf71c6656b5..19b94bcca723 100644
--- accessible/atk/moz.build
+++ accessible/atk/moz.build
@@ -14,6 +14,7 @@ SOURCES += [
'ApplicationAccessibleWrap.cpp',
'AtkSocketAccessible.cpp',
'DocAccessibleWrap.cpp',
+ 'DOMtoATK.cpp',
'nsMaiHyperlink.cpp',
'nsMaiInterfaceAction.cpp',
'nsMaiInterfaceComponent.cpp',
diff --git accessible/atk/nsMaiInterfaceText.cpp accessible/atk/nsMaiInterfaceText.cpp
index d8c162855343..0c723279046e 100644
--- accessible/atk/nsMaiInterfaceText.cpp
+++ accessible/atk/nsMaiInterfaceText.cpp
@@ -14,9 +14,12 @@
#include "nsIAccessibleTypes.h"
#include "nsIPersistentProperties2.h"
#include "nsISimpleEnumerator.h"
+#include "nsUTF8Utils.h"
#include "mozilla/Likely.h"
+#include "DOMtoATK.h"
+
using namespace mozilla;
using namespace mozilla::a11y;
@@ -128,8 +131,7 @@ ConvertTexttoAsterisks(AccessibleWrap* accWrap, nsAString& aString)
{
// convert each char to "*" when it's "password text"
if (accWrap->NativeRole() == roles::PASSWORD_TEXT) {
- for (uint32_t i = 0; i < aString.Length(); i++)
- aString.Replace(i, 1, NS_LITERAL_STRING("*"));
+ DOMtoATK::ConvertTexttoAsterisks(aString);
}
}
@@ -142,20 +144,20 @@ getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
nsAutoString autoStr;
if (accWrap) {
HyperTextAccessible* text = accWrap->AsHyperText();
- if (!text || !text->IsTextRole())
+ if (!text || !text->IsTextRole() || text->IsDefunct())
return nullptr;
- text->TextSubstring(aStartOffset, aEndOffset, autoStr);
+ return DOMtoATK::NewATKString(text, aStartOffset, aEndOffset,
+ accWrap->NativeRole() == roles::PASSWORD_TEXT ?
+ DOMtoATK::AtkStringConvertFlags::ConvertTextToAsterisks :
+ DOMtoATK::AtkStringConvertFlags::None);
- ConvertTexttoAsterisks(accWrap, autoStr);
} else if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
- proxy->TextSubstring(aStartOffset, aEndOffset, autoStr);
+ return DOMtoATK::NewATKString(proxy, aStartOffset, aEndOffset,
+ DOMtoATK::AtkStringConvertFlags::None);
}
- NS_ConvertUTF16toUTF8 cautoStr(autoStr);
-
- //copy and return, libspi will free it.
- return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
+ return nullptr;
}
static gchar*
@@ -181,8 +183,8 @@ getTextAfterOffsetCB(AtkText *aText, gint aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
- NS_ConvertUTF16toUTF8 cautoStr(autoStr);
- return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
+ // libspi will free it.
+ return DOMtoATK::Convert(autoStr);
}
static gchar*
@@ -208,8 +210,8 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
- NS_ConvertUTF16toUTF8 cautoStr(autoStr);
- return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
+ // libspi will free it.
+ return DOMtoATK::Convert(autoStr);
}
static gunichar
@@ -221,13 +223,11 @@ getCharacterAtOffsetCB(AtkText* aText, gint aOffset)
if (!text || !text->IsTextRole()) {
return 0;
}
-
- // char16_t is unsigned short in Mozilla, gnuichar is guint32 in glib.
- return static_cast<gunichar>(text->CharAt(aOffset));
+ return DOMtoATK::ATKCharacter(text, aOffset);
}
if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
- return static_cast<gunichar>(proxy->CharAt(aOffset));
+ return DOMtoATK::ATKCharacter(proxy, aOffset);
}
return 0;
@@ -257,8 +257,8 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
*aStartOffset = startOffset;
*aEndOffset = endOffset;
- NS_ConvertUTF16toUTF8 cautoStr(autoStr);
- return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
+ // libspi will free it.
+ return DOMtoATK::Convert(autoStr);
}
static gint
diff --git xpcom/string/nsUTF8Utils.h xpcom/string/nsUTF8Utils.h
index ef140084c2e6..5d39b05e799a 100644
--- xpcom/string/nsUTF8Utils.h
+++ xpcom/string/nsUTF8Utils.h
@@ -56,6 +56,30 @@ public:
{
return (aChar & 0xFE) == 0xFC;
}
+ // return the number of bytes in a sequence beginning with aChar
+ static int bytes(char aChar)
+ {
+ if (isASCII(aChar)) {
+ return 1;
+ }
+ if (is2byte(aChar)) {
+ return 2;
+ }
+ if (is3byte(aChar)) {
+ return 3;
+ }
+ if (is4byte(aChar)) {
+ return 4;
+ }
+ if (is5byte(aChar)) {
+ return 5;
+ }
+ if (is6byte(aChar)) {
+ return 6;
+ }
+ MOZ_ASSERT_UNREACHABLE("should not be used for in-sequence characters");
+ return 1;
+ }
};
/**

View File

@ -0,0 +1,103 @@
commit 503070ad8daa
Author: Matt Brubeck <mbrubeck@mozilla.com>
Date: Thu Aug 10 11:38:10 2017 -0700
Bug 1386371 - Disable LTO by default, but enable in automation. r=froydnj
MozReview-Commit-ID: 2DIY9ex3Mch
--HG--
extra : rebase_source : 61f2f073adabfa7c46c324470a308adab23e7781
---
build/moz.configure/toolchain.configure | 1 +
config/rules.mk | 14 ++++++++++++--
python/mozbuild/mozbuild/frontend/emitter.py | 1 -
toolkit/library/gtest/rust/Cargo.toml | 1 -
toolkit/library/rust/Cargo.toml | 1 -
5 files changed, 13 insertions(+), 5 deletions(-)
diff --git build/moz.configure/toolchain.configure build/moz.configure/toolchain.configure
index eba0fbf65538..6a89676385c4 100755
--- build/moz.configure/toolchain.configure
+++ build/moz.configure/toolchain.configure
@@ -1126,6 +1126,7 @@ def developer_options(value):
return True
add_old_configure_assignment('DEVELOPER_OPTIONS', developer_options)
+set_config('DEVELOPER_OPTIONS', developer_options)
# Linker detection
# ==============================================================
diff --git config/rules.mk config/rules.mk
index dc16e99c6e4d..9897c203feb4 100644
--- config/rules.mk
+++ config/rules.mk
@@ -862,6 +862,16 @@ cargo_build_flags += --color=always
endif
endif
+# These flags are passed via `cargo rustc` and only apply to the final rustc
+# invocation (i.e., only the top-level crate, not its dependencies).
+cargo_rustc_flags = $(CARGO_RUSTCFLAGS)
+ifndef DEVELOPER_OPTIONS
+ifndef MOZ_DEBUG_RUST
+# Enable link-time optimization for release builds.
+cargo_rustc_flags += -C lto
+endif
+endif
+
# Cargo currently supports only two interesting profiles for building:
# development and release. Those map (roughly) to --enable-debug and
# --disable-debug in Gecko, respectively, but there's another axis that we'd
@@ -939,7 +949,7 @@ endef
#
# $(call CARGO_BUILD)
define CARGO_BUILD
-$(call RUN_CARGO,build,$(1))
+$(call RUN_CARGO,rustc,$(1))
endef
define CARGO_CHECK
@@ -984,7 +994,7 @@ endif
# build.
force-cargo-library-build:
$(REPORT_BUILD)
- $(call CARGO_BUILD,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag)
+ $(call CARGO_BUILD,$(target_cargo_env_vars)) --lib $(cargo_target_flag) $(rust_features_flag) -- $(cargo_rustc_flags)
$(RUST_LIBRARY_FILE): force-cargo-library-build
diff --git python/mozbuild/mozbuild/frontend/emitter.py python/mozbuild/mozbuild/frontend/emitter.py
index 815126d145b3..07a33caca893 100644
--- python/mozbuild/mozbuild/frontend/emitter.py
+++ python/mozbuild/mozbuild/frontend/emitter.py
@@ -480,7 +480,6 @@ class TreeMetadataEmitter(LoggingMixin):
expected_profile = {
'opt-level': 2,
'rpath': False,
- 'lto': True,
'debug-assertions': False,
'panic': 'abort',
}
diff --git toolkit/library/gtest/rust/Cargo.toml toolkit/library/gtest/rust/Cargo.toml
index a7a64486c684..c9f942c88033 100644
--- toolkit/library/gtest/rust/Cargo.toml
+++ toolkit/library/gtest/rust/Cargo.toml
@@ -42,6 +42,5 @@ panic = "abort"
[profile.release]
opt-level = 2
rpath = false
-lto = true
debug-assertions = false
panic = "abort"
diff --git toolkit/library/rust/Cargo.toml toolkit/library/rust/Cargo.toml
index f67669513d38..fd5668729199 100644
--- toolkit/library/rust/Cargo.toml
+++ toolkit/library/rust/Cargo.toml
@@ -40,6 +40,5 @@ panic = "abort"
[profile.release]
opt-level = 2
rpath = false
-lto = true
debug-assertions = false
panic = "abort"

View File

@ -0,0 +1,26 @@
commit c05f2d4f28e9
Author: Jonathan Kew <jkew@mozilla.com>
Date: Wed Mar 28 14:42:20 2018 +0100
Bug 1449157 - Guard against mContent being null in nsFrame::HandlePress. r=dholbert, a=jcristau
--HG--
extra : rebase_source : cee8a6f6ecce503cddf3492ffaf42bc317f1851c
extra : source : c09b8a694cb5d0442aa293eace75a18058b675d5
---
layout/generic/nsFrame.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git layout/generic/nsFrame.cpp layout/generic/nsFrame.cpp
index fd313f9a792f..5fa8bd9174e5 100644
--- layout/generic/nsFrame.cpp
+++ layout/generic/nsFrame.cpp
@@ -4275,7 +4275,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
// starting a new selection since the user may be trying to
// drag the selected region to some other app.
- if (GetContent()->IsSelectionDescendant())
+ if (GetContent() && GetContent()->IsSelectionDescendant())
{
bool inSelection = false;
UniquePtr<SelectionDetails> details