Commit Graph

1276 Commits

Author SHA1 Message Date
Josh Matthews c99c05c03f Import cocoa. 2018-02-01 15:55:23 -05:00
Josh Matthews a278f3dfbe Add core-text to workspace. 2018-02-01 15:53:48 -05:00
Josh Matthews 52bc040a9a Import core-text. 2018-02-01 15:52:56 -05:00
Josh Matthews 03960659bb Add core-graphics to workspace. 2018-02-01 15:49:27 -05:00
Josh Matthews af0010c21a Import core-graphics. 2018-02-01 15:46:34 -05:00
bors-servo db9c247243 Auto merge of #157 - waywardmonkeys:add-missing-license-headers, r=jdm
Add missing license headers to src files.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/157)
<!-- Reviewable:end -->
2018-02-01 07:23:38 -06:00
Bruce Mitchener bf3a9c89bd Add missing license headers to src files. 2018-02-01 09:32:29 +07:00
bors-servo b66566211a Auto merge of #85 - poiru:fix-font-path, r=jdm
Make CTFontDescriptor::font_path() return filesystem path, not URL

Prior to this commit, the return string was in the format
`file:///foo/bar.otf`. We now omit the leading `file://` portion. This
also properly retains characters that are not URL safe.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/85)
<!-- Reviewable:end -->
2018-01-31 09:59:40 -06:00
Birunthan Mohanathas 8bc5c45090 Make CTFontDescriptor::font_path() return filesystem path, not URL
Prior to this commit, the return string was in the format
`file:///foo/bar.otf`. We now omit the leading `file://` portion. This
also properly retains characters that are not URL safe.
2018-01-30 20:56:47 +05:30
bors-servo 80a8e93ba3 Auto merge of #84 - poiru:typed-wrap-under-rule, r=jdm
Use typed wrap_under_{create,get}_rule() functions

Just some minor cleanup; no functional changes.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/84)
<!-- Reviewable:end -->
2018-01-30 09:20:48 -06:00
Birunthan Mohanathas 46213a7ab0 Use typed wrap_under_{create,get}_rule() functions
Just some minor cleanup; no functional changes.
2018-01-30 20:49:10 +05:30
bors-servo c0c69aefdd Auto merge of #83 - poiru:font-traits, r=jdm
Add CTFontDescriptor::traits()

This provides easy access to e.g. the font weight.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/83)
<!-- Reviewable:end -->
2018-01-29 09:18:07 -06:00
Birunthan Mohanathas 4acd58e155 Add CTFontDescriptor::traits()
This provides easy access to e.g. the font weight.
2018-01-29 20:46:00 +05:30
bors-servo fd665cac20 Auto merge of #82 - poiru:fix-reference-leak, r=jdm
Properly release attribute returned by CTFontDescriptorCopyAttribute

CTFontDescriptorCopyAttribute returns a retained reference (i.e. it
follows the create rule) so were incorrectly retaining it again by using
`wrap_under_get_rule`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/82)
<!-- Reviewable:end -->
2018-01-29 09:00:51 -06:00
Birunthan Mohanathas 7b5bee9608 Properly release attribute returned by CTFontDescriptorCopyAttribute
CTFontDescriptorCopyAttribute returns a retained reference (i.e. it
follows the create rule) so were incorrectly retaining it again by using
`wrap_under_get_rule`.
2018-01-29 20:27:52 +05:30
bors-servo cd657603ae Auto merge of #80 - jrmuizel:new-ver, r=jdm
Bump the version for a new release

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/80)
<!-- Reviewable:end -->
2018-01-27 15:54:05 -06:00
Jeff Muizelaar 33f7081b12 Bump the version for a new release 2018-01-27 16:29:18 -05:00
bors-servo 0239987f57 Auto merge of #79 - jrmuizel:macros, r=jdm
Use macros from core-foundation for declaring types

This cleans up the code a lot and gives an implementation of Clone.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/79)
<!-- Reviewable:end -->
2018-01-27 15:24:32 -06:00
Jeff Muizelaar a7cc03d640 Use macros from core-foundation for declaring types
This cleans up the code a lot and gives an implementation of Clone.
2018-01-27 15:48:47 -05:00
bors-servo f062dcbc5e Auto merge of #154 - faern:iterate-untyped-array, r=jdm
Add possibility to iterate untyped CFArray

Maybe it was intentional, or maybe it was forgotten. But it is not possible to iterate an untyped array (`CFArray<*const c_void>`) in the `0.5.1` release, it was in `0.4`.

