/* -*- Mode: C++; tab-width: 2; 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/. */ //#define DEBUG_FIND 1 #include "nsFind.h" #include "nsContentCID.h" #include "nsIContent.h" #include "nsIDOMNode.h" #include "nsIDOMNodeList.h" #include "nsISelection.h" #include "nsISelectionController.h" #include "nsIFrame.h" #include "nsITextControlFrame.h" #include "nsIFormControl.h" #include "nsIEditor.h" #include "nsIPlaintextEditor.h" #include "nsTextFragment.h" #include "nsString.h" #include "nsIAtom.h" #include "nsServiceManagerUtils.h" #include "nsUnicharUtils.h" #include "nsIDOMElement.h" #include "nsIWordBreaker.h" #include "nsCRT.h" #include "nsRange.h" #include "nsContentUtils.h" #include "mozilla/DebugOnly.h" using namespace mozilla; // Yikes! Casting a char to unichar can fill with ones! #define CHAR_TO_UNICHAR(c) ((char16_t)(const unsigned char)c) static NS_DEFINE_CID(kCContentIteratorCID, NS_CONTENTITERATOR_CID); static NS_DEFINE_CID(kCPreContentIteratorCID, NS_PRECONTENTITERATOR_CID); #define CH_QUOTE ((char16_t) 0x22) #define CH_APOSTROPHE ((char16_t) 0x27) #define CH_LEFT_SINGLE_QUOTE ((char16_t) 0x2018) #define CH_RIGHT_SINGLE_QUOTE ((char16_t) 0x2019) #define CH_LEFT_DOUBLE_QUOTE ((char16_t) 0x201C) #define CH_RIGHT_DOUBLE_QUOTE ((char16_t) 0x201D) #define CH_SHY ((char16_t) 0xAD) // nsFind::Find casts CH_SHY to char before calling StripChars // This works correctly if and only if CH_SHY <= 255 PR_STATIC_ASSERT(CH_SHY <= 255); // ----------------------------------------------------------------------- // nsFindContentIterator is a special iterator that also goes through // any existing