| Index: third_party/WebKit/Source/platform/fonts/UnicodeRangeSet.h
|
| diff --git a/third_party/WebKit/Source/platform/fonts/FontDataRange.h b/third_party/WebKit/Source/platform/fonts/UnicodeRangeSet.h
|
| similarity index 56%
|
| copy from third_party/WebKit/Source/platform/fonts/FontDataRange.h
|
| copy to third_party/WebKit/Source/platform/fonts/UnicodeRangeSet.h
|
| index 8eec0265401847ea0ed35c3273ac1ceaa37d615c..465358fb72b9868f9c9db7f447f687a43a37af3a 100644
|
| --- a/third_party/WebKit/Source/platform/fonts/FontDataRange.h
|
| +++ b/third_party/WebKit/Source/platform/fonts/UnicodeRangeSet.h
|
| @@ -1,5 +1,5 @@
|
| /*
|
| - * Copyright (C) 2008, 2009 Apple Inc. All rights reserved.
|
| + * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
|
| *
|
| * Redistribution and use in source and binary forms, with or without
|
| * modification, are permitted provided that the following conditions
|
| @@ -23,52 +23,56 @@
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
|
|
| -#ifndef FontDataRange_h
|
| -#define FontDataRange_h
|
| +#ifndef UnicodeRangeSet_h
|
| +#define UnicodeRangeSet_h
|
|
|
| -#include "platform/fonts/FontData.h"
|
| -#include "platform/fonts/SimpleFontData.h"
|
| +#include "platform/PlatformExport.h"
|
| +#include "platform/fonts/FontDataRange.h"
|
| #include "wtf/Allocator.h"
|
| -#include "wtf/text/CharacterNames.h"
|
| +#include "wtf/text/Unicode.h"
|
|
|
| namespace blink {
|
|
|
| -class SimpleFontData;
|
| -
|
| -struct FontDataRange {
|
| +struct PLATFORM_EXPORT UnicodeRange {
|
| DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
|
| - explicit FontDataRange(PassRefPtr<SimpleFontData> fontData)
|
| - : m_from(0)
|
| - , m_to(kMaxCodepoint)
|
| - , m_fontData(fontData)
|
| - {
|
| - }
|
| -
|
| - FontDataRange()
|
| - : m_from(0)
|
| - , m_to(kMaxCodepoint)
|
| - , m_fontData(nullptr)
|
| - {
|
| - }
|
| -
|
| - explicit FontDataRange(UChar32 from, UChar32 to, PassRefPtr<SimpleFontData> fontData)
|
| + UnicodeRange(UChar32 from, UChar32 to)
|
| : m_from(from)
|
| , m_to(to)
|
| - , m_fontData(fontData)
|
| {
|
| }
|
|
|
| UChar32 from() const { return m_from; }
|
| UChar32 to() const { return m_to; }
|
| - bool contains(UChar32 testChar) { return testChar >= m_from && testChar <= m_to; }
|
| - bool isEntireRange() const { return !m_from && m_to >= kMaxCodepoint; }
|
| - bool hasFontData() const { return fontData(); }
|
| - PassRefPtr<SimpleFontData> fontData() const { return m_fontData; }
|
| + bool contains(UChar32 c) const { return m_from <= c && c <= m_to; }
|
| + bool operator<(const UnicodeRange& other) const
|
| + {
|
| + return m_from < other.m_from;
|
| + }
|
| + bool operator<(UChar32 c) const { return m_to < c; }
|
| + bool operator==(const FontDataRange& fontDataRange) const
|
| + {
|
| + return fontDataRange.from() == m_from
|
| + && fontDataRange.to() == m_to;
|
| + };
|
|
|
| private:
|
| UChar32 m_from;
|
| UChar32 m_to;
|
| - RefPtr<SimpleFontData> m_fontData;
|
| +};
|
| +
|
| +class PLATFORM_EXPORT UnicodeRangeSet {
|
| + DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
|
| +
|
| +public:
|
| + explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
|
| + bool contains(UChar32) const;
|
| + bool contains(const FontDataRange&) const;
|
| + bool intersectsWith(const String&) const;
|
| + bool isEntireRange() const { return m_ranges.isEmpty(); }
|
| + size_t size() const { return m_ranges.size(); }
|
| + const UnicodeRange& rangeAt(size_t i) const { return m_ranges[i]; }
|
| +private:
|
| + Vector<UnicodeRange> m_ranges; // If empty, represents the whole code space.
|
| };
|
|
|
| } // namespace blink
|
|
|