Commit graph

1184 commits

Author SHA1 Message Date
Olivier Goffart
7193cbeec1 Revert "C++ Fix struct with a field that has the same name as the struct itself"
This reverts commit 9e70e009a2.

This turns out to break CI

Changed the test not to use the same name for a field and the struct
2021-07-09 15:52:28 +02:00
Simon Hausmann
fcc71a3cce Fix image sizes not propagating into layouts when loading remotely
When images are loaded by the WASM-built interpreter, we do support
loading them asynchronously via the DOM. In that case we have a property
inside the HTMLImage in the GL backend that becomes dirty once loaded
and triggers re-evaluation of depending properties/layouts. However that
only works as long as uses of the image sizes are in property bindings.

BuiltinFunction::ImageSize however is marked as pure in the compiler, so
this may mean that something like this results in an initial assignment
instead of a binding:

    Image {
        source: ...
        height: source.height * 1px;
    }

For Rust, etc. that's fine, but when running in the WASM-built
interpreter the expression needs to remain in a binding. Therefore this
hack tries to narrow down this condition to wasm as target.
2021-07-09 14:56:02 +02:00
Olivier Goffart
9e70e009a2 C++ Fix struct with a field that has the same name as the struct itself 2021-07-09 14:37:42 +02:00
Olivier Goffart
6ed5044940 Fix rust compilation when using keywords in struct 2021-07-09 13:33:09 +02:00
Olivier Goffart
5c18e100b0 Fix unary operator + in rust 2021-07-09 12:52:18 +02:00
Tobias Hunger
08a6dc02fc Janitor: Find char, not a str 2021-07-08 20:43:38 +02:00
Tobias Hunger
bf48a6c65e Janitor: Remove some unnecessary returns 2021-07-08 20:43:38 +02:00
Tobias Hunger
63bc31aa44 Janitor: Remove unnecessary closure 2021-07-08 20:43:38 +02:00
Tobias Hunger
35dd3ed282 Janitor: Remove redundant clone() calls 2021-07-08 20:43:38 +02:00
Olivier Goffart
8e52b7d865 Fix bug that caused two way binding to sometimes disapear 2021-07-08 17:44:50 +02:00
Olivier Goffart
4604b70463 We need to collect the ressources in the root component 2021-07-07 19:45:50 +02:00
Olivier Goffart
a987b225b5 Collect all used components before inlining
And do some passes before inlining

We will need the list of components before inlining in order to generate
them if we disable inlining

So we can do some passes on each component before they are inlining

I tried to put the flickable pass in that list, but it did not work
if the Flickable itself is the root of a component
2021-07-07 17:58:43 +02:00
Olivier Goffart
920903ad19 Throw an error if there are duplicated id in a component 2021-07-07 12:31:40 +02:00
Olivier Goffart
c40a0bb5d6 passes: don't prefic the passes with passes::
the run function was moved to the passes module, so all passes are in scope
2021-07-07 11:49:42 +02:00
Olivier Goffart
f73a369786 cargo fmt 2021-07-07 11:04:50 +02:00
Olivier Goffart
8f75aadc70 Move the passes module to its own file
The main reason is that i don't like to edit files named lib.rs
because there are so many files with the same name
2021-07-07 10:48:28 +02:00
Tobias Hunger
e5bdeaa804 Janitor: Remove unnecessary & 2021-07-07 08:42:28 +02:00
Tobias Hunger
ac207428dc Janitor: CSpell fixes
Mark up some special words in documents (like C++ lingo in rust files).
2021-07-06 22:44:09 +02:00
Tobias Hunger
ac2d17e8e4 Janitor: Remove unnecessary format! 2021-07-06 22:34:21 +02:00
Tobias Hunger
c1c9e591f7 Janitor: Simplify if X.is_none() { return None } to X?; 2021-07-06 22:34:21 +02:00
Tobias Hunger
56885bd71d Janitor: Remove useless type conversion 2021-07-06 22:34:21 +02:00
Tobias Hunger
4d712b3f4f Janitor: Clippy suggests to collapse these ifs 2021-07-06 22:34:21 +02:00
Tobias Hunger
af0f193f1d Janitor: Fix clippy::if_same_then_else error
In this case this feels at controversial, but in general I find this
clippy lint pretty helpful: It has caught several copy-paste errors
before.

No behavior change is intended with this patch.
2021-07-06 21:28:36 +02:00
Olivier Goffart
67f0dc280f ptimized unused propery away
Currently, it is a bit limited in the amount of property that it removes
because it will not remove property that are used by properties being
removed, or will consider setting properties as an usage
2021-07-05 15:39:49 +02:00
Tobias Hunger
4be9ca7ffd Janitor: Remove useless () return types 2021-07-05 09:48:29 +02:00
Tobias Hunger
8b3eda8a49 Janitor: Remove some useless 'static that clippy does not like 2021-07-05 09:48:29 +02:00
Tobias Hunger
39984b27db Janitor: Fix spelling in comments 2021-07-03 15:49:43 +02:00
Simon Hausmann
3e55b0e8f8
Prospective cspell warning fix 2021-07-03 10:10:10 +02:00
Tobias Hunger
040c7735ec Dropping a reference does nothing
Is this what was actually intended here?
2021-07-03 09:43:07 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Simon Hausmann
adeb192f6e C++ API: Make LinearGradientBrush and GradientStop private API 2021-07-02 15:34:16 +02:00
Olivier Goffart
c5312fd642 Ugly style: use a layout for the ComboBox
Then it is properly layed out and we can use the auto-wrap in the gallery example
2021-07-02 14:17:15 +02:00
Olivier Goffart
894a369737 C++: Fix warnings on windows
Unproperly escaped path with slashes
2021-07-01 13:50:27 +02:00
Olivier Goffart
35e20763a7 More replacement of &*std::begin with std::data
Complement the previous commit.
It is not ok to call *std::begin for an empty vector.

Also added a test for it.
2021-06-30 17:10:58 +02:00
Simon Hausmann
2662858a71 Fix assert with MSVC when deleting last item in C++ built printer demo
The generated code tries to compute the box layout info for an empty
repeater, where we end up calling `&*std::begin(cells)` and MSVC
asserts that this is dereferencing an invalid iterator. As Olivier spotted,
`std::data` comes to the assert-free rescue :-)
2021-06-30 17:03:28 +02:00
Olivier Goffart
ae114cf79d C++: don't re-export private symbol in the public API
Use the cbindgen_private namespace dirrectly from the generated code
2021-06-28 12:03:49 +02:00
Olivier Goffart
16ba23ae47 Move StateInfo to the private namespace 2021-06-28 11:23:44 +02:00
Olivier Goffart
daff9e8e65 Move Callback and internal Models to the private_api namespace 2021-06-28 11:23:44 +02:00
Olivier Goffart
98cec35080 Increase version numbers 2021-06-28 10:39:43 +02:00
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Tobias Hunger
a38868b4aa Janitor: Fix typo in local function name
No behavior change is intended!
2021-06-28 08:32:00 +02:00
Tobias Hunger
24872e2604 Janitor: Fix typo in in local function name
No behavior change is intended.
2021-06-28 08:32:00 +02:00
Tobias Hunger
96a4885eaf Janitor: Fix type on function name
No behavior change is intended!
2021-06-28 08:32:00 +02:00
Tobias Hunger
4b077d48ae Janiotor: String fix that might have side effect
This changes the name of a NamedReference and I am not sure this change
has no side effects, so put this into an extra patch.

As usual: No behavior change is intended!
2021-06-28 08:32:00 +02:00
Tobias Hunger
a39ce28c7a Janitor: Fiy typo in function name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Tobias Hunger
ef7a9c9428 Janitor: Fix typo in test name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Tobias Hunger
87460c4ac8 Janitor: Fix typo in struct field name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Tobias Hunger
1e30bea812 Janitor: Fix typo in thread-local variable name
No behavior change is intended here!
2021-06-28 08:32:00 +02:00
Olivier Goffart
9b4bcab926 Better error message when overriding a layout property
As suggested by Simon
2021-06-23 17:15:49 +02:00
Olivier Goffart
e721a4cf1e Report error when the 'x' or 'y' property is set for elements in layout 2021-06-23 16:53:45 +02:00