| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 | 1784 |
| 1785 HeapVector<Member<Node>> matches; | 1785 HeapVector<Member<Node>> matches; |
| 1786 HitTestResult result(request, point, topPadding, rightPadding, bottomPadding, | 1786 HitTestResult result(request, point, topPadding, rightPadding, bottomPadding, |
| 1787 leftPadding); | 1787 leftPadding); |
| 1788 layoutViewItem.hitTest(result); | 1788 layoutViewItem.hitTest(result); |
| 1789 copyToVector(result.listBasedTestResult(), matches); | 1789 copyToVector(result.listBasedTestResult(), matches); |
| 1790 | 1790 |
| 1791 return StaticNodeList::adopt(matches); | 1791 return StaticNodeList::adopt(matches); |
| 1792 } | 1792 } |
| 1793 | 1793 |
| 1794 bool Internals::hasSpellingMarker(Document* document, int from, int length) { | 1794 void Internals::setSpellingMarker(Document* document, |
| 1795 ASSERT(document); | 1795 ExceptionState& exceptionState) { |
| 1796 if (!document->frame()) | 1796 if (!document || !document->frame()) { |
| 1797 exceptionState.throwDOMException( |
| 1798 InvalidAccessError, |
| 1799 "No frame can be obtained from the provided document."); |
| 1800 return; |
| 1801 } |
| 1802 |
| 1803 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1804 EphemeralRange range = |
| 1805 document->frame()->selection().selection().toNormalizedEphemeralRange(); |
| 1806 document->markers().addMarker(range.startPosition(), range.endPosition(), |
| 1807 DocumentMarker::Spelling); |
| 1808 } |
| 1809 |
| 1810 bool Internals::hasSpellingMarker(Document* document, |
| 1811 int from, |
| 1812 int length, |
| 1813 ExceptionState& exceptionState) { |
| 1814 if (!document || !document->frame()) { |
| 1815 exceptionState.throwDOMException( |
| 1816 InvalidAccessError, |
| 1817 "No frame can be obtained from the provided document."); |
| 1797 return false; | 1818 return false; |
| 1819 } |
| 1798 | 1820 |
| 1799 document->updateStyleAndLayoutIgnorePendingStylesheets(); | 1821 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1800 return document->frame()->spellChecker().selectionStartHasMarkerFor( | 1822 return document->frame()->spellChecker().selectionStartHasMarkerFor( |
| 1801 DocumentMarker::Spelling, from, length); | 1823 DocumentMarker::Spelling, from, length); |
| 1802 } | 1824 } |
| 1803 | 1825 |
| 1804 void Internals::setSpellCheckingEnabled(bool enabled) { | 1826 void Internals::setSpellCheckingEnabled(bool enabled, |
| 1805 if (!contextDocument() || !contextDocument()->frame()) | 1827 ExceptionState& exceptionState) { |
| 1828 if (!contextDocument() || !contextDocument()->frame()) { |
| 1829 exceptionState.throwDOMException( |
| 1830 InvalidAccessError, |
| 1831 "No frame can be obtained from the provided document."); |
| 1806 return; | 1832 return; |
| 1833 } |
| 1807 | 1834 |
| 1808 if (enabled != | 1835 if (enabled != |
| 1809 contextDocument()->frame()->spellChecker().isSpellCheckingEnabled()) | 1836 contextDocument()->frame()->spellChecker().isSpellCheckingEnabled()) |
| 1810 contextDocument()->frame()->spellChecker().toggleSpellCheckingEnabled(); | 1837 contextDocument()->frame()->spellChecker().toggleSpellCheckingEnabled(); |
| 1811 } | 1838 } |
| 1812 | 1839 |
| 1840 void Internals::replaceMisspelled(Document* document, |
| 1841 const String& replacement, |
| 1842 ExceptionState& exceptionState) { |
| 1843 if (!document || !document->frame()) { |
| 1844 exceptionState.throwDOMException( |
| 1845 InvalidAccessError, |
| 1846 "No frame can be obtained from the provided document."); |
| 1847 return; |
| 1848 } |
| 1849 |
| 1850 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1851 document->frame()->spellChecker().replaceMisspelledRange(replacement); |
| 1852 } |
| 1853 |
| 1813 bool Internals::canHyphenate(const AtomicString& locale) { | 1854 bool Internals::canHyphenate(const AtomicString& locale) { |
| 1814 return LayoutLocale::valueOrDefault(LayoutLocale::get(locale)) | 1855 return LayoutLocale::valueOrDefault(LayoutLocale::get(locale)) |
| 1815 .getHyphenation(); | 1856 .getHyphenation(); |
| 1816 } | 1857 } |
| 1817 | 1858 |
| 1818 void Internals::setMockHyphenation(const AtomicString& locale) { | 1859 void Internals::setMockHyphenation(const AtomicString& locale) { |
| 1819 LayoutLocale::setHyphenationForTesting(locale, adoptRef(new MockHyphenation)); | 1860 LayoutLocale::setHyphenationForTesting(locale, adoptRef(new MockHyphenation)); |
| 1820 } | 1861 } |
| 1821 | 1862 |
| 1822 bool Internals::isOverwriteModeEnabled(Document* document) { | 1863 bool Internals::isOverwriteModeEnabled(Document* document) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1840 } | 1881 } |
| 1841 | 1882 |
| 1842 unsigned Internals::numberOfLiveDocuments() const { | 1883 unsigned Internals::numberOfLiveDocuments() const { |
| 1843 return InstanceCounters::counterValue(InstanceCounters::DocumentCounter); | 1884 return InstanceCounters::counterValue(InstanceCounters::DocumentCounter); |
| 1844 } | 1885 } |
| 1845 | 1886 |
| 1846 String Internals::dumpRefCountedInstanceCounts() const { | 1887 String Internals::dumpRefCountedInstanceCounts() const { |
| 1847 return WTF::dumpRefCountedInstanceCounts(); | 1888 return WTF::dumpRefCountedInstanceCounts(); |
| 1848 } | 1889 } |
| 1849 | 1890 |
| 1850 bool Internals::hasGrammarMarker(Document* document, int from, int length) { | 1891 bool Internals::hasGrammarMarker(Document* document, |
| 1851 ASSERT(document); | 1892 int from, |
| 1852 if (!document->frame()) | 1893 int length, |
| 1894 ExceptionState& exceptionState) { |
| 1895 if (!document || !document->frame()) { |
| 1896 exceptionState.throwDOMException( |
| 1897 InvalidAccessError, |
| 1898 "No frame can be obtained from the provided document."); |
| 1853 return false; | 1899 return false; |
| 1900 } |
| 1854 | 1901 |
| 1855 document->updateStyleAndLayoutIgnorePendingStylesheets(); | 1902 document->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1856 return document->frame()->spellChecker().selectionStartHasMarkerFor( | 1903 return document->frame()->spellChecker().selectionStartHasMarkerFor( |
| 1857 DocumentMarker::Grammar, from, length); | 1904 DocumentMarker::Grammar, from, length); |
| 1858 } | 1905 } |
| 1859 | 1906 |
| 1860 unsigned Internals::numberOfScrollableAreas(Document* document) { | 1907 unsigned Internals::numberOfScrollableAreas(Document* document) { |
| 1861 ASSERT(document); | 1908 ASSERT(document); |
| 1862 if (!document->frame()) | 1909 if (!document->frame()) |
| 1863 return 0; | 1910 return 0; |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 return ClientRect::create(); | 3058 return ClientRect::create(); |
| 3012 | 3059 |
| 3013 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); | 3060 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); |
| 3014 } | 3061 } |
| 3015 | 3062 |
| 3016 void Internals::crash() { | 3063 void Internals::crash() { |
| 3017 CHECK(false) << "Intentional crash"; | 3064 CHECK(false) << "Intentional crash"; |
| 3018 } | 3065 } |
| 3019 | 3066 |
| 3020 } // namespace blink | 3067 } // namespace blink |
| OLD | NEW |