* feat: try to deduplicate imports in codegen
* feat: another attempt
* feat: start testing imports
* feat: clean all global imports
* feat: remove shared imports from CGDescriptor
* feat: remove redundant imports from CGDescriptor
* fix: formatting
* fix: remove libc (base level import)
* feat: roll back named path changes
* feat: last changes and tidy
* experiment: move imports into a separate file
* fix: extra parenthesis
* fix: remove repeated allow statement
* clippy: fix `result_unit_err` warnings
* feat: fix result warnings in script
* doc: document `generate_key` return type
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
* feat: add back result to RangeRequestBounds::get_final
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
A sequence of whitespace shouldn't generate an anonymous table row/cell,
but we can't just throw away the leading whitespace, because afterwards
we may encounter some other content, and then the leading whitespace
should appear in the cell (noticeable with e.g. `white-space: pre`).
* fixed clippy warnings in htmlformelement.rs
* Fixed clippy warnings
* Fixed warnings related to matches!
* made changes to compile "test-tidy" successfully
There is now platform-specific way to get metrics for `line-through` on
MacOS and currently striking through simply does not work. The correct
approach here is likely to first search for these metrics in font tables
and then falling back to deriving them. Searching the font tables is a
larger change, so this change adds the fallback mechanism first. This at
least makes sure that strike through renders at all on Mac.
In a followup change we can add support for getting metrics via HarfBuzz
in a platform-independent way, which is what Gecko does.
Fixes#942.
* rustdoc: Fix fontface broken link error
* Correct link to `Font`
* Reduce the diff a bit
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
During the shutdown process, various threads (such as the
font cache thread) may be finishing up their work. If those threads make
synchronous requests to the compositor, answer them -- even if the
results will be unused. This is at least enough processing for them to
finish their work and exit cleanly.
This addresses crashes that are sometimes seen at exit, particuarly when
the font cache thread tries to register a font during shutdown.
In addition, this change also removes an unused compositor message.
Android's OpenGL emulation layer (goldfish-opengl) has pre-processing
logic that looks for samplers of the type `samplerExternalOES` and
does a simple textual [replacement to change the type][1] to `sampler2D`
before compilation. It also [marks the sampler][2] as 'replaced' so
it can emulate the correct type at runtime.
However, this logic can lead to false positives when the sampler is
declared inside conditional macros. Hence, the sampler's type can be
incorrectly marked as `samplerExternalOES` even though the #if, #ifdef
conditional logic would have declared the type as `sampler2D`.
This seems to be a [known limitation][3].
WebRender (in particular the shared.glsl include) has such conditional
declaration of the texture units used from the shaders.
In particular, the sampler [sColor0 here][4] is declared within ifdefs
to have different types depending on the flags enabled, to allow the
shader to work with different image target kinds.
WebRender also maintain two versions of the compiled shaders in its cache:
1. An unoptimized version with all the conditional logic preserved
in the source until the shader is compiled at runtime on Android,
when the shader is actually used.
2. Multiple optimized versions for combinations of features required
These versions are produced during Servo [build][5]. Thus the
optimized versions eliminate most of the conditional declarations
at build time.
The bug in Servo with current code is because, [by default][6], WebRender
uses the *unoptimized* versions of the shaders. This means the conditional
GLSL source is evaluated at runtime by the Android emulator and thus ends
up with the incorrect type for the sColor0 sampler unit, which breaks the
[texture sampling in the fragment shader][7], causing it to always return
Vec4(0, 0, 0, 1) and rendering all elements on the page black.
This change forces WebRender to use the *optimized* version as a
workaround - the optimized versions have unconditional code for the
sampler declarations so are not susceptible to the emulator issue.
[1]: https://android.googlesource.com/device/generic/goldfish-opengl/+/refs/tags/android-platform-11.0.0_r40/system/GLESv2_enc/GL2Encoder.cpp#1644
[2]: https://android.googlesource.com/device/generic/goldfish-opengl/+/refs/tags/android-platform-11.0.0_r40/system/GLESv2_enc/GL2Encoder.cpp#1673
[3]: https://android.googlesource.com/device/generic/goldfish-opengl/+/refs/tags/android-platform-11.0.0_r40/system/GLESv2_enc/GL2Encoder.cpp#1571
[4]: b36399019c/webrender/res/shared.glsl (L206)
[5]: b36399019c/webrender/build.rs (L289)
[6]: b36399019c/webrender/src/renderer/init.rs (L214)
[7]: b36399019c/webrender/res/composite.glsl (L189)Fixes#31726.
Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
* clippy: remove extra static lifetimes in generated code
* clippy: fix return and cast in generated code
* clippy: fix more warnings in codegen
* clippy: fix all errors from generated files
* Updated comment with 'layout_traits' to 'script_layout_interface'
* Rewrap text
* Remove trailing whitespace
---------
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This adds basic support for `getClientRects()` by sharing code with the
implementation of `getBoundingClientRect()`. In addition to sharing
code, it also shares all of the bugs. Primarily, scrolilng positions are
not taken into account when return boundary rectangles.
The old logic was assuming that all whitespace was a break opportunity,
and that no newlines would be preserved.
Note that text shaping considers the advance of a newline to be the same
as a space. This was problematic because if we have a segment with a
preserved space and newline, only the advance of the space should
contrinute to the size of the block container. Therefore, I'm changing
the breaker logic in other to have newline characters in their own
segment.
Then glyph_run_is_whitespace_ending_with_preserved_newline can just be
renamed to glyph_run_is_preserved_newline.
This patch is still not perfect because it doesn't check allow_wrap(),
so `nowrap` is treated like `normal`, and `pre-wrap` like `pre`.
This brings the version of WebRender used in Servo up-to-date with Gecko
upstream. The big change here is that HiDPI is no longer handled via
WebRender. Instead this happens via a scale applied to the root layer in
the compositor. In addition to this change, various changes are made to
Servo to adapt to the new WebRender API.
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>