Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gfx] [layout] [style] Upgrade unicode-bidi to 0.3 #16779

Merged
merged 1 commit into from May 23, 2017
Merged

Conversation

@behnam
Copy link
Member

behnam commented May 9, 2017

Depends on servo/unicode-bidi#27 , which
upgrades unicode-bidi crate to 0.3.0.

Summary of changes:

  • Use unicode_bidi::Level (instead of u8) in all relevant places and
    replace magic computations with (inline) method calls to Level API.

  • Doing so required adding unicode-bidi crate dependency to two more
    components here: style and gfx. IMHO, totally makes sense, as
    replaces local integer manipulations/checks with well-tested ones
    already available in a common dependency.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable). [N/A]
  • There are tests for these changes OR
  • These changes do not require tests because unicode-bidi has its own tests and there's no logic change in this diff.

This change is Reviewable

@highfive
Copy link

highfive commented May 9, 2017

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @glennw (or someone else) soon.

@highfive
Copy link

highfive commented May 9, 2017

Heads up! This PR modifies the following files:

  • @bholley: components/style/Cargo.toml, components/style/properties/longhand/inherited_text.mako.rs, components/style/lib.rs, components/style/logical_geometry.rs
  • @emilio: components/style/Cargo.toml, components/style/properties/longhand/inherited_text.mako.rs, components/style/lib.rs, components/layout/Cargo.toml, components/style/logical_geometry.rs and 2 more
@highfive
Copy link

highfive commented May 9, 2017

warning Warning warning

  • These commits modify style, layout, and gfx code, but no tests are modified. Please consider adding a test!
@behnam
Copy link
Member Author

behnam commented May 9, 2017

@highfive highfive assigned emilio and unassigned glennw May 9, 2017
@behnam behnam force-pushed the behnam:bidi-0.3 branch 2 times, most recently from c66eab7 to ed427a7 May 16, 2017
@behnam
Copy link
Member Author

behnam commented May 16, 2017

unicode-bidi API is now going stable for 0.3.0. This should be good to go after servo/unicode-bidi#31 is landed.

@behnam behnam changed the title Upgrade unicode-bid to ^0.3 [gfx] [layout] [style] Upgrade unicode-bidi to 0.3 May 16, 2017
@behnam behnam force-pushed the behnam:bidi-0.3 branch 3 times, most recently from 5f6bd02 to b67a184 May 16, 2017
@emilio
Copy link
Member

emilio commented May 17, 2017

./mach test-tidy is failing:

./Cargo.lock:1: duplicate versions for package `unicode-bidi`
	The following packages depend on version 0.2.5 from 'crates.io':
		idna
	The following packages depend on version 0.3.0 from '':
		gfx
		layout
		style

./Cargo.lock:1: duplicate versions for package `serde`
	The following packages depend on version 0.9.15 from 'crates.io':
		webvr_traits
		app_units
		bincode
		bluetooth_traits
		canvas_traits
		constellation
		core-graphics
		cssparser
		devtools
		devtools_traits
		dwrote
		euclid
		gfx
		gfx_traits
		hyper_serde
		ipc-channel
		layout
		msg
		net
		net_traits
		offscreen_gl_context
		profile
		profile_traits
		range
		rust-webvr
		script
		script_traits
		serde_json
		servo_config
		servo_url
		string_cache
		style
		style_traits
		unicode-bidi
		url_serde
		uuid
		webrender_traits
	The following packages depend on version 1.0.5 from 'crates.io':
		serde_test
@behnam
Copy link
Member Author

behnam commented May 17, 2017

Right, crates.io is not updated with the latest version yet. The idna crate is compatible with unicode-bidi:0.3.0 already, so getting 0.3.0 on crates.io should fix all the problems here.

I'll update here when it's ready. Thanks.

@behnam behnam force-pushed the behnam:bidi-0.3 branch from b67a184 to 58caa87 May 17, 2017
@behnam
Copy link
Member Author

behnam commented May 17, 2017

Okay, new unicode-bidi versions are published on crates.io and here's the latest state of this PR:

$ ./mach test-tidy
Checking the config file...
Checking directories for correct file extensions...
Checking files for tidiness...
./Cargo.lock:1: duplicate versions for package `unicode-bidi`
	The following packages depend on version 0.2.6 from 'crates.io':
		idna
	The following packages depend on version 0.3.0 from 'crates.io':
		gfx
		layout
		style
  Progress: 100% (11/11)

I have tried manually editing Cargo.lock to address this, but ./mach build puts 0.2.6 back in for idna. I'm guessing that it's because of servo depending on unicode-bidi's with_servo feature, but idna doesn't.

I suppose an eventual cargo update would fix this, but that changes just too much dependencies.

Anyways, I don't know what's the right fix here. Any suggestions, @emilio, @mbrubeck?

@jdm
Copy link
Member

jdm commented May 17, 2017

@behnam https://github.com/servo/rust-url/blob/master/idna/Cargo.toml#L22 needs to be updated, and a new version of idna needs to be published, and then Servo needs to update to the new idna version.

