WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
patch.diff (text/plain), 11.27 KB, created by
Shinya Kawanaka
on 2011-11-08 03:37:07 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Shinya Kawanaka
Created:
2011-11-08 03:37:07 PST
Size:
11.27 KB
patch
obsolete
>diff --git a/LayoutTests/editing/spelling/markers.html b/LayoutTests/editing/spelling/markers.html >new file mode 100644 >index 0000000..c0943ba >--- /dev/null >+++ b/LayoutTests/editing/spelling/markers.html >@@ -0,0 +1,83 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<style> >+.editing { >+ border: 2px solid red; >+ padding: 12px; >+ font-size: 24px; >+} >+</style> >+<script src="../editing.js" language="JavaScript" type="text/JavaScript" ></script> >+<script src="../../fast/js/resources/js-test-pre.js"></script> >+</head> >+<body> >+<pre id="description"></pre> >+<pre id="console"></pre> >+<div id="container"> >+</div> >+ >+<script> >+if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+ >+function createEditableElement(id, parent) { >+ var e = document.createElement('div'); >+ e.setAttribute("contentEditable", "true"); >+ e.className = 'editing'; >+ e.id = id; >+ >+ parent.appendChild(e); >+ return e; >+} >+ >+function typeText(elem, text) { >+ elem.focus(); >+ for (var i = 0; i < text.length; ++i) { >+ typeCharacterCommand(text[i]); >+ } >+} >+ >+var container = document.getElementById('container'); >+var range; >+ >+debug("Grammar Error Only"); >+var id = 'id1' >+var e = createEditableElement(id, container); >+typeText(e, 'I have a issue.'); >+if (window.internals) { >+ shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '0'); >+ shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '1'); >+ range = internals.markerRangeForNode(e.firstChild, "grammar", 0); >+ shouldBe("range.toString()", '"a"'); >+} >+ >+debug("Spelling Error Only"); >+var id = 'id2' >+var e = createEditableElement(id, container); >+typeText(e, 'zz.'); >+if (window.internals) { >+ shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '1'); >+ range = internals.markerRangeForNode(e.firstChild, "spelling", 0); >+ shouldBe('range.toString()', '"zz"'); >+ shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '0'); >+} >+ >+debug("Grammar and Spelling Error"); >+var id = 'id3' >+var e = createEditableElement(id, container); >+typeText(e, 'orange,zz,apple.'); >+if (window.internals) { >+ shouldBe('internals.markerCountForNode(e.firstChild, "spelling")', '1'); >+ range = internals.markerRangeForNode(e.firstChild, "spelling", 0); >+ shouldBe('range.toString()', '"zz"'); >+ shouldBe('internals.markerCountForNode(e.firstChild, "grammar")', '1'); >+ range = internals.markerRangeForNode(e.firstChild, "grammar", 0); >+ shouldBe('range.toString()', '"orange,zz,apple."'); >+} >+ >+var successfullyParsed = true; >+</script> >+<script src="../../fast/js/resources/js-test-post.js"></script> >+</body> >+</html> >diff --git a/LayoutTests/editing/spelling/spelling-insert-html.html b/LayoutTests/editing/spelling/spelling-insert-html.html >index bdf4daa..83c7c96 100644 >--- a/LayoutTests/editing/spelling/spelling-insert-html.html >+++ b/LayoutTests/editing/spelling/spelling-insert-html.html >@@ -26,7 +26,7 @@ if (window.internals) { > var texts = destination.childNodes; > var markedText = ""; > for (var i = 0; i < texts.length; ++i) { >- var marked = internals.markerRangeForNode(texts[i], 0); >+ var marked = internals.markerRangeForNode(texts[i], "spelling", 0); > if (marked) > markedText += marked.toString() > } >diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in >index b7258d8..469c14b 100644 >--- a/Source/WebCore/WebCore.exp.in >+++ b/Source/WebCore/WebCore.exp.in >@@ -636,7 +636,7 @@ __ZN7WebCore23getHostnamesWithCookiesERN3WTF7HashSetINS0_6StringENS0_10StringHas > __ZN7WebCore23overrideDefaultLanguageERKN3WTF6StringE > __ZN7WebCore24BinaryPropertyListWriter17writePropertyListEv > __ZN7WebCore24CachedResourceHandleBase11setResourceEPNS_14CachedResourceE >-__ZN7WebCore24DocumentMarkerController10markersForEPNS_4NodeE >+__ZN7WebCore24DocumentMarkerController10markersForEPNS_4NodeENS_14DocumentMarker11MarkerTypesE > __ZN7WebCore24DocumentMarkerController13removeMarkersENS_14DocumentMarker11MarkerTypesE > __ZN7WebCore24DocumentMarkerController23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE > __ZN7WebCore24contextMenuItemTagItalicEv >diff --git a/Source/WebCore/dom/DocumentMarkerController.cpp b/Source/WebCore/dom/DocumentMarkerController.cpp >index 2fd2b83..b0eb1e1 100644 >--- a/Source/WebCore/dom/DocumentMarkerController.cpp >+++ b/Source/WebCore/dom/DocumentMarkerController.cpp >@@ -318,15 +318,17 @@ DocumentMarker* DocumentMarkerController::markerContainingPoint(const LayoutPoin > return 0; > } > >-Vector<DocumentMarker*> DocumentMarkerController::markersFor(Node* node) >+Vector<DocumentMarker*> DocumentMarkerController::markersFor(Node* node, DocumentMarker::MarkerTypes markerTypes) > { > Vector<DocumentMarker*> result; > MarkerList* list = m_markers.get(node); > if (!list) > return result; > >- for (size_t i = 0; i < list->size(); ++i) >- result.append(&(list->at(i))); >+ for (size_t i = 0; i < list->size(); ++i) { >+ if (markerTypes.contains(list->at(i).type())) >+ result.append(&(list->at(i))); >+ } > > return result; > } >diff --git a/Source/WebCore/dom/DocumentMarkerController.h b/Source/WebCore/dom/DocumentMarkerController.h >index 810fba0..36c0d43 100644 >--- a/Source/WebCore/dom/DocumentMarkerController.h >+++ b/Source/WebCore/dom/DocumentMarkerController.h >@@ -69,7 +69,7 @@ public: > void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool); > > DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::MarkerType); >- Vector<DocumentMarker*> markersFor(Node*); >+ Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); > Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); > Vector<DocumentMarker> markersForNode(Node*); > Vector<LayoutRect> renderedRectsForMarkers(DocumentMarker::MarkerType); >diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp >index cae6e8e..46b01a5 100644 >--- a/Source/WebCore/testing/Internals.cpp >+++ b/Source/WebCore/testing/Internals.cpp >@@ -29,6 +29,7 @@ > #include "CachedResourceLoader.h" > #include "ClientRect.h" > #include "Document.h" >+#include "DocumentMarker.h" > #include "DocumentMarkerController.h" > #include "Element.h" > #include "ExceptionCode.h" >@@ -63,6 +64,29 @@ > > namespace WebCore { > >+static DocumentMarker::MarkerTypes markerTypesFrom(const String& markerType) { >+ if (equalIgnoringCase(markerType, "Spelling")) >+ return DocumentMarker::Spelling; >+ if (equalIgnoringCase(markerType, "Grammar")) >+ return DocumentMarker::Grammar; >+ if (equalIgnoringCase(markerType, "TextMatch")) >+ return DocumentMarker::TextMatch; >+ if (equalIgnoringCase(markerType, "Replacement")) >+ return DocumentMarker::Replacement; >+ if (equalIgnoringCase(markerType, "CorrectionIndicator")) >+ return DocumentMarker::CorrectionIndicator; >+ if (equalIgnoringCase(markerType, "RejectedCorrection")) >+ return DocumentMarker::RejectedCorrection; >+ if (equalIgnoringCase(markerType, "Autocorrected")) >+ return DocumentMarker::Autocorrected; >+ if (equalIgnoringCase(markerType, "SpellCheckingExemption")) >+ return DocumentMarker::SpellCheckingExemption; >+ if (equalIgnoringCase(markerType, "DeletedAutocorrection")) >+ return DocumentMarker::DeletedAutocorrection; >+ >+ return DocumentMarker::AllMarkers(); >+} >+ > const char* Internals::internalsId = "internals"; > > PassRefPtr<Internals> Internals::create() >@@ -210,24 +234,24 @@ PassRefPtr<ClientRect> Internals::boundingBox(Element* element, ExceptionCode& e > return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms()); > } > >-unsigned Internals::markerCountForNode(Node* node, ExceptionCode& ec) >+unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionCode& ec) > { > if (!node) { > ec = INVALID_ACCESS_ERR; > return 0; > } > >- return node->document()->markers()->markersFor(node).size(); >+ return node->document()->markers()->markersFor(node, markerTypesFrom(markerType)).size(); > } > >-PassRefPtr<Range> Internals::markerRangeForNode(Node* node, unsigned index, ExceptionCode& ec) >+PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) > { > if (!node) { > ec = INVALID_ACCESS_ERR; > return 0; > } > >- Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node); >+ Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node, markerTypesFrom(markerType)); > if (markers.size() <= index) > return 0; > return Range::create(node->document(), node, markers[index]->startOffset(), node, markers[index]->endOffset()); >diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h >index 5dfc112..7957a0f 100644 >--- a/Source/WebCore/testing/Internals.h >+++ b/Source/WebCore/testing/Internals.h >@@ -71,8 +71,8 @@ public: > > PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&); > >- unsigned markerCountForNode(Node*, ExceptionCode&); >- PassRefPtr<Range> markerRangeForNode(Node*, unsigned, ExceptionCode&); >+ unsigned markerCountForNode(Node*, const String&, ExceptionCode&); >+ PassRefPtr<Range> markerRangeForNode(Node*, const String&, unsigned, ExceptionCode&); > > void setForceCompositingMode(Document*, bool enabled, ExceptionCode&); > void setEnableCompositingForFixedPosition(Document*, bool enabled, ExceptionCode&); >diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl >index 3db6508..fc78777 100644 >--- a/Source/WebCore/testing/Internals.idl >+++ b/Source/WebCore/testing/Internals.idl >@@ -45,8 +45,8 @@ module window { > void setInspectorResourcesDataSizeLimits(in Document document, in long maximumResourcesContentSize, in long maximumSingleResourceContentSize) raises(DOMException); > > ClientRect boundingBox(in Element element) raises(DOMException); >- unsigned long markerCountForNode(in Node node) raises(DOMException); >- Range markerRangeForNode(in Node node, in unsigned long index) raises(DOMException); >+ unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException); >+ Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException); > > void setForceCompositingMode(in Document document, in boolean enabled) raises(DOMException); > void setEnableCompositingForFixedPosition(in Document document, in boolean enabled) raises(DOMException); >diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter >index a311396..bea0f02 100644 >--- a/Source/autotools/symbols.filter >+++ b/Source/autotools/symbols.filter >@@ -55,7 +55,7 @@ _ZN7WebCore20NodeRenderingContextD1Ev; > _ZN7WebCore20ShadowContentElement6createEPNS_8DocumentE; > _ZN7WebCore21getCachedDOMStructureEPNS_17JSDOMGlobalObjectEPKN3JSC9ClassInfoE; > _ZN7WebCore22externalRepresentationEPNS_7ElementEj; >-_ZN7WebCore24DocumentMarkerController10markersForEPNS_4NodeE; >+_ZN7WebCore24DocumentMarkerController10markersForEPNS_4NodeENS_14DocumentMarker11MarkerTypesE; > _ZN7WebCore6JSNode10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE; > _ZN7WebCore6JSNode20visitChildrenVirtualERN3JSC11SlotVisitorE; > _ZN7WebCore6JSNode6s_infoE;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71792
:
114030
|
114039
|
114090
|
114183
|
114211
|
114276
|
114420
|
114422
|
116694