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

Pseudo-classes not working #30

Closed
barotto opened this issue Jun 13, 2019 · 13 comments
Closed

Pseudo-classes not working #30

barotto opened this issue Jun 13, 2019 · 13 comments
Labels
bug Something isn't working

Comments

@barotto
Copy link
Contributor

barotto commented Jun 13, 2019

I'm having issues with pseudo classes in the invaders demo. Look at the main menu:
with libRocket:
rocket-invaders
with RmlUi:
rmlui-invaders

It seems like the :hover pseudo-class is not selected as specified in the assets/invaders.rcss file.

Same thing for :active and :checked for other input elements:
libRocket:
rocket-invaders

RmlUi:
rmlui-invaders

@mikke89
Copy link
Owner

mikke89 commented Jun 13, 2019

That's strange, are you on master?
I just tested it, and it's working fine for me.

@barotto
Copy link
Contributor Author

barotto commented Jun 13, 2019

Yes I'm on master. So it's only on my end? That's odd...

@barotto
Copy link
Contributor Author

barotto commented Jun 13, 2019

I'm blaming pseudo-classes, but could it be releated to texture coordinate calculations?

@mikke89
Copy link
Owner

mikke89 commented Jun 13, 2019

It's really hard for me to say as I can't replicate it.

Maybe you can try to isolate where things went wrong, something like git bisect?

Also, you could also try the performance branch to see if it helps. There are quite some changes to how things are dirtied and updated which may or may not help.

@barotto
Copy link
Contributor Author

barotto commented Jun 14, 2019

I tried the performance branch and the issue is not present there.

I also bisected master and, after a bit of tribulation (VM installing, patch backporting, ...), I identified the culprit:

b86efd039bafd77940a9aebe01ca7fa9f33326a0 is the first bad commit
commit b86efd039bafd77940a9aebe01ca7fa9f33326a0
Author: Michael <michael.ragazzon@gmail.com>
Date:   Tue Aug 21 23:59:43 2018 +0200

    Performance: Change several maps and sets to unordered_*.

:040000 040000 79ed19c226ced5701f6043bbb7dd7b2976f26dc5 fad2e1d0103559bd038ade3d7db33f963a2451e5 M	Include
:040000 040000 fb4a6cc5d062bf1d544c333673deab18eb4d6353 fc9dd17cdabd62bc0c28499bb417abad72691392 M	Source

This commit is rather large so I'm afraid my investigation ends here.

@mikke89
Copy link
Owner

mikke89 commented Jun 14, 2019

Thanks a lot, this is really helpful. I know it can be a pain to bisect back in time like that.

Okay, so what I think is happening is that one (or more) of the containers are assumed to be sorted during some operations. After changing to their unordered_* variants, this assumption was broken. Now the order depends on the standard library and compiler which may explain the differences we are seeing.

I did identify some places where things should be ordered while working on the performance branch, which is why it may be working again there.

My primary suspect is the PropertyNameList, you can try changing it back in Types.h from:
typedef std::unordered_set< String > PropertyNameList;
to
typedef std::set< String > PropertyNameList;

Other possible candidates could be the PropertyMap, Stylesheet::NodeIndex, and, uhm, actually I'm putting all my bets on one of those three 🎲 :)

@barotto
Copy link
Contributor Author

barotto commented Jun 14, 2019

Yep, changing PropertyMap to std::map did the trick.
We use different STL implementations so this explains it.

(and all this compiling clearly explains to me why I need one of those new 16-core Ryzen 9 ... 🐌 🖥️ )

@mikke89
Copy link
Owner

mikke89 commented Jun 14, 2019

Awesome, good job finding it :)

Let's replace it on master while we wait for the performance branch to merge. I'll have another look at the performance branch to make sure we don't have any issues there.

I can only imagine, looking at CPUs myself these days, the new AMD stuff looks really promising.

mikke89 added a commit that referenced this issue Jun 15, 2019
@mikke89 mikke89 closed this as completed Jun 17, 2019
@kim8823
Copy link

kim8823 commented Mar 11, 2020

Seems like they are broken again...
:hover and :active work, but not e.g. :first-child and :last-child.
I'm on the 3.2 release.
Already tried to change the PropertyMap to a std::map, but no success.

@viciious
Copy link
Contributor

Seems like they are broken again...
:hover and :active work, but not e.g. :first-child and :last-child.
I'm on the 3.2 release.
Already tried to change the PropertyMap to a std::map, but no success.

Try disabling third party containers in CMake options and see if that helps maybe.

@kim8823
Copy link

kim8823 commented Mar 12, 2020

doesn't make a difference

@mikke89 mikke89 reopened this Mar 12, 2020
@mikke89
Copy link
Owner

