mirror of
https://github.com/servo/servo.git
synced 2025-08-02 12:10:29 +01:00
Auto merge of #26697 - utsavoza:ugo/issue-11681/22-05-2020, r=jdm
Implement CanvasRenderingContext2d.fillText The PR consists of broadly two main changes: - Implementation of Canvas2dRenderingContext.font - Basic implementation of Canvas2dRenderingContext.fillText Although I am not fully sure about the long term goals for the canvas backend in Servo, I assumed limited scope for font and text handling (should support simple text drawing with font selection) in the current implementation as I believe a more complete implementation would eventually be brought in as a part of #22957. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #11681 - [x] There are tests for these changes
This commit is contained in:
commit
721271dcd3
57 changed files with 928 additions and 183 deletions
|
@ -37,7 +37,8 @@ use layout::context::LayoutContext;
|
|||
use layout::display_list::{DisplayListBuilder, WebRenderImageInfo};
|
||||
use layout::layout_debug;
|
||||
use layout::query::{
|
||||
process_content_box_request, process_content_boxes_request, LayoutRPCImpl, LayoutThreadData,
|
||||
process_content_box_request, process_content_boxes_request, process_resolved_font_style_query,
|
||||
LayoutRPCImpl, LayoutThreadData,
|
||||
};
|
||||
use layout::query::{process_element_inner_text_query, process_node_geometry_request};
|
||||
use layout::query::{process_node_scroll_area_request, process_node_scroll_id_request};
|
||||
|
@ -525,6 +526,7 @@ impl LayoutThread {
|
|||
scroll_id_response: None,
|
||||
scroll_area_response: Rect::zero(),
|
||||
resolved_style_response: String::new(),
|
||||
resolved_font_style_response: None,
|
||||
offset_parent_response: OffsetParentResponse::empty(),
|
||||
scroll_offsets: HashMap::new(),
|
||||
text_index_response: TextIndexResponse(None),
|
||||
|
@ -914,6 +916,9 @@ impl LayoutThread {
|
|||
&QueryMsg::ResolvedStyleQuery(_, _, _) => {
|
||||
rw_data.resolved_style_response = String::new();
|
||||
},
|
||||
&QueryMsg::ResolvedFontStyleQuery(_, _, _) => {
|
||||
rw_data.resolved_font_style_response = None;
|
||||
},
|
||||
&QueryMsg::OffsetParentQuery(_) => {
|
||||
rw_data.offset_parent_response = OffsetParentResponse::empty();
|
||||
},
|
||||
|
@ -1206,6 +1211,11 @@ impl LayoutThread {
|
|||
fragment_tree,
|
||||
);
|
||||
},
|
||||
&QueryMsg::ResolvedFontStyleQuery(node, ref property, ref value) => {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
rw_data.resolved_font_style_response =
|
||||
process_resolved_font_style_query(node, property, value);
|
||||
},
|
||||
&QueryMsg::OffsetParentQuery(node) => {
|
||||
rw_data.offset_parent_response = process_offset_parent_query(node);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue