Changeset 88332 in webkit
- Timestamp:
- Jun 8, 2011 1:54:12 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88331 r88332 1 2011-06-08 Hironori Bono <hbono@chromium.org> 2 3 Reviewed by Brent Fulgham. 4 5 Add SpellCheck API 6 https://bugs.webkit.org/show_bug.cgi?id=59693 7 8 This change adds two SpellCheck API functions (addSpellcheckRange and 9 removeSpellcheckRange) and one attribute (spellcheckRange) discussed in 10 the public-webapps ML. This change is currently available only on Chromium. 11 12 * editing/spelling/spellcheck-api-expected.txt: Added. 13 * editing/spelling/spellcheck-api-pixel.html: Added. 14 * editing/spelling/spellcheck-api.html: Added. 15 * platform/chromium/test_expectations.txt: 16 * platform/gtk/Skipped: 17 * platform/mac/Skipped: 18 * platform/qt/Skipped: 19 * platform/win/Skipped: 20 1 21 2011-06-07 Andrey Kosyakov <caseq@chromium.org> 2 22 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r88323 r88332 746 746 BUGCR58254 MAC : platform/mac/editing/spelling/autocorrection-removing-underline.html = IMAGE+TEXT 747 747 BUGCR58254 MAC : platform/mac/editing/spelling/autocorrection-simple.html = IMAGE+TEXT 748 749 // Needs rebaseline 750 BUGMORRITA : editing/spelling/spellcheck-api-pixel.html = MISSING 748 751 749 752 // Directionality of mixed-direction text in selected choice should -
trunk/LayoutTests/platform/gtk/Skipped
r88255 r88332 395 395 storage/storageinfo-request-quota.html 396 396 storage/storageinfo-no-callbacks.html 397 398 # Spellcheck API is not implemented. 399 editing/spelling/spellcheck-api.html 400 editing/spelling/spellcheck-api-pixel.html 397 401 398 402 # This platform does not support the Page Visibility API. -
trunk/LayoutTests/platform/mac/Skipped
r88144 r88332 341 341 storage/storageinfo-no-callbacks.html 342 342 343 # Spellcheck API is not implemented. 344 editing/spelling/spellcheck-api.html 345 editing/spelling/spellcheck-api-pixel.html 346 343 347 # Expose title direction in WebKit API 344 348 # https://bugs.webkit.org/show_bug.cgi?id=58845 -
trunk/LayoutTests/platform/qt/Skipped
r88327 r88332 2448 2448 http/tests/misc/redirect-to-external-url.html 2449 2449 2450 # Spellcheck API is not implemented. 2451 editing/spelling/spellcheck-api.html 2452 editing/spelling/spellcheck-api-pixel.html 2453 2450 2454 # Expose title direction in WebKit API 2451 2455 # https://bugs.webkit.org/show_bug.cgi?id=58845 -
trunk/LayoutTests/platform/win/Skipped
r88331 r88332 1269 1269 storage/storageinfo-no-callbacks.html 1270 1270 1271 # Spellcheck API is not implemented. 1272 editing/spelling/spellcheck-api.html 1273 editing/spelling/spellcheck-api-pixel.html 1274 1271 1275 # Expose title direction in WebKit API 1272 1276 # https://bugs.webkit.org/show_bug.cgi?id=58845 -
trunk/Source/WebCore/ChangeLog
r88331 r88332 1 2011-06-08 Hironori Bono <hbono@chromium.org> 2 3 Reviewed by Brent Fulgham. 4 5 Add SpellCheck API 6 https://bugs.webkit.org/show_bug.cgi?id=59693 7 8 This change adds two SpellCheck API functions (addSpellcheckRange and 9 removeSpellcheckRange) and one attribute (spellcheckRange) discussed in 10 the public-webapps ML. This change is currently available only on Chromium. 11 12 Tests: editing/spelling/spellcheck-api-pixel.html 13 editing/spelling/spellcheck-api.html 14 15 * WebCore.gypi: 16 * bindings/generic/RuntimeEnabledFeatures.cpp: 17 * bindings/generic/RuntimeEnabledFeatures.h: 18 (WebCore::RuntimeEnabledFeatures::spellCheckAPIEnabled): 19 (WebCore::RuntimeEnabledFeatures::setSpellCheckAPIEnabled): 20 * dom/DocumentMarker.h: 21 (WebCore::DocumentMarker::length): 22 * dom/DocumentMarkerController.cpp: 23 (WebCore::DocumentMarkerController::userSpellingMarkersForNode): 24 (WebCore::DocumentMarkerController::addUserSpellingMarker): 25 (WebCore::DocumentMarkerController::removeUserSpellingMarker): 26 (WebCore::DocumentMarkerController::userSpellingNode): 27 * dom/DocumentMarkerController.h: 28 * html/HTMLDivElement.cpp: 29 (WebCore::HTMLDivElement::spellcheckRanges): 30 (WebCore::HTMLDivElement::addSpellcheckRange): 31 (WebCore::HTMLDivElement::removeSpellcheckRange): 32 * html/HTMLDivElement.h: 33 * html/HTMLDivElement.idl: 34 * html/HTMLInputElement.cpp: 35 (WebCore::HTMLInputElement::spellcheckRanges): 36 (WebCore::HTMLInputElement::addSpellcheckRange): 37 (WebCore::HTMLInputElement::removeSpellcheckRange): 38 * html/HTMLInputElement.h: 39 * html/HTMLInputElement.idl: 40 * html/HTMLTextAreaElement.cpp: 41 (WebCore::HTMLTextAreaElement::spellcheckRanges): 42 (WebCore::HTMLTextAreaElement::addSpellcheckRange): 43 (WebCore::HTMLTextAreaElement::removeSpellcheckRange): 44 * html/HTMLTextAreaElement.h: 45 * html/HTMLTextAreaElement.idl: 46 * html/SpellcheckRange.cpp: Added. 47 (WebCore::SpellcheckRange::SpellcheckRange): 48 (WebCore::SpellcheckRange::~SpellcheckRange): 49 * html/SpellcheckRange.h: Added. 50 (WebCore::SpellcheckRange::create): 51 (WebCore::SpellcheckRange::start): 52 (WebCore::SpellcheckRange::length): 53 (WebCore::SpellcheckRange::suggestions): 54 (WebCore::SpellcheckRange::options): 55 * html/SpellcheckRange.idl: Added. 56 * html/SpellcheckRangeList.cpp: Added. 57 (WebCore::SpellcheckRangeList::SpellcheckRangeList): 58 (WebCore::SpellcheckRangeList::~SpellcheckRangeList): 59 (WebCore::SpellcheckRangeList::item): 60 * html/SpellcheckRangeList.h: Added. 61 (WebCore::SpellcheckRangeList::create): 62 (WebCore::SpellcheckRangeList::isEmpty): 63 (WebCore::SpellcheckRangeList::clear): 64 (WebCore::SpellcheckRangeList::append): 65 (WebCore::SpellcheckRangeList::remove): 66 (WebCore::SpellcheckRangeList::length): 67 * html/SpellcheckRangeList.idl: Added. 68 * rendering/InlineTextBox.cpp: 69 (WebCore::textCheckingLineStyleForMarkerType): 70 (WebCore::InlineTextBox::paintDocumentMarkers): 71 1 72 2011-06-07 Andrey Kosyakov <caseq@chromium.org> 2 73 -
trunk/Source/WebCore/WebCore.gypi
r88307 r88332 1296 1296 'html/MediaError.idl', 1297 1297 'html/TextMetrics.idl', 1298 'html/SpellcheckRange.idl', 1299 'html/SpellcheckRangeList.idl', 1298 1300 'html/TimeRanges.idl', 1299 1301 'html/ValidityState.idl', … … 3048 3050 'html/SearchInputType.cpp', 3049 3051 'html/SearchInputType.h', 3052 'html/SpellcheckRange.cpp', 3053 'html/SpellcheckRange.h', 3054 'html/SpellcheckRangeList.cpp', 3055 'html/SpellcheckRangeList.h', 3050 3056 'html/StepRange.cpp', 3051 3057 'html/StepRange.h', … … 7857 7863 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpeechInputResultList.cpp', 7858 7864 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpeechInputResultList.h', 7865 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpellcheckRange.cpp', 7866 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpellcheckRange.h', 7867 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpellcheckRangeList.cpp', 7868 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSSpellcheckRangeList.h', 7859 7869 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorage.cpp', 7860 7870 '<(PRODUCT_DIR)/DerivedSources/WebCore/JSStorage.h', -
trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
r84247 r88332 147 147 #endif 148 148 149 #if ENABLE(SPELLCHECK_API) 150 bool RuntimeEnabledFeatures::isSpellCheckAPIEnabled = false; 151 #endif 152 149 153 } // namespace WebCore -
trunk/Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
r84247 r88332 156 156 #endif 157 157 158 #if ENABLE(SPELLCHECK_API) 159 static bool spellCheckAPIEnabled() { return isSpellCheckAPIEnabled; } 160 static void setSpellCheckAPIEnabled(bool isEnabled) { isSpellCheckAPIEnabled = isEnabled; } 161 #endif 162 158 163 private: 159 164 // Never instantiate. … … 192 197 static bool isQuotaEnabled; 193 198 #endif 199 200 #if ENABLE(SPELLCHECK_API) 201 static bool isSpellCheckAPIEnabled; 202 #endif 194 203 }; 195 204 -
trunk/Source/WebCore/dom/DocumentMarker.h
r86813 r88332 60 60 // word again at this position, it will not be autocorrected again. The description of this 61 61 // marker is the original word before autocorrection was applied. 62 DeletedAutocorrection = 1 << 8 62 DeletedAutocorrection = 1 << 8, 63 // A misspelled marker added by users with the SpellCheck API. (Even though 64 // this marker is almost identical to the above Spelling marker, we need 65 // another type for user-added markers because it raises privacy concerns 66 // to provide a list of system-added markers.) 67 UserSpelling = 1 << 9, 63 68 }; 64 69 … … 98 103 bool hasDescription() const { return !m_description.isEmpty(); } 99 104 bool activeMatch() const { return m_activeMatch; } 105 unsigned length() const 106 { 107 ASSERT(m_endOffset >= m_startOffset); 108 return m_endOffset - m_startOffset; 109 } 100 110 101 111 void setActiveMatch(bool); -
trunk/Source/WebCore/dom/DocumentMarkerController.cpp
r87483 r88332 32 32 #include "RenderObject.h" 33 33 #include "RenderedDocumentMarker.h" 34 #include "SpellcheckRange.h" 35 #include "SpellcheckRangeList.h" 34 36 #include "TextIterator.h" 35 37 … … 654 656 } 655 657 658 #if ENABLE(SPELLCHECK_API) 659 PassRefPtr<SpellcheckRangeList> DocumentMarkerController::userSpellingMarkersForNode(Node* node) const 660 { 661 RefPtr<SpellcheckRangeList> result = SpellcheckRangeList::create(); 662 663 MarkerList* list = m_markers.get(userSpellingNode(node)); 664 if (!list) 665 return result; 666 667 for (size_t i = 0; i < list->size(); ++i) { 668 const DocumentMarker& marker = list->at(i); 669 if (marker.length() > 0) { 670 RefPtr<DOMStringList> suggestions = DOMStringList::create(); 671 Vector<String> descriptions; 672 marker.description().split('\n', descriptions); 673 for (size_t j = 0; j < descriptions.size(); ++j) 674 suggestions->append(descriptions[j]); 675 result->append(SpellcheckRange::create(marker.startOffset(), marker.length(), suggestions.release(), 0)); 676 } 677 } 678 679 return result; 680 } 681 682 bool DocumentMarkerController::addUserSpellingMarker(Node* node, unsigned start, unsigned length, RefPtr<DOMStringList> suggestions, unsigned options) 683 { 684 if (!node || !length) 685 return false; 686 687 Node* spellingNode = userSpellingNode(node); 688 if (!spellingNode) 689 return false; 690 691 // Serialize the suggestions into text until the DocumentMarker class supports multiple descriptions. 692 String description; 693 for (size_t i = 0; i < suggestions->length(); i++) { 694 description += suggestions->item(i); 695 description.append('\n'); 696 } 697 addMarker(spellingNode, DocumentMarker(DocumentMarker::UserSpelling, start, start + length, description)); 698 699 UNUSED_PARAM(options); 700 return true; 701 } 702 703 void DocumentMarkerController::removeUserSpellingMarker(Node* node, unsigned start, unsigned length) 704 { 705 if (!node || !length) 706 return; 707 708 Node* spellingNode = userSpellingNode(node); 709 if (!spellingNode) 710 return; 711 712 removeMarkers(spellingNode, start, length, DocumentMarker::UserSpelling, DoNotRemovePartiallyOverlappingMarker); 713 } 714 715 Node* DocumentMarkerController::userSpellingNode(Node* node) const 716 { 717 for (const RenderObject* renderer = node->renderer(); renderer; renderer = renderer->childAt(0)) { 718 if (renderer->isText()) 719 return renderer->node(); 720 } 721 return 0; 722 } 723 #endif 724 656 725 #ifndef NDEBUG 657 726 void DocumentMarkerController::showMarkers() const -
trunk/Source/WebCore/dom/DocumentMarkerController.h
r87483 r88332 40 40 class RenderedDocumentMarker; 41 41 42 #if ENABLE(SPELLCHECK_API) 43 class DOMStringList; 44 class SpellcheckRangeList; 45 #endif 46 42 47 class DocumentMarkerController { 43 48 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED; … … 77 82 void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes); 78 83 84 #if ENABLE(SPELLCHECK_API) 85 PassRefPtr<SpellcheckRangeList> userSpellingMarkersForNode(Node*) const; 86 bool addUserSpellingMarker(Node*, unsigned startOffset, unsigned length, RefPtr<DOMStringList>, unsigned option); 87 void removeUserSpellingMarker(Node*, unsigned startOffset, unsigned length); 88 #endif 89 79 90 #ifndef NDEBUG 80 91 void showMarkers() const; … … 83 94 private: 84 95 void addMarker(Node*, const DocumentMarker&); 96 97 #if ENABLE(SPELLCHECK_API) 98 Node* userSpellingNode(Node*) const; 99 #endif 85 100 86 101 typedef Vector<RenderedDocumentMarker> MarkerList; -
trunk/Source/WebCore/html/HTMLDivElement.cpp
r61959 r88332 27 27 #include "CSSPropertyNames.h" 28 28 #include "CSSValueKeywords.h" 29 #include "DOMStringList.h" 30 #include "DocumentMarkerController.h" 29 31 #include "HTMLNames.h" 32 #include "SpellcheckRange.h" 33 #include "SpellcheckRangeList.h" 30 34 31 35 namespace WebCore { … … 74 78 } 75 79 80 #if ENABLE(SPELLCHECK_API) 81 PassRefPtr<SpellcheckRangeList> HTMLDivElement::spellcheckRanges() 82 { 83 return document()->markers()->userSpellingMarkersForNode(this); 76 84 } 85 86 void HTMLDivElement::addSpellcheckRange(unsigned long start, unsigned long length) 87 { 88 addSpellcheckRange(start, length, DOMStringList::create(), 0); 89 } 90 91 void HTMLDivElement::addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList> suggestions, unsigned short options) 92 { 93 document()->markers()->addUserSpellingMarker(this, start, length, suggestions, options); 94 } 95 96 void HTMLDivElement::removeSpellcheckRange(RefPtr<SpellcheckRange> range) 97 { 98 document()->markers()->removeUserSpellingMarker(this, range->start(), range->length()); 99 } 100 #endif 101 102 } -
trunk/Source/WebCore/html/HTMLDivElement.h
r66057 r88332 28 28 namespace WebCore { 29 29 30 #if ENABLE(SPELLCHECK_API) 31 class DOMStringList; 32 class SpellcheckRange; 33 class SpellcheckRangeList; 34 #endif 35 30 36 class HTMLDivElement : public HTMLElement { 31 37 public: 32 38 static PassRefPtr<HTMLDivElement> create(Document*); 33 39 static PassRefPtr<HTMLDivElement> create(const QualifiedName&, Document*); 40 41 #if ENABLE(SPELLCHECK_API) 42 PassRefPtr<SpellcheckRangeList> spellcheckRanges(); 43 void addSpellcheckRange(unsigned long start, unsigned long length); 44 void addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList>, unsigned short options = 0); 45 void removeSpellcheckRange(RefPtr<SpellcheckRange>); 46 #endif 34 47 35 48 protected: -
trunk/Source/WebCore/html/HTMLDivElement.idl
r61413 r88332 22 22 interface HTMLDivElement : HTMLElement { 23 23 attribute [Reflect] DOMString align; 24 25 #if defined(ENABLE_SPELLCHECK_API) && ENABLE_SPELLCHECK_API 26 readonly attribute SpellcheckRangeList spellcheckRanges; 27 void addSpellcheckRange(in unsigned long start, in unsigned long length, in [Optional] DOMStringList suggestions, in [Optional] unsigned short options); 28 void removeSpellcheckRange(in SpellcheckRange range); 29 #endif 24 30 }; 25 31 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r88329 r88332 35 35 #include "ChromeClient.h" 36 36 #include "CSSPropertyNames.h" 37 #include "DOMStringList.h" 37 38 #include "Document.h" 39 #include "DocumentMarkerController.h" 38 40 #include "EventNames.h" 39 41 #include "ExceptionCode.h" … … 56 58 #include "RuntimeEnabledFeatures.h" 57 59 #include "ScriptEventListener.h" 60 #include "SpellcheckRange.h" 61 #include "SpellcheckRangeList.h" 58 62 #include "WheelEvent.h" 59 63 #include <wtf/MathExtras.h> … … 1840 1844 } 1841 1845 1846 #if ENABLE(SPELLCHECK_API) 1847 PassRefPtr<SpellcheckRangeList> HTMLInputElement::spellcheckRanges() 1848 { 1849 return document()->markers()->userSpellingMarkersForNode(this); 1850 } 1851 1852 void HTMLInputElement::addSpellcheckRange(unsigned long start, unsigned long length) 1853 { 1854 addSpellcheckRange(start, length, DOMStringList::create(), 0); 1855 } 1856 1857 void HTMLInputElement::addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList> suggestions, unsigned short options) 1858 { 1859 document()->markers()->addUserSpellingMarker(this, start, length, suggestions, options); 1860 } 1861 1862 void HTMLInputElement::removeSpellcheckRange(RefPtr<SpellcheckRange> range) 1863 { 1864 document()->markers()->removeUserSpellingMarker(this, range->start(), range->length()); 1865 } 1866 #endif 1867 1842 1868 } // namespace -
trunk/Source/WebCore/html/HTMLInputElement.h
r88329 r88332 34 34 class InputType; 35 35 class KURL; 36 37 #if ENABLE(SPELLCHECK_API) 38 class DOMStringList; 39 class SpellcheckRange; 40 class SpellcheckRangeList; 41 #endif 36 42 37 43 class HTMLInputElement : public HTMLTextFormControlElement { … … 228 234 void cacheSelection(int start, int end); 229 235 236 #if ENABLE(SPELLCHECK_API) 237 PassRefPtr<SpellcheckRangeList> spellcheckRanges(); 238 void addSpellcheckRange(unsigned long start, unsigned long length); 239 void addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList>, unsigned short options = 0); 240 void removeSpellcheckRange(RefPtr<SpellcheckRange>); 241 #endif 242 230 243 static const int maximumLength; 231 244 -
trunk/Source/WebCore/html/HTMLInputElement.idl
r73168 r88332 108 108 attribute [DontEnum] EventListener onwebkitspeechchange; 109 109 #endif 110 111 #if defined(ENABLE_SPELLCHECK_API) && ENABLE_SPELLCHECK_API 112 readonly attribute SpellcheckRangeList spellcheckRanges; 113 void addSpellcheckRange(in unsigned long start, in unsigned long length, in [Optional] DOMStringList suggestions, in [Optional] unsigned short options); 114 void removeSpellcheckRange(in SpellcheckRange range); 115 #endif 110 116 }; 111 117 -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r87067 r88332 32 32 #include "Chrome.h" 33 33 #include "ChromeClient.h" 34 #include "DOMStringList.h" 34 35 #include "Document.h" 36 #include "DocumentMarkerController.h" 35 37 #include "Event.h" 36 38 #include "EventNames.h" … … 45 47 #include "ScriptEventListener.h" 46 48 #include "ShadowRoot.h" 49 #include "SpellcheckRange.h" 50 #include "SpellcheckRangeList.h" 47 51 #include "Text.h" 48 52 #include "TextControlInnerElements.h" … … 441 445 } 442 446 447 #if ENABLE(SPELLCHECK_API) 448 PassRefPtr<SpellcheckRangeList> HTMLTextAreaElement::spellcheckRanges() 449 { 450 return document()->markers()->userSpellingMarkersForNode(this); 451 } 452 453 void HTMLTextAreaElement::addSpellcheckRange(unsigned long start, unsigned long length) 454 { 455 addSpellcheckRange(start, length, DOMStringList::create(), 0); 456 } 457 458 void HTMLTextAreaElement::addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList> suggestions, unsigned short options) 459 { 460 document()->markers()->addUserSpellingMarker(this, start, length, suggestions, options); 461 } 462 463 void HTMLTextAreaElement::removeSpellcheckRange(RefPtr<SpellcheckRange> range) 464 { 465 document()->markers()->removeUserSpellingMarker(this, range->start(), range->length()); 466 } 467 #endif 468 443 469 } // namespace -
trunk/Source/WebCore/html/HTMLTextAreaElement.h
r87067 r88332 32 32 class VisibleSelection; 33 33 34 #if ENABLE(SPELLCHECK_API) 35 class DOMStringList; 36 class SpellcheckRange; 37 class SpellcheckRangeList; 38 #endif 39 34 40 class HTMLTextAreaElement : public HTMLTextFormControlElement { 35 41 public: … … 60 66 61 67 void cacheSelection(int s, int e) { m_cachedSelectionStart = s; m_cachedSelectionEnd = e; }; 68 69 #if ENABLE(SPELLCHECK_API) 70 PassRefPtr<SpellcheckRangeList> spellcheckRanges(); 71 void addSpellcheckRange(unsigned long start, unsigned long length); 72 void addSpellcheckRange(unsigned long start, unsigned long length, RefPtr<DOMStringList>, unsigned short options = 0); 73 void removeSpellcheckRange(RefPtr<SpellcheckRange>); 74 #endif 62 75 63 76 private: -
trunk/Source/WebCore/html/HTMLTextAreaElement.idl
r61959 r88332 51 51 void setSelectionRange(in long start, in long end); 52 52 readonly attribute NodeList labels; 53 54 #if defined(ENABLE_SPELLCHECK_API) && ENABLE_SPELLCHECK_API 55 readonly attribute SpellcheckRangeList spellcheckRanges; 56 void addSpellcheckRange(in unsigned long start, in unsigned long length, in [Optional] DOMStringList suggestions, in [Optional] unsigned short options); 57 void removeSpellcheckRange(in SpellcheckRange range); 58 #endif 53 59 }; 54 60 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r88319 r88332 964 964 switch (markerType) { 965 965 case DocumentMarker::Spelling: 966 case DocumentMarker::UserSpelling: 966 967 return GraphicsContext::TextCheckingSpellingLineStyle; 967 968 case DocumentMarker::Grammar: … … 1105 1106 case DocumentMarker::Grammar: 1106 1107 case DocumentMarker::Spelling: 1108 case DocumentMarker::UserSpelling: 1107 1109 case DocumentMarker::CorrectionIndicator: 1108 1110 case DocumentMarker::Replacement: … … 1130 1132 switch (marker->type()) { 1131 1133 case DocumentMarker::Spelling: 1134 case DocumentMarker::UserSpelling: 1132 1135 paintSpellingOrGrammarMarker(pt, boxOrigin, marker, style, font, false); 1133 1136 break; -
trunk/Source/WebKit/chromium/ChangeLog
r88320 r88332 1 2011-06-08 Hironori Bono <hbono@chromium.org> 2 3 Reviewed by Brent Fulgham. 4 5 Add SpellCheck API 6 https://bugs.webkit.org/show_bug.cgi?id=59693 7 8 This change adds two SpellCheck API functions (addSpellcheckRange and 9 removeSpellcheckRange) and one attribute (spellcheckRange) discussed in 10 the public-webapps ML. This change is currently available only on Chromium. 11 12 * features.gypi: 13 * public/WebRuntimeFeatures.h: 14 * src/ContextMenuClientImpl.cpp: 15 (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): 16 * src/WebRuntimeFeatures.cpp: 17 (WebKit::WebRuntimeFeatures::enableSpellCheckAPI): 18 (WebKit::WebRuntimeFeatures::isSpellCheckAPIEnabled): 19 1 20 2011-06-07 James Kozianski <koz@chromium.org> 2 21 -
trunk/Source/WebKit/chromium/features.gypi
r88271 r88332 84 84 'ENABLE_REQUEST_ANIMATION_FRAME=1', 85 85 'ENABLE_SHARED_WORKERS=1', 86 'ENABLE_SPELLCHECK_API=1', 86 87 'ENABLE_SVG=1', 87 88 'ENABLE_SVG_ANIMATION=1', -
trunk/Source/WebKit/chromium/public/WebRuntimeFeatures.h
r84247 r88332 104 104 WEBKIT_API static bool isQuotaEnabled(); 105 105 106 WEBKIT_API static void enableSpellCheckAPI(bool); 107 WEBKIT_API static bool isSpellCheckAPIEnabled(); 108 106 109 private: 107 110 WebRuntimeFeatures(); -
trunk/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp
r88030 r88332 38 38 #include "Document.h" 39 39 #include "DocumentLoader.h" 40 #include "DocumentMarkerController.h" 40 41 #include "Editor.h" 41 42 #include "EventHandler.h" … … 260 261 if (r.isContentEditable()) { 261 262 data.isEditable = true; 262 if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { 263 // If the selected text has markers added by Spellcheck API, use their description as suggestions. 264 RefPtr<Range> range = selectedFrame->selection()->toNormalizedRange(); 265 Vector<DocumentMarker*> markers = selectedFrame->document()->markers()->markersInRange(range.get(), DocumentMarker::UserSpelling); 266 if (!markers.isEmpty()) { 267 Vector<String> suggestions; 268 for (size_t i = 0; i < markers.size(); ++i) { 269 if (markers[i]->hasDescription()) { 270 Vector<String> descriptions; 271 markers[i]->description().split('\n', descriptions); 272 suggestions.append(descriptions); 273 } 274 } 275 data.dictionarySuggestions = suggestions; 276 data.misspelledWord = range->text(); 277 } else if (m_webView->focusedWebCoreFrame()->editor()->isContinuousSpellCheckingEnabled()) { 263 278 data.isSpellCheckingEnabled = true; 264 279 // Spellchecking might be enabled for the field, but could be disabled on the node. -
trunk/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp
r84247 r88332 337 337 } 338 338 339 void WebRuntimeFeatures::enableSpellCheckAPI(bool enable) 340 { 341 #if ENABLE(SPELLCHECK_API) 342 RuntimeEnabledFeatures::setSpellCheckAPIEnabled(enable); 343 #else 344 UNUSED_PARAM(enable); 345 #endif 346 } 347 348 bool WebRuntimeFeatures::isSpellCheckAPIEnabled() 349 { 350 #if ENABLE(SPELLCHECK_API) 351 return RuntimeEnabledFeatures::spellCheckAPIEnabled(); 352 #else 353 return false; 354 #endif 355 } 356 339 357 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.