servo / unicode-bidi

Implementation of the Unicode Bidirection Algorithm in Rust
Other
77 stars 33 forks source link

Handle multiple paragraphs in input text. #12

Closed mbrubeck closed 9 years ago

mbrubeck commented 9 years ago

I thought this wasn't needed for Servo, since paragraphs in HTML are (normally) based on markup, so Servo can usually just process one paragraph at a time. However, for preformatted text, the bidi algorithm must handle multiple paragraphs in a single inline flow.

The important changes here are in process_text and initial_scan. Most of the other changes are just renaming variables and functions to make sense in a multi-paragraph world.

process_text no longer returns the max embedding level. This was intended for optimizations, but wasn't actually useful in Servo. An approach like #5 can provide a replacement for this optimization.

Review on Reviewable

mbrubeck commented 9 years ago

r? @pcwalton or @SimonSapin

SimonSapin commented 9 years ago

Reviewed 1 of 1 files at r1. Review status: all files reviewed at latest revision, 1 unresolved discussion, all commit checks successful.


src/lib.rs, line 82 [r1] (raw file): Is the level of the first paragraph always 0 if you give a Some(_) value for the level parameter of process_text?


Comments from the review on Reviewable.io

SimonSapin commented 9 years ago

@bors-servo r+

bors-servo commented 9 years ago

:pushpin: Commit deb6696 has been approved by SimonSapin

bors-servo commented 9 years ago

:hourglass: Testing commit deb6696 with merge 4dbc442...

bors-servo commented 9 years ago

:sunny: Test successful - travis