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

Implement CanvasRenderingContext2D.font property #26176

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Add empty handler for CanvasFontQuery

  • Loading branch information
pylbrecht committed May 17, 2020
commit 25dfbcadf14b2f5b653dc45a57bbd2b78b941049
@@ -90,6 +90,9 @@ pub struct LayoutThreadData {

/// A queued response for the viewport dimensions for a given browsing context.
pub inner_window_dimensions_response: Option<TypedSize2D<f32, CSSPixel>>,

/// A queued response for the resolved font property of a canvas element.
pub canvas_font_response: String,
}

pub struct LayoutRPCImpl(pub Arc<Mutex<LayoutThreadData>>);
@@ -1095,3 +1098,11 @@ fn is_last_table_row() -> bool {
// FIXME(ferjm) Implement this.
false
}

pub fn process_canvas_font_request<'dom>(
_node: impl LayoutNode<'dom>,
_font: &str,
_layout_root: &mut dyn Flow,
) -> String {
unimplemented!()
}
@@ -50,12 +50,14 @@ use layout::flow_ref::FlowRef;
use layout::incremental::{RelayoutMode, SpecialRestyleDamage};
use layout::layout_debug;
use layout::parallel;
use layout::query::{
process_canvas_font_request, process_offset_parent_query, process_resolved_style_request,
};
use layout::query::{process_client_rect_query, process_element_inner_text_query};
use layout::query::{
process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData,
};
use layout::query::{process_node_scroll_area_request, process_node_scroll_id_request};
use layout::query::{process_offset_parent_query, process_resolved_style_request};
use layout::sequential;
use layout::traversal::{
ComputeStackingRelativePositions, PreorderFlowTraversal, RecalcStyleAndConstructFlows,
@@ -575,6 +577,7 @@ impl LayoutThread {
nodes_from_point_response: vec![],
element_inner_text_response: String::new(),
inner_window_dimensions_response: None,
canvas_font_response: String::new(),
})),
webrender_image_cache: Arc::new(RwLock::new(FnvHashMap::default())),
paint_time_metrics: paint_time_metrics,
@@ -1600,8 +1603,10 @@ impl LayoutThread {
.get(&browsing_context_id)
.cloned();
},
&QueryMsg::CanvasFontQuery(_node, ref _font) => {
unimplemented!();
&QueryMsg::CanvasFontQuery(node, ref font) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.canvas_font_response =
process_canvas_font_request(node, font, root_flow);
},
},
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
@@ -107,7 +107,6 @@ pub enum QueryMsg {
OffsetParentQuery(OpaqueNode),
TextIndexQuery(OpaqueNode, Point2D<f32>),
NodesFromPointQuery(Point2D<f32>, NodesFromPointQueryType),
CanvasFontQuery(OpaqueNode, String),

// FIXME(nox): The following queries use the TrustedNodeAddress to
// access actual DOM nodes, but those values can be constructed from
@@ -117,6 +116,7 @@ pub enum QueryMsg {
StyleQuery,
ElementInnerTextQuery(TrustedNodeAddress),
InnerWindowDimensionsQuery(BrowsingContextId),
CanvasFontQuery(TrustedNodeAddress, String),
}

/// Any query to perform with this reflow.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.