behnam added a commit to behnam/rust-url that referenced this pull request May 17, 2017
For the needs of `idna`, `unicode-bidi:0.3.0` is backwards compatible,
but this upgrade is needed to that `servo` can upgrade to the new
version.

Servo upgrade: servo/servo#16779
behnam added a commit to behnam/rust-url that referenced this pull request May 18, 2017
For the needs of `idna`, `unicode-bidi:0.3.0` is backwards compatible,
but this upgrade is needed to that `servo` can upgrade to the new
version.

Servo upgrade: servo/servo#16779
@behnam behnam force-pushed the behnam:bidi-0.3 branch from 58caa87 to 0b0f3c6 May 19, 2017
@bors-servo
Copy link
Contributor

bors-servo commented May 19, 2017

The latest upstream changes (presumably #16941) made this pull request unmergeable. Please resolve the merge conflicts.

bors-servo added a commit to servo/rust-url that referenced this pull request May 19, 2017
[idna] Upgrade unicode-bidi to 0.3.0

For the needs of `idna`, `unicode-bidi:0.3.0` is backwards compatible,
but this upgrade is needed to that `servo` can upgrade to the new
version.

Servo upgrade: servo/servo#16779

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/343)
<!-- Reviewable:end -->
@mbrubeck
Copy link
Contributor

mbrubeck commented May 19, 2017

Looks good! r=mbrubeck for the code changes. This should also fix some tests, so it should get a try run once it is mergeable.

@behnam behnam force-pushed the behnam:bidi-0.3 branch from 0b0f3c6 to a201b73 May 22, 2017
@behnam
Copy link
Member Author

behnam commented May 22, 2017

Now good to go.

FYI, this triggers the following warning:

warning: use of deprecated item: please use `BidiInfo::visual_runs()` instead.
   --> /Users/behnam/code/servo/servo/components/layout/inline.rs:313:28
    |
313 |                 let runs = bidi::deprecated::visual_runs(range, &levels);
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: #[warn(deprecated)] on by default

I'm still not sure what's the expected behavior on this call-site, so the code is not updated. The new implementation of that function, BidiInfo::visual_runs(), needs access to the text (for the char length data) and their original bidi-type, and that's why it's now an instance method of BidiInfo.

@behnam behnam force-pushed the behnam:bidi-0.3 branch 4 times, most recently from 5c4c61d to 2523e55 May 22, 2017
@behnam
Copy link
Member Author

behnam commented May 23, 2017

Okay, fixed all the little side issues I caused here and all the tests are passing in idna and servo.

@mbrubeck, @emilio, r?

@behnam behnam removed the S-needs-rebase label May 23, 2017
Copy link
Contributor

mbrubeck left a comment

r=mbrubeck with one minor change.

let runs = unicode_bidi::visual_runs(range, &levels);
// FIXME: Update to use BidiInfo::visual_runs, as this algorithm needs access to
// the original text and original BidiClass of its characters.
let runs = bidi::deprecated::visual_runs(range, &levels);

This comment has been minimized.

@mbrubeck

mbrubeck May 23, 2017

Contributor

Please add #[allow(deprecated)] above this line, to silence the warning.

@behnam
Copy link
Member Author

behnam commented May 23, 2017

Review status: 0 of 10 files reviewed at latest revision, 1 unresolved discussion.


components/layout/inline.rs, line 313 at r1 (raw file):

Previously, mbrubeck (Matt Brubeck) wrote…

Please add #[allow(deprecated)] above this line, to silence the warning.

Done.


Comments from Reviewable

@behnam behnam force-pushed the behnam:bidi-0.3 branch from 2523e55 to 14c524d May 23, 2017
@mbrubeck
Copy link
Contributor

mbrubeck commented May 23, 2017

@bors-servo
Copy link
Contributor

bors-servo commented May 23, 2017

📌 Commit 14c524d has been approved by mbrubeck

@highfive highfive assigned mbrubeck and unassigned emilio May 23, 2017
@bors-servo
Copy link
Contributor

bors-servo commented May 23, 2017

Testing commit 14c524d with merge edd6c2c...

bors-servo added a commit that referenced this pull request May 23, 2017
[gfx] [layout] [style] Upgrade unicode-bidi to 0.3

Depends on servo/unicode-bidi#27 , which
upgrades `unicode-bidi` crate to `0.3.0`.

Summary of changes:

* Use `unicode_bidi::Level` (instead of `u8`) in all relevant places and
replace magic computations with (inline) method calls to Level API.

* Doing so required adding `unicode-bidi` crate dependency to two more
components here: `style` and `gfx`. IMHO, totally makes sense, as
replaces local integer manipulations/checks with well-tested ones
already available in a common dependency.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable). [N/A]

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because `unicode-bidi` has its own tests and there's no logic change in this diff.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16779)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 23, 2017

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-msvc-dev
Approved by: mbrubeck
Pushing edd6c2c to master...

@bors-servo bors-servo merged commit 14c524d into servo:master May 23, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@behnam behnam deleted the behnam:bidi-0.3 branch May 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.