This extra `FromVoid` impl on `*const c_void` fixes that.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/154)
<!-- Reviewable:end -->
2018-01-27 09:37:41 -06:00
Linus Färnstrand dc9392c19e Add possibility to iterate untyped CFArray 2018-01-27 10:50:06 +01:00
bors-servo 3ffdfdc88c Auto merge of #77 - jrmuizel:typed-cfarray, r=jdm
Typed cfarray

We should merge this before publishing a new version.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/77)
<!-- Reviewable:end -->
2018-01-26 23:29:03 -06:00
Jeff Muizelaar 907b4f78b3 Add types to CFArrays 2018-01-27 00:28:39 -05:00
bors-servo cc52e60442 Auto merge of #181 - faern:upgrade-core-foundation, r=jdm
Upgrade core foundation

This is a PR in a series of PRs originating at https://github.com/servo/core-foundation-rs/pull/132

The plan is to make a breaking change to `core-foundation` and release it as `0.5.0`. But before the merge/publish of `core-foundation` I will prepare a set of PRs making sure the entire dependency graph of Servo is ready for this change and can be switched over to `0.5.0` directly.

TODO before merge:
- [x] Merge `core-graphics` PR and publish.
- [x] Remove the last commit from this PR, so we depend on `core-foundation` from crates.io.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/cocoa-rs/181)
<!-- Reviewable:end -->
2018-01-26 23:05:55 -06:00
bors-servo 192a4581c4 Auto merge of #75 - faern:upgrade-core-foundation, r=jdm
Upgrade core foundation

This is a PR in a series of PRs originating at https://github.com/servo/core-foundation-rs/pull/132

The plan is to make a breaking change to `core-foundation` and release it as `0.5.0`. But before the merge/publish of `core-foundation` I will prepare a set of PRs making sure the entire dependency graph of Servo is ready for this change and can be switched over to `0.5.0` directly

TODO before merge:
- [x] Merge `core-foundation` PR and publish.
- [x] Merge `core-graphics` PR and publish.
- [x] Remove the last commit from this PR, so we depend on `core-foundation` from crates.io.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/75)
<!-- Reviewable:end -->
2018-01-26 23:05:46 -06:00
bors-servo 87a3ea0de9 Auto merge of #110 - faern:upgrade-core-foundation, r=jdm
Upgrade core foundation

This is a PR in a series of PRs originating at https://github.com/servo/core-foundation-rs/pull/132

The plan is to make a breaking change to `core-foundation` and release it as `0.5.0`. But before the merge/publish of `core-foundation` I will prepare a set of PRs making sure the entire dependency graph of Servo is ready for this change and can be switched over to `0.5.0` directly.

TODO before merge:
- [x] Merge `core-foundation` PR and publish.
- [x] Remove the last commit from this PR, so we depend on `core-foundation` from crates.io.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-graphics-rs/110)
<!-- Reviewable:end -->
2018-01-26 15:34:18 -06:00
bors-servo ff67c15632 Auto merge of #153 - servo:updateversion, r=jdm
Bump version to 0.5.1.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/153)
<!-- Reviewable:end -->
2018-01-26 13:01:11 -06:00
Josh Matthews 5d7753a78a Bump version to 0.5.1. 2018-01-26 13:48:25 -05:00
bors-servo 5330f5be1b Auto merge of #152 - servo:constmut, r=jrmuizel
Respect const/mut of system headers.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/152)
<!-- Reviewable:end -->
2018-01-26 12:47:09 -06:00
Josh Matthews 53609f26ac Respect const/mut of system headers. 2018-01-26 13:46:06 -05:00
bors-servo 725d73d180 Auto merge of #151 - jrmuizel:avoid-reexport, r=jdm
Avoid reexporting CFRelease

This is in theory a breaking change but maybe it doesn't matter.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/151)
<!-- Reviewable:end -->
2018-01-26 10:03:15 -06:00
Jeff Muizelaar c50094db9a Avoid reexporting CFRelease 2018-01-26 10:34:32 -05:00
Linus Färnstrand 2603f28cd0 Bump version to 9.0.0 2018-01-26 00:21:28 +01:00
Linus Färnstrand fc9e44f14f Update to new CFNumber constructor 2018-01-26 00:21:28 +01:00
Linus Färnstrand 2a6b5586bd Upgrade to core-foundation 0.5.0 2018-01-26 00:21:28 +01:00
bors-servo cb463d1ea5 Auto merge of #148 - jrmuizel:bounds-check, r=jdm
Lift getting the length of the array out.

This changes get() to return an Option<> and adds a get_unchecked() that doesn't do a bounds check. This means our bounds check can be inlined into the caller instead of us having to CFArrayGetCount twice for each element.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/148)
<!-- Reviewable:end -->
2018-01-25 13:22:59 -06:00
Jeff Muizelaar c662076906 Lift getting the length of the array out.
This changes get() to return an Option<> and adds a get_unchecked() that doesn't do a bounds check.
This means our bounds check can be inlined into the caller instead of us having to CFArrayGetCount twice
for each element.
2018-01-25 11:49:01 -05:00
bors-servo 4c7e92c677 Auto merge of #147 - jrmuizel:borrow, r=jdm
Add the ability to borrow values from the array.

This is a replacement for #143. It allows iteration while avoiding the reference count churn of the previous approach. It uses a TCFTypeBorrow (could probably use a better name) to hold a sort of reference to the array data. I'm interested in people's thoughts and opinions on this approach.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/147)
<!-- Reviewable:end -->
2018-01-25 09:32:50 -06:00
Jeff Muizelaar df7df6bb52 Add the ability to borrow values from the array.
This uses borrowed values from the array to avoid having to
Retain/Release during iteration. It also implements borrowing
for all TCFType.
2018-01-25 10:08:34 -05:00
bors-servo ec660b05cc Auto merge of #132 - faern:tcftype-ref-as-associated, r=jdm
Reference type as associated value instead of generic

Each `CFFoo` has exactly one `CFFooRef` and which one is defined by `CFFoo`, not by its user. Thus the type of reference can be an associated type instead of a generic.

As you can see this greatly simplifies things such as calling `instance_of` and `from_CFType_pairs` as well as using `CFPropertyListSubClass`. It basically removes one generic parameter from any method dealing with `TCFType`s in some way.

This is a breaking change, so it would probably mean a `0.5.0` release if accepted. I don't know what your stance on breaking changes or version bumps is, so I don't know if you want this or not. But it would simplify the API, both here, but first and foremost in higher level crates using this.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/132)
<!-- Reviewable:end -->
2018-01-24 11:30:17 -06:00
bors-servo 234846419e Auto merge of #76 - poiru:fix-family-name, r=jdm
Make CTFontDescriptor::family_name() actually return the family name

It was incorrectly returning the display name, which already has a separate
function.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-text-rs/76)
<!-- Reviewable:end -->
2018-01-24 07:34:19 -06:00
Birunthan Mohanathas 397b5e36c1 Make CTFontDescriptor::family_name() actually return the family name
It incorrectly returning the display name, which already has a separate
function.
2018-01-24 19:02:51 +05:30
Linus Färnstrand 7e87a9d8fa Bump version to 0.5.0 2018-01-24 08:57:50 +01:00
Linus Färnstrand ab08525293 Rename as_untyped -> to_untyped, add into_untyped 2018-01-24 08:57:50 +01:00
Linus Färnstrand c071ba7874 Clean up my own non-rustfmt style 2018-01-23 22:42:39 +01:00
Linus Färnstrand 70dd9c3a7e Remove deprecated methods 2018-01-23 22:41:37 +01:00
Linus Färnstrand aae7c708c8 Change ConcreteTypeRef to an associated value 2018-01-23 22:41:37 +01:00
Linus Färnstrand 3aa63aa5b7 Add TCFTypeRef trait 2018-01-23 22:35:52 +01:00
Linus Färnstrand 249300d8ab Change CFErrorRef to *const ptr instead of *mut 2018-01-23 22:35:52 +01:00
bors-servo 0389b23266 Auto merge of #145 - faern:various-fixes-and-rearrangements, r=jdm
Various fixes and rearrangements

A couple of things that I found easy to do that would improve the readability and usability of the crate in various ways. Some might be more subjectively better rather than objectively better. I clogged some unrelated changes into the same PR since the merge process takes ages with Travis being this slow. Anyway, they all fit under the "cleanup" category :) Tell me if you want them split into multiple PRs.

* Export the sys part of the error module. All other modules do this. I guess it was missed?

* Fix so the macros are usable from other crates without having to depend on `core-foundation-sys` or import `CFRelease` into the scope where they are used.

* The tests in `lib.rs` were only testing the dictionary implementations, so I moved them to `dictionary.rs`

* I found it a bit undiscoverable that `CFRunLoopSource` define a method inside of `filedescriptor.rs`. At the same time it's not ideal to call the ffi-methods of the filedescriptor from runloop.rs. This rearrangement solves both of those problems by exposing `CFFileDescriptor::to_run_loop_source` that can be used from `runloop.rs`.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/core-foundation-rs/145)
<!-- Reviewable:end -->
2018-01-23 12:12:28 -06:00