mirror of
https://github.com/servo/servo.git
synced 2025-07-26 00:30:22 +01:00
Auto merge of #14057 - glennw:update-wr-keys, r=metajack
Update WR, add some key mappings, bind Ctrl-F12 to WR profiler. <!-- 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/14057) <!-- Reviewable:end -->
This commit is contained in:
commit
651e40f33e
15 changed files with 63 additions and 43 deletions
|
@ -18,7 +18,7 @@ use gleam::gl::types::{GLint, GLsizei};
|
|||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||
use ipc_channel::router::ROUTER;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState};
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, CONTROL};
|
||||
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId, TraversalDirection};
|
||||
use net_traits::image::base::{Image, PixelFormat};
|
||||
use profile_traits::mem::{self, Reporter, ReporterRequest};
|
||||
|
@ -1302,7 +1302,23 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn on_key_event(&self, ch: Option<char>, key: Key, state: KeyState, modifiers: KeyModifiers) {
|
||||
fn on_key_event(&mut self,
|
||||
ch: Option<char>,
|
||||
key: Key,
|
||||
state: KeyState,
|
||||
modifiers: KeyModifiers) {
|
||||
// Steal a few key events for webrender debug options.
|
||||
if modifiers.contains(CONTROL) && state == KeyState::Pressed {
|
||||
match key {
|
||||
Key::F12 => {
|
||||
let profiler_enabled = self.webrender.get_profiler_enabled();
|
||||
self.webrender.set_profiler_enabled(!profiler_enabled);
|
||||
return;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
let msg = ConstellationMsg::KeyEvent(ch, key, state, modifiers);
|
||||
if let Err(e) = self.constellation_chan.send(msg) {
|
||||
warn!("Sending key event to constellation failed ({}).", e);
|
||||
|
|
|
@ -523,8 +523,6 @@ impl WebRenderFrameBuilder {
|
|||
stacking_context: &mut webrender_traits::StackingContext)
|
||||
-> DisplayListId {
|
||||
let id = api.next_display_list_id();
|
||||
stacking_context.has_stacking_contexts = stacking_context.has_stacking_contexts ||
|
||||
display_list.descriptor().has_stacking_contexts;
|
||||
stacking_context.display_lists.push(id);
|
||||
self.display_lists.push((id, display_list));
|
||||
id
|
||||
|
|
4
components/servo/Cargo.lock
generated
4
components/servo/Cargo.lock
generated
|
@ -2762,7 +2762,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2787,7 +2787,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
4
ports/cef/Cargo.lock
generated
4
ports/cef/Cargo.lock
generated
|
@ -2620,7 +2620,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2645,7 +2645,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
|
|
@ -703,6 +703,19 @@ impl Window {
|
|||
VirtualKeyCode::Tab => Ok(Key::Tab),
|
||||
VirtualKeyCode::Subtract => Ok(Key::Minus),
|
||||
|
||||
VirtualKeyCode::F1 => Ok(Key::F1),
|
||||
VirtualKeyCode::F2 => Ok(Key::F2),
|
||||
VirtualKeyCode::F3 => Ok(Key::F3),
|
||||
VirtualKeyCode::F4 => Ok(Key::F4),
|
||||
VirtualKeyCode::F5 => Ok(Key::F5),
|
||||
VirtualKeyCode::F6 => Ok(Key::F6),
|
||||
VirtualKeyCode::F7 => Ok(Key::F7),
|
||||
VirtualKeyCode::F8 => Ok(Key::F8),
|
||||
VirtualKeyCode::F9 => Ok(Key::F9),
|
||||
VirtualKeyCode::F10 => Ok(Key::F10),
|
||||
VirtualKeyCode::F11 => Ok(Key::F11),
|
||||
VirtualKeyCode::F12 => Ok(Key::F12),
|
||||
|
||||
VirtualKeyCode::NavigateBackward => Ok(Key::NavigateBackward),
|
||||
VirtualKeyCode::NavigateForward => Ok(Key::NavigateForward),
|
||||
_ => Err(()),
|
||||
|
|
|
@ -16,7 +16,8 @@ void write_clip(ClipInfo clip) {
|
|||
clip.bottom_right.outer_inner_radius.x,
|
||||
clip.bottom_left.outer_inner_radius.x);
|
||||
//TODO: interpolate the final mask UV
|
||||
vClipMaskUvRect = clip.mask_info.uv_rect;
|
||||
vec2 texture_size = textureSize(sMask, 0);
|
||||
vClipMaskUvRect = clip.mask_info.uv_rect / texture_size.xyxy;
|
||||
vClipMaskLocalRect = clip.mask_info.local_rect; //TODO: transform
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -254,7 +254,8 @@ struct PrimitiveInstance {
|
|||
int render_task_index;
|
||||
int layer_index;
|
||||
int clip_address;
|
||||
ivec3 user_data;
|
||||
int sub_index;
|
||||
ivec2 user_data;
|
||||
};
|
||||
|
||||
PrimitiveInstance fetch_instance(int index) {
|
||||
|
@ -270,7 +271,8 @@ PrimitiveInstance fetch_instance(int index) {
|
|||
pi.render_task_index = data0.z;
|
||||
pi.layer_index = data0.w;
|
||||
pi.clip_address = data1.x;
|
||||
pi.user_data = data1.yzw;
|
||||
pi.sub_index = data1.y;
|
||||
pi.user_data = data1.zw;
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
@ -302,7 +304,10 @@ struct Primitive {
|
|||
vec4 local_clip_rect;
|
||||
int prim_index;
|
||||
int clip_index;
|
||||
ivec3 user_data;
|
||||
// when sending multiple primitives of the same type (e.g. border segments)
|
||||
// this index allows the vertex shader to recognize the difference
|
||||
int sub_index;
|
||||
ivec2 user_data;
|
||||
};
|
||||
|
||||
Primitive load_primitive(int index) {
|
||||
|
@ -318,8 +323,9 @@ Primitive load_primitive(int index) {
|
|||
prim.local_clip_rect = pg.local_clip_rect;
|
||||
|
||||
prim.prim_index = pi.specific_prim_index;
|
||||
prim.user_data = pi.user_data;
|
||||
prim.clip_index = pi.clip_address;
|
||||
prim.sub_index = pi.sub_index;
|
||||
prim.user_data = pi.user_data;
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
@ -588,7 +594,6 @@ struct Image {
|
|||
vec4 st_rect; // Location of the image texture in the texture atlas.
|
||||
vec4 stretch_size_and_tile_spacing; // Size of the actual image and amount of space between
|
||||
// tiled instances of this image.
|
||||
bool has_pixel_coords;
|
||||
};
|
||||
|
||||
Image fetch_image(int index) {
|
||||
|
@ -599,9 +604,6 @@ Image fetch_image(int index) {
|
|||
image.st_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0));
|
||||
image.stretch_size_and_tile_spacing = texelFetchOffset(sData32, uv, 0, ivec2(1, 0));
|
||||
|
||||
image.has_pixel_coords = image.st_rect.z < 0.0;
|
||||
image.st_rect.z = abs(image.st_rect.z);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ void main(void) {
|
|||
prim.layer,
|
||||
prim.tile);
|
||||
|
||||
vStopCount = int(prim.user_data.y);
|
||||
vStopCount = int(prim.user_data.x);
|
||||
vPos = vi.local_clamped_pos;
|
||||
|
||||
// Snap the start/end points to device pixel units.
|
||||
|
@ -24,10 +24,8 @@ void main(void) {
|
|||
vStartPoint = floor(0.5 + gradient.start_end_point.xy * uDevicePixelRatio) / uDevicePixelRatio;
|
||||
vEndPoint = floor(0.5 + gradient.start_end_point.zw * uDevicePixelRatio) / uDevicePixelRatio;
|
||||
|
||||
int stop_index = int(prim.user_data.x);
|
||||
|
||||
for (int i=0 ; i < vStopCount ; ++i) {
|
||||
GradientStop stop = fetch_gradient_stop(stop_index + i);
|
||||
GradientStop stop = fetch_gradient_stop(prim.sub_index + i);
|
||||
vColors[i] = stop.color;
|
||||
vOffsets[i/4][i%4] = stop.offset.x;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Border border = fetch_border(prim.prim_index);
|
||||
int sub_part = prim.sub_index;
|
||||
|
||||
vec2 tl_outer = prim.local_rect.xy;
|
||||
vec2 tl_inner = tl_outer + vec2(max(border.radii[0].x, border.widths.x),
|
||||
|
@ -27,7 +28,7 @@ void main(void) {
|
|||
-max(border.radii[1].w, border.widths.w));
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (prim.user_data.x) {
|
||||
switch (sub_part) {
|
||||
case PST_TOP_LEFT:
|
||||
segment_rect = vec4(tl_outer, tl_inner - tl_outer);
|
||||
break;
|
||||
|
@ -92,9 +93,6 @@ void main(void) {
|
|||
vLocalRect = prim.local_rect;
|
||||
#endif
|
||||
|
||||
float x0, y0, x1, y1;
|
||||
int sub_part = prim.user_data.x;
|
||||
|
||||
switch (sub_part) {
|
||||
case PST_LEFT:
|
||||
vBorderStyle = int(border.style.x);
|
||||
|
@ -150,6 +148,7 @@ void main(void) {
|
|||
break;
|
||||
}
|
||||
|
||||
float x0, y0, x1, y1;
|
||||
switch (sub_part) {
|
||||
// These are the layer tile part PrimitivePart as uploaded by the tiling.rs
|
||||
case PST_TOP_LEFT:
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
BoxShadow bs = fetch_boxshadow(prim.prim_index);
|
||||
vec4 segment_rect = fetch_instance_geometry(prim.user_data.x + prim.user_data.y);
|
||||
vec4 segment_rect = fetch_instance_geometry(prim.sub_index);
|
||||
|
||||
VertexInfo vi = write_vertex(segment_rect,
|
||||
prim.local_clip_rect,
|
||||
prim.layer,
|
||||
prim.tile);
|
||||
|
||||
RenderTaskData child_task = fetch_render_task(prim.user_data.z);
|
||||
RenderTaskData child_task = fetch_render_task(prim.user_data.x);
|
||||
vUv.z = child_task.data1.x;
|
||||
|
||||
// Constant offsets to inset from bilinear filtering border.
|
||||
|
|
|
@ -7,9 +7,8 @@ void main(void) {
|
|||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Gradient gradient = fetch_gradient(prim.prim_index);
|
||||
|
||||
int stop_index = prim.user_data.x + prim.user_data.y;
|
||||
GradientStop g0 = fetch_gradient_stop(stop_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(stop_index + 1);
|
||||
GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1);
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (int(gradient.kind.x)) {
|
||||
|
|
|
@ -7,9 +7,8 @@ void main(void) {
|
|||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Gradient gradient = fetch_gradient(prim.prim_index);
|
||||
|
||||
int stop_index = prim.user_data.x + prim.user_data.y;
|
||||
GradientStop g0 = fetch_gradient_stop(stop_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(stop_index + 1);
|
||||
GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1);
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (int(gradient.kind.x)) {
|
||||
|
|
|
@ -23,14 +23,9 @@ void main(void) {
|
|||
#endif
|
||||
|
||||
// vUv will contain how many times this image has wrapped around the image size.
|
||||
vec2 st0 = image.st_rect.xy;
|
||||
vec2 st1 = image.st_rect.zw;
|
||||
|
||||
if (image.has_pixel_coords) {
|
||||
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
|
||||
st0 /= texture_size;
|
||||
st1 /= texture_size;
|
||||
}
|
||||
vec2 st0 = image.st_rect.xy / texture_size;
|
||||
vec2 st1 = image.st_rect.zw / texture_size;
|
||||
|
||||
vTextureSize = st1 - st0;
|
||||
vTextureOffset = st0;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
TextRun text = fetch_text_run(prim.prim_index);
|
||||
Glyph glyph = fetch_glyph(prim.user_data.x + prim.user_data.y);
|
||||
Glyph glyph = fetch_glyph(prim.sub_index);
|
||||
vec4 local_rect = vec4(glyph.offset.xy, (glyph.uv_rect.zw - glyph.uv_rect.xy) / uDevicePixelRatio);
|
||||
|
||||
#ifdef WR_FEATURE_TRANSFORM
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#define varying in
|
||||
|
||||
// Uniform inputs
|
||||
uniform sampler2D sMask;
|
||||
|
||||
// Fragment shader outputs
|
||||
out vec4 oFragColor;
|
||||
|
@ -35,6 +34,7 @@
|
|||
// Shared shader uniforms
|
||||
//======================================================================================
|
||||
uniform sampler2D sDiffuse;
|
||||
uniform sampler2D sMask;
|
||||
|
||||
//======================================================================================
|
||||
// Interpolator definitions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue