servo/components/script/dom
bors-servo cf121ad8df Auto merge of #10895 - mbrubeck:byteindex, r=pcwalton
Use byte indices instead of char indices for text runs

Replace character indices with UTF-8 byte offsets throughout all code dealing with text runs.  This eliminates a lot of complexity when converting from one to the other, and interoperates better with the rest of the Rust ecosystem.

For most code this is just a simple replacement of char indices with byte indices.  In a few places like glyph storage and text fragment scanning, it also lets us get rid of code that existed only to map between bytes and chars.

Also includes some related fixes to text shaping, discovered while working on this conversion.  See the commit messages for details.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10895)
<!-- Reviewable:end -->
2016-04-28 20:22:09 -07:00
..
bindings Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
webidls Auto merge of #10761 - amarant:Node-isSameNode, r=Ms2ger 2016-04-25 01:04:47 -07:00
activation.rs Call synthetic_click_activation for all clicks 2016-03-10 14:43:33 -05:00
attr.rs Implement nodeName on Attr 2016-04-03 10:27:41 -07:00
blob.rs updated Blob constructor to use optional, fixes https://github.com/servo/servo/issues/10779 2016-04-22 01:28:35 +03:00
bluetooth.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothadvertisingdata.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothcharacteristicproperties.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothdevice.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothremotegattcharacteristic.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothremotegattdescriptor.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothremotegattserver.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothremotegattservice.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
bluetoothuuid.rs WebBluetooth API classes 2016-03-16 10:34:48 +01:00
browsingcontext.rs Make fill_property_descriptor take a flags argument 2016-02-23 17:14:27 +01:00
canvasgradient.rs Parse currentColor as Canvas2D color 2015-11-21 11:59:19 -08:00
canvaspattern.rs Add origin-clean flag tracking for canvas 2015-12-17 11:40:38 -08:00
canvasrenderingcontext2d.rs Setting current color to black if canvas is not rendered in document 2016-04-22 09:59:49 -04:00
characterdata.rs Inlined content_changed 2016-04-04 11:33:37 +02:00
closeevent.rs refactors entities from script_thread into script_runtime 2016-04-06 12:46:49 +05:30
comment.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
console.rs Implement console#time and console#timeEnd methods 2016-01-25 14:21:32 -05:00
create.rs Implement HTMLDetailsElement. Fixes #9216 2016-01-20 16:15:37 +01:00
crypto.rs Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
css.rs Replaced DOMString constructor by conversion functions. 2015-11-12 17:52:59 -06:00
cssstyledeclaration.rs Inlined content_changed 2016-04-04 11:33:37 +02:00
customevent.rs Implement From<DOMString> for Atom 2016-02-24 17:52:17 +01:00
dedicatedworkerglobalscope.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
document.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
documentfragment.rs Implement From<DOMString> for Atom 2016-02-24 17:52:17 +01:00
documenttype.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domexception.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domimplementation.rs Make it possible for XMLDocuments to have a browsing context. 2016-02-20 18:03:14 +01:00
domparser.rs Store a pointer to the browsing context in the Document. 2016-02-11 13:08:11 +01:00
dompoint.rs Add DOMQuad element 2015-12-18 17:37:10 +01:00
dompointreadonly.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domquad.rs Add global default method for Reflectable trait 2016-01-11 20:23:47 -05:00
domrect.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domrectlist.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domrectreadonly.rs Rustfmt some of script. 2015-11-18 11:14:05 +01:00
domstringmap.rs Reduce 'match' body, remove unnecessary clone 2016-01-05 16:55:37 -08:00
domtokenlist.rs Implement and test DOMTokenList.replace (fixes #8511) 2016-03-24 10:37:42 +01:00
element.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
errorevent.rs implement and use From<bool> for enum and back 2016-03-17 22:50:22 +01:00
event.rs implement and use From<bool> for enum and back 2016-03-17 22:50:22 +01:00
eventdispatcher.rs Refactor dispatch_event according to the spec (fixes #9178) 2016-02-29 10:42:09 +01:00
eventsource.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
eventtarget.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
file.rs Remove global field from Blob 2016-01-10 21:20:31 -05:00
filelist.rs merge from master 2015-11-03 19:01:23 +09:00
filereader.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
focusevent.rs Implement the focusevent argument to Document::createEvent 2016-04-27 01:51:48 +03:00
forcetouchevent.rs forcetouch events support 2016-04-05 18:42:28 +08:00
formdata.rs Make use of From<String> for Atom 2016-02-24 17:52:13 +01:00
htmlanchorelement.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
htmlappletelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlareaelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlaudioelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlbaseelement.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
htmlbodyelement.rs Extract out 'is the html body element' CSSOM concept. 2016-04-11 10:51:00 -04:00
htmlbrelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlbuttonelement.rs Remove get_* on getters as per RFC 0344. 2016-04-10 22:49:35 -04:00
htmlcanvaselement.rs Change old references of ecoal95 2016-03-23 18:12:40 +01:00
htmlcollection.rs Move '&&' to the end of the previous line. 2016-04-22 14:28:18 +02:00
htmldataelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmldatalistelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmldetailselement.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
htmldialogelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmldirectoryelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmldivelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmldlistelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlelement.rs Update 'Extensions to the HTMLElement Interface' CSSOM spec links. 2016-04-11 09:05:02 -04:00
htmlembedelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlfieldsetelement.rs Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
htmlfontelement.rs Add parsing of double values in style attributes 2016-04-25 01:09:30 -04:00
htmlformcontrolscollection.rs Fix #9508: Beautify our union enums constructors 2016-02-07 02:55:21 +03:00
htmlformelement.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
htmlframeelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlframesetelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlheadelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlheadingelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlhrelement.rs Implement 'align' IDL attribute on '<hr>'. 2016-04-11 19:46:57 -04:00
htmlhtmlelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmliframeelement.rs script: Make iframes know their pipeline IDs at all times, even after 2016-04-28 10:53:13 -07:00
htmlimageelement.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
htmlinputelement.rs Auto merge of #10895 - mbrubeck:byteindex, r=pcwalton 2016-04-28 20:22:09 -07:00
htmllabelelement.rs Fix HtmlLabelElement activation to run on correct element 2016-03-29 18:48:07 -04:00
htmllegendelement.rs Issue #10456 Remove unused import warnings in HTMLLegendElement 2016-04-07 21:24:20 +02:00
htmllielement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmllinkelement.rs Auto merge of #10887 - askeing:fix_10374, r=KiChjang 2016-04-28 14:30:04 -07:00
htmlmapelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlmediaelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlmetaelement.rs Recompute viewport-dependent styles on viewport size change 2016-03-19 13:23:39 -07:00
htmlmeterelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlmodelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlobjectelement.rs Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
htmlolistelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmloptgroupelement.rs Update rust-selectors 2016-02-03 02:11:31 +01:00
htmloptionelement.rs Update rust-selectors 2016-02-03 02:11:31 +01:00
htmloutputelement.rs Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
htmlparagraphelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlparamelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlpreelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlprogresselement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlquoteelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlscriptelement.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
htmlselectelement.rs Remove get_* on getters as per RFC 0344. 2016-04-10 22:49:35 -04:00
htmlsourceelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlspanelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlstyleelement.rs Refactor style to be completely backend-independent 2016-02-13 16:05:14 +01:00
htmltablecaptionelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltablecellelement.rs Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
htmltablecolelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltabledatacellelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltableelement.rs Add parsing of double values in style attributes 2016-04-25 01:09:30 -04:00
htmltableheadercellelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltablerowelement.rs Move '&&' to the end of the previous line. 2016-04-22 14:28:18 +02:00
htmltablesectionelement.rs Move '&&' to the end of the previous line. 2016-04-22 14:28:18 +02:00
htmltemplateelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltextareaelement.rs Replace range::Range with std::ops::Range in script 2016-04-28 14:54:07 -07:00
htmltimeelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltitleelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmltrackelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlulistelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlunknownelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
htmlvideoelement.rs Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
imagedata.rs Remove #[allow(raw_pointer_derive)] attributes 2015-11-27 14:32:57 -05:00
keyboardevent.rs Spec says 'ContextMenu', not 'Menu' 2016-03-22 21:09:43 +05:30
location.rs add origin to location and url api 2016-01-21 11:06:41 -08:00
macros.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
messageevent.rs Implement From<DOMString> for Atom 2016-02-24 17:52:17 +01:00
mimetype.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
mimetypearray.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
mod.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
mouseevent.rs implement and use From<bool> for enum and back 2016-03-17 22:50:22 +01:00
namednodemap.rs Updated SupportedPropertyNames in NamedNodeMap to match spec 2016-03-05 17:21:01 +05:30
navigator.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
navigatorinfo.rs implements NavigatorLanguage 2016-03-17 16:13:37 +05:30
node.rs Implements Node::isSameNode 2016-04-23 22:03:25 +02:00
nodeiterator.rs Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
nodelist.rs Implement NamedItem and NamedGetter on HTMLFormControlsCollection 2016-01-28 18:33:51 -05:00
performance.rs merge from master 2015-11-03 19:01:23 +09:00
performancetiming.rs fix performance timing precision and navigation_start unit; add LoadEventStart and LoadEventEnd timing 2016-04-13 01:30:02 +08:00
plugin.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
pluginarray.rs Implemented stub for NavigatorPlugins 2016-04-11 09:14:46 -06:00
processinginstruction.rs Explicitly customise flags of new nodes where needed 2015-10-15 17:30:41 +02:00
progressevent.rs Implement the "progressevent" argument to Document::createEvent 2016-04-26 00:32:50 -04:00
radionodelist.rs Implement NamedItem and NamedGetter on HTMLFormControlsCollection 2016-01-28 18:33:51 -05:00
range.rs Implement Stringifier for Range 2016-03-09 15:27:37 -05:00
screen.rs more refactoring 2015-10-30 20:26:29 +09:00
servohtmlparser.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
servoxmlparser.rs Auto merge of #10647 - ConnorGBrewster:parse_xml, r=jdm 2016-04-27 07:50:54 -07:00
storage.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
storageevent.rs "storageevent" argument for Document::createEvent 2016-04-25 12:02:05 +02:00
stylesheet.rs Initial steps for CSSOM API 2016-03-31 18:17:30 -04:00
stylesheetlist.rs servo: Clean up unused variables and imports 2016-04-02 16:30:18 +02:00
testbinding.rs Issue #10348 Implement StringMozPreference, string preferences, WPT tests 2016-04-03 21:28:17 +02:00
testbindingproxy.rs Use DOMString::new() somewhat consistently. 2015-11-04 12:09:10 +01:00
text.rs Properly propagate changes when range or trees are mutated 2015-12-25 23:35:57 +01:00
textdecoder.rs conversion: Extrapolate array_buffer_view_data 2016-01-04 15:19:29 +01:00
textencoder.rs Replaced DOMString constructor by conversion functions. 2015-11-12 17:52:59 -06:00
touch.rs more refactoring 2015-10-30 20:26:29 +09:00
touchevent.rs implement and use From<bool> for enum and back 2016-03-17 22:50:22 +01:00
touchlist.rs merge from master 2015-11-03 19:01:23 +09:00
treewalker.rs Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
uievent.rs implement and use From<bool> for enum and back 2016-03-17 22:50:22 +01:00
url.rs Reset searchParam in URL.href setter 2016-04-23 20:28:00 +02:00
urlhelper.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
urlsearchparams.rs Correctly initialize URL.searchParams 2016-04-23 20:27:59 +02:00
userscripts.rs Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
validation.rs Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
validitystate.rs Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
values.rs Consolidate magic number representing max unsigned long 2015-10-10 13:46:11 -04:00
virtualmethods.rs Move comment about removing steps 2016-02-13 14:22:10 -05:00
webglactiveinfo.rs Make DOMString a newtype around String, rather than a typedef. 2015-11-04 12:09:11 +01:00
webglbuffer.rs #10211: Stop re-exporting webrender_traits WebGL types from canvas_traits 2016-03-30 20:05:16 +02:00
webglcontextevent.rs implement webglcontextevent 2016-04-22 19:54:13 -07:00
webglframebuffer.rs #10211: Stop re-exporting webrender_traits WebGL types from canvas_traits 2016-03-30 20:05:16 +02:00
webglobject.rs more refactoring 2015-10-30 20:26:29 +09:00
webglprogram.rs Auto merge of #10443 - emilio:webgl-teximage2d-overload, r=jdm 2016-04-22 11:25:29 -07:00
webglrenderbuffer.rs #10211: Stop re-exporting webrender_traits WebGL types from canvas_traits 2016-03-30 20:05:16 +02:00
webglrenderingcontext.rs Implement stencil fns for WebGLRenderingContext 2016-04-24 02:40:22 -04:00
webglshader.rs webgl: Remove active_uniform related validation. 2016-04-19 13:27:19 +02:00
webglshaderprecisionformat.rs more refactoring 2015-10-30 20:26:29 +09:00
webgltexture.rs webgl: texture: Make initialize only mark as initialized the current face 2016-04-20 20:27:37 +02:00
webgluniformlocation.rs webgl: Rename UniformType to UniformSetterType and hoist to the bottom 2016-04-19 20:25:30 +02:00
websocket.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
window.rs Add referrer policy pass-through and referrer header logic 2016-04-25 16:41:06 -04:00
worker.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
workerglobalscope.rs Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
workerlocation.rs Replaced DOMString constructor by conversion functions. 2015-11-12 17:52:59 -06:00
workernavigator.rs implements NavigatorLanguage 2016-03-17 16:13:37 +05:30
xmldocument.rs Use upcast() in XMLDocument methods. 2016-04-11 10:30:08 +02:00
xmlhttprequest.rs Remove extraneous script_chan parameter from Trusted::new 2016-04-28 10:52:44 +02:00
xmlhttprequesteventtarget.rs Introduce trait Castable 2015-10-21 11:37:16 +02:00
xmlhttprequestupload.rs more refactoring 2015-10-30 20:26:29 +09:00