mikke89 commented Mar 12, 2020

I'll take a look at it, sounds like it's related to pseudo classes if :hover and :active is working.

@mikke89 mikke89 added the bug Something isn't working label Mar 12, 2020
@mikke89
Copy link
Owner

mikke89 commented Jun 14, 2020

Okay, this was unrelated to the original problem. There was an issue where structural pseudo-classes required parenthesis to properly parse. This should now have been fixed.

Thanks for reporting the issue :)

@mikke89 mikke89 closed this as completed Jun 14, 2020
Unicornum added a commit to Unicornum/Externals.RmlUi that referenced this issue Aug 1, 2020
* Create data binding sample

* add virtual dcon to Rml::Core::Releasable

* Fix CMake 3.17 STRING warning

CMake Warning (dev) at CMakeLists.txt:29 (set):
  implicitly converting 'string' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.

* Update number parser procedure. Fixes mikke89#102. Improves performance.

* X11 Shell: Consider additional paths for the assets directory. More robust, and makes remote compilation/debugging on WSL from Visual Studio work with default configuration.

* Use the F8 key to toggle the debugger on all platforms.

* Fix warnings on GCC and Clang with -Wall -pedantic

* Fix warning on MSVC

* Travis: Add warning and pedantic compilation flags

* Fix some additional warnings in GCC

* Property 'white-space: nowrap' should not disable scrollbars on overflow. See mikke89#94.

* Dirty font effects when the 'font-effect' property is changed. Fixes mikke89#98.

* Fix structural pseudo-selectors only being applied if written with parenthesis. See mikke89#30.

* Remove the StringCache. See mikke89#96.

* Windows shell: Add another candidate path for the samples folder search.

* Selection box: Prevent scrolling the parent window when hovering over the drop down list.

* Select element: Close select box if parent document is scrolled.

* Reduce memory allocations while parsing the 'style' attribute.

* Do not require a final semi-colon while parsing the 'style' attribute.

* Fix possible wrong layout in widget slider

* Make project C++20 compatible

* CMake: Enable the C++14 standard project-wide.

* Element 'select': Automatically position and size the selection box to the available space within the context's window dimensions. See mikke89#91.

* ShellX11: Load and activate mouse cursors.

* Update changelog.

* Fix geometry not setting its host element or context on construction

* Several warnings fixed with '-Wall -Wextra' and on MSVC with '/W4'.

* Enhanced Tracy profiler CMake configuration. Add separate build configuration.

* Element 'select': Respect 'height' property on selectbox set by user in style sheet.

* Add missing include

* Fix SFML and SDL samples on Windows.

* Add sdl2_image include to CMakeLists.txt

* Fix tiled decorator alignment not working.

* Release RmlUi 3.3

* Start working on RmlUi 4.0

* Update gitignore

* Debugger: Display contents of text elements

* Debugger: Use pre-wrap in event log. Display beacon if messages are logged during application start-up.

* Try fixing problems from the None macro in X11 (ugh)

* Add forward to flat_map and flat_set emplace

* XMLNodeHandlerTabSet: 'tabs' and 'panels' should return null

* Basic implementation of data binding (WIP)

* Make DataViewText take a text element, replacing its text contents with the data binding.

* Set values on data view constructions. Add attribute view.

* Remove handling of data binding in xml parser

* Add data controller for attributes

* Make slider widget update attribute on value change

* Update utf8 string iterator

* Add DataViewIf

* Make Variant constructors explicit

* Variant: Add bool, double, int64 types, remove word.

* Add type converters for double, int64_t

* Implement data types

* Refactor data bindings

* Add data view for style

* Start implementing data view 'for' (highly WIP)

* Experimenting with approach for nested variables in structs and arrays.

* Data variables address parsing and get/set values

* Make data arrays safer, no need for Update

* Refactor, move the new data variable types into the library. Now working 'for' loops for structs.

* Custom iterator name in data-for

* Better parsing in data-for: Nested for loops now work.

* Safely add and remove data views during iteration, and clean up data views on element removal.

* Only update dirty data variables

* Some cleanup

* Getters and setters for data struct members

* Add arbitrary get/set functions as data binding

* Clean up data binding API

* Update data controller

* Data types now associated with the Context. Clean up data model.

* Move creation of data views and controllers to ElementUtilities. Clean up.

* Data views: recursively update

* Start creating a parser for data views

* Trim trailing zeros in float converted to String. Remove PrettyFormatNumbers from debugger.

* Add data expression transform functions (callbacks).

* Add data-class and data-rml

* XML Parser: Ignore <tags> in {{ double brackets }}

* Read in whole document in xml parser before parsing.

