| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/text/Hyphenation.h" | 5 #include "platform/text/Hyphenation.h" |
| 6 | 6 |
| 7 #include <CoreFoundation/CoreFoundation.h> |
| 7 #include "wtf/RetainPtr.h" | 8 #include "wtf/RetainPtr.h" |
| 8 #include "wtf/text/StringView.h" | 9 #include "wtf/text/StringView.h" |
| 9 #include <CoreFoundation/CoreFoundation.h> | |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class HyphenationCF : public Hyphenation { | 13 class HyphenationCF : public Hyphenation { |
| 14 public: | 14 public: |
| 15 HyphenationCF(RetainPtr<CFLocaleRef>& localeCF) : m_localeCF(localeCF) { | 15 HyphenationCF(RetainPtr<CFLocaleRef>& localeCF) : m_localeCF(localeCF) { |
| 16 DCHECK(m_localeCF); | 16 DCHECK(m_localeCF); |
| 17 } | 17 } |
| 18 | 18 |
| 19 size_t lastHyphenLocation(const StringView& text, | 19 size_t lastHyphenLocation(const StringView& text, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 const AtomicString& locale) { | 32 const AtomicString& locale) { |
| 33 RetainPtr<CFStringRef> localeCFString = locale.impl()->createCFString(); | 33 RetainPtr<CFStringRef> localeCFString = locale.impl()->createCFString(); |
| 34 RetainPtr<CFLocaleRef> localeCF = | 34 RetainPtr<CFLocaleRef> localeCF = |
| 35 adoptCF(CFLocaleCreate(kCFAllocatorDefault, localeCFString.get())); | 35 adoptCF(CFLocaleCreate(kCFAllocatorDefault, localeCFString.get())); |
| 36 if (!CFStringIsHyphenationAvailableForLocale(localeCF.get())) | 36 if (!CFStringIsHyphenationAvailableForLocale(localeCF.get())) |
| 37 return nullptr; | 37 return nullptr; |
| 38 return adoptRef(new HyphenationCF(localeCF)); | 38 return adoptRef(new HyphenationCF(localeCF)); |
| 39 } | 39 } |
| 40 | 40 |
| 41 } // namespace blink | 41 } // namespace blink |
| OLD | NEW |