* Handle raw inner xml contents of data-for elements more robustly.

* Some refactoring of DataViews. Move the default DataViews to separate files.

* - Implemented 'data-event' controller. Can use assignment in its expression, and also 'ev.' variable name to fetch parameters from the event.
- Move default controllers to separate file.
- The 'data-value' controller now uses the 'change' event to listen for value changes.
- Get size on data array variables by .size member.

* Make initialization of data views and controllers safer

* Update comments. Generalize XMLParser. Data model and variables refactoring.

* Add additional operator precedence in data parser. Add more tests. Add format() and round() transform functions to data parser.

* Robustify text elements from illegal syntax.

* Better warnings.

* Start data binding example with invaders

* Implement it_index in data view for. Rename some functions.

* Add data view: visible

* Clean up data binding sample, add a basic example.

* Fix headers

* In Element: Set parent just after inserting child element.

* Add missing headers

* Add ability to retrieve an existing data model from Context.

* DataModel make views and controllers internal.

* Rename DataParser file to DataExpression. Some cleanup.

* Fix removal of event listener in data-event.

* Enable removal of data model from context.

* Unify parsing of curly brackets in RML.

* The big restructuring for RmlUi 4.0. This involves breaking changes but should benefit everyone using the library in the future.

- The old `Controls` plugin is now gone. But fear not! It has been merged into the `Core` project .
- The old `Rml::Core` and `Rml::Controls` namespaces are now located directly in the `Rml` namespace.
- The old `Controls` public header files have been moved to `<RmlUi/Core/Elements/...>`.
- The old `Controls` source files and private header files have been moved to `Source/Core/Elements/...`.
- The `Debugger` plugin remains as before at the same location and same namespace `Rml::Debugger`.

The Lua plugins have been changed to reflect the above changes.

- The old Lua plugins `RmlCoreLua` and `RmlControlsLua` have been merged into a single library `RmlLua`.
- The public header files are now located at `<RmlUi/Lua/...>`.
- The Lua plugin is now initialized by calling `Rml::Lua::Initialise()` located in `<RmlUi/Lua/Lua.h>`.
- Separated the Lua interpreter functions from initialization and the Lua plugin.
- Renamed macros in the Lua plugin, they now start with `RMLUI_`.

Related changes.

- Refactored slider widgets to avoid duplicate names in Core and Controls.
- Renamed header guard macros.

* Update changelog

* Add some missing files to RmlUi/Core.h

* Refactor some of the Transform functionality. Move functions that should only be called internally to an internal TransformUtilities. Rename Transforms::Primitive to TransformPrimitive.

* Initialize OpenGL viewport directly before rendering the gui

* Add view to sfml2 example

* Remove Resize method

* Update readme

* Fix compilation and warnings in shared libraries.

* Update changelog

* Fix mingw build

* Move target_link_libraries to shell, and rename WIN32 to RMLUI_PLATFORM_WIN32

* Fix win32 shell compilation issue in some environments.

* Add a note for the lifetime requirement of 'LoadFontFace' from memory.

* Add FamilyId to std::hash.

* Add MinGW build to AppVeyor configuration. Small tweak to Travis.

* Fix warning in SFML sample.

* Initial document_base_tag branch

* code cleanup

* Implement `Element::QuerySelector` and `Element::QuerySelectorAll`.

* Fix build with EASTL when it is configured to use size_type different from size_t.

* Add ability for user to override container types.

Resolves mikke89#107.

* Extend example of custom type conversion operators.

* Update Include/RmlUi/UserConfig.h

Co-authored-by: Michael R. P. Ragazzon <mikke89@users.noreply.github.com>
Update Include/RmlUi/Core/Types.h

Co-authored-by: Michael R. P. Ragazzon <mikke89@users.noreply.github.com>

* Move config file into a subdir and include it in Traits.h and Types.h

* Some cleanup and warning fixes.

* Update CMake for custom configuration.

Co-authored-by: Michael Ragazzon <michael.ragazzon@gmail.com>
Co-authored-by: SpaceCat~Chan <49094338+SpaceCat-Chan@users.noreply.github.com>
Co-authored-by: Michael R. P. Ragazzon <mikke89@users.noreply.github.com>
Co-authored-by: Jan Niklas Hasse <jhasse@bixense.com>
Co-authored-by: Karsten Hachmeister <karsten@hachmeister.org>
Co-authored-by: Cloud Wu <cloudwu@gmail.com>
Co-authored-by: aquawicket <aquawicket@hotmail.com>
Co-authored-by: Rokas Kupstys <rokups@zoho.com>
Co-authored-by: Rokas Kupstys <19151258+rokups@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants