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

Fixed background-position: center center being invalid CSS #1

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
25c995c
Fixed type-o in margin collating
Sep 13, 2019
c6b430f
Merge pull request #68 from Kalmend/okalmend/css-fixes
lexborisov Oct 10, 2019
5cd6581
Added border spacing
Oct 17, 2019
77292e9
Fix function declaration
Oct 17, 2019
2ce4f7f
Fix collate declaration
Oct 17, 2019
aefa5d7
When a property is repeated with multiple values take the last one
Oct 21, 2019
befc1cb
Merge pull request #70 from aygulsalahli/fix-repeated-property
lexborisov Oct 21, 2019
0d6e102
Merge pull request #69 from aygulsalahli/border_spacing
lexborisov Oct 21, 2019
9f6ba5d
Finder: Expand pseudo_class support
Oct 22, 2019
a7cfe1f
Merge pull request #71 from Kalmend/okalmend/custom-element-bug
lexborisov Oct 23, 2019
e56c929
Finder: Fixed type-o in active pseudo-class
Oct 24, 2019
84057fd
Merge pull request #72 from Kalmend/okalmend/fix-pseudo-class
lexborisov Oct 25, 2019
96e4b95
Finder: type-o in checked pseudo-class
Oct 28, 2019
5d6dec9
Merge pull request #73 from Kalmend/okalmend/fix-pseudo-class
lexborisov Oct 28, 2019
ff60ef8
Change the way background is parsed and serialized; One node can have…
Nov 1, 2019
13fb591
Removed more background list related structs and functions
Nov 1, 2019
723cbeb
revert mistakenly removed background-size/repeat back
Nov 1, 2019
4c03bfc
Merge pull request #75 from aygulsalahli/collation-fixes
lexborisov Nov 14, 2019
a7ce974
Fixed myhtml_token_node_attribute_last() for return last attribute.
lexborisov Jan 8, 2020
bf4e8f5
Fixed background-position: center center being invalid CSS
Apr 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions include/modest/style/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ void modest_style_map_collate_declaration_padding(modest_t* modest, myhtml_tree_
void modest_style_map_collate_declaration_margin(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_width(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_style(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_background(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_top(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_bottom(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_left(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);
void modest_style_map_collate_declaration_border_right(modest_t* modest, myhtml_tree_node_t* node, mycss_declaration_entry_t* decl, mycss_property_type_t type, modest_style_raw_specificity_t* spec);

#ifdef __cplusplus
} /* extern "C" */
Expand Down
12 changes: 6 additions & 6 deletions include/modest/style/map_resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_background,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
Expand All @@ -50,6 +51,7 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
Expand All @@ -58,6 +60,7 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_bottom,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
Expand All @@ -78,21 +81,18 @@ static const modest_style_map_collate_f modest_style_map_static_collate_declarat
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_left,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_right,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_style,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_border_top,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
modest_style_map_collate_declaration_for_all,
Expand Down
12 changes: 12 additions & 0 deletions include/mycss/declaration/default_entries.h
Original file line number Diff line number Diff line change
Expand Up @@ -801,4 +801,16 @@ static mycss_declaration_entry_t mycss_declaration_default_entry_vertical_align
NULL, NULL
};

static mycss_declaration_entry_t mycss_declaration_default_entry_border_spacing = {
MyCSS_PROPERTY_TYPE_BORDER_SPACING,
MyCSS_PROPERTY_VALUE_UNDEF,
&(mycss_values_shorthand_two_type_t){
&(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
&(mycss_values_length_t){{0}, false, MyCSS_UNIT_TYPE_UNDEF},
},
false,
MyCSS_DECLARATION_FLAGS_READ_ONLY,
NULL, NULL
};

#endif /* MyCSS_DECLARATION_DEFAULT_ENTRIES_H */
2 changes: 1 addition & 1 deletion include/mycss/declaration/default_resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static mycss_declaration_entry_t * mycss_declaration_default_entry_index_type[My
&mycss_declaration_default_entry_border_right_color,
&mycss_declaration_default_entry_border_right_style,
&mycss_declaration_default_entry_border_right_width,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_border_spacing,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_undef,
&mycss_declaration_default_entry_border_top_color,
Expand Down
1 change: 1 addition & 0 deletions include/mycss/declaration/entry_destroy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_image(myc
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_repeat(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_position(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_background_size(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);
mycss_declaration_entry_t * mycss_declaration_entry_destroy_border_spacing(mycss_declaration_t* declaration, mycss_declaration_entry_t* decl_entry, bool self_destroy);

#ifdef __cplusplus
} /* extern "C" */
Expand Down
2 changes: 1 addition & 1 deletion include/mycss/declaration/entry_destroy_resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static mycss_callback_declaration_destroy_f mycss_declaration_entry_destroy_map_
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_undef,
mycss_declaration_entry_destroy_border_spacing,
mycss_declaration_entry_destroy_border_style,
mycss_declaration_entry_destroy_border_x,
mycss_declaration_entry_destroy_undef,
Expand Down
2 changes: 1 addition & 1 deletion include/mycss/declaration/serialization_resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static mycss_declaration_serialization_f mycss_declaration_serialization_map_by_
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_undef,
mycss_declaration_serialization_shorthand_two_type,
mycss_declaration_serialization_shorthand_four,
mycss_declaration_serialization_border_x,
mycss_declaration_serialization_undef,
Expand Down
6 changes: 6 additions & 0 deletions include/mycss/property/const.h
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,12 @@ enum mycss_property_border_top_right_radius {
}
typedef mycss_property_border_top_right_radius_t;

enum mycss_property_border_spacing {
MyCSS_PROPERTY_BORDER_SPACING_INHERIT = 0x0092,
MyCSS_PROPERTY_BORDER_SPACING__LENGTH = 0x019a,
}
typedef mycss_property_border_spacing_t;

enum mycss_property_border_top_style {
MyCSS_PROPERTY_BORDER_TOP_STYLE_NONE = 0x00d3,
MyCSS_PROPERTY_BORDER_TOP_STYLE_SOLID = 0x013d,
Expand Down
1 change: 1 addition & 0 deletions include/mycss/property/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ bool mycss_property_parser_border_right(mycss_entry_t* entry, mycss_token_t* tok
bool mycss_property_parser_border_right_color(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_right_style(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_right_width(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_short_two_type(mycss_entry_t* entry, mycss_token_t* token);
bool mycss_property_parser_border_spacing(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_style(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
bool mycss_property_parser_border_top(mycss_entry_t* entry, mycss_token_t* token, bool last_response);
Expand Down
2 changes: 1 addition & 1 deletion include/mycss/values/destroy.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ mycss_values_cross_fade_t * mycss_values_destroy_cross_fade(mycss_entry_t* entry
mycss_values_image_list_t * mycss_values_destroy_image_list(mycss_entry_t* entry, mycss_values_image_list_t* value, bool self_destroy);

/* Background */
mycss_values_background_list_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_list_t* value, bool self_destroy);
mycss_values_background_t * mycss_values_destroy_background(mycss_entry_t* entry, mycss_values_background_t* value, bool self_destroy);
mycss_values_background_repeat_list_t * mycss_values_destroy_background_repeat(mycss_entry_t* entry, mycss_values_background_repeat_list_t* value, bool self_destroy);
mycss_values_background_position_t * mycss_values_destroy_background_position(mycss_entry_t* entry, mycss_values_background_position_t* value, bool self_destroy);
mycss_values_background_size_list_t * mycss_values_destroy_background_size(mycss_entry_t* entry, mycss_values_background_size_list_t* value, bool self_destroy);
Expand Down
8 changes: 0 additions & 8 deletions include/mycss/values/values.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ typedef struct mycss_values_background_position mycss_values_background_position
typedef struct mycss_values_background_size_list mycss_values_background_size_list_t;
typedef struct mycss_values_background_size_entry mycss_values_background_size_entry_t;
typedef struct mycss_values_background mycss_values_background_t;
typedef struct mycss_values_background_list mycss_values_background_list_t;

typedef struct mycss_values_border mycss_values_border_t;

Expand Down Expand Up @@ -472,10 +471,6 @@ struct mycss_values_background {
mycss_declaration_entry_t* color;
};

struct mycss_values_background_list {
mycss_values_background_t* entries;
size_t entries_length;
};

struct mycss_values_background_repeat {
mycss_property_background_t horizontal;
Expand Down Expand Up @@ -518,9 +513,6 @@ mycss_values_image_t * mycss_values_image_list_add_entry(mycss_entry_t* entry, m
mycss_values_background_repeat_t * mycss_values_background_repeat_list_add_entry(mycss_entry_t* entry, mycss_values_background_repeat_list_t *list);
mycss_values_background_size_entry_t * mycss_values_background_size_list_add_entry(mycss_entry_t* entry, mycss_values_background_size_list_t *list);

mycss_values_background_t * mycss_values_background_list_add_entry(mycss_entry_t* entry, mycss_values_background_list_t *list);
mycss_values_background_t * mycss_values_background_list_current_entry(mycss_values_background_list_t *list);

#ifdef __cplusplus
} /* extern "C" */
#endif
Expand Down
22 changes: 20 additions & 2 deletions source/modest/finder/pseudo_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ bool modest_finder_selector_sub_type_pseudo_class_undef(modest_finder_t* finder,

bool modest_finder_selector_sub_type_pseudo_class_active(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if (base_node->token)
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "active", 6);
return false;
}

Expand Down Expand Up @@ -506,10 +508,14 @@ bool modest_finder_selector_sub_type_pseudo_class_checked(modest_finder_t* finde
attr = attr->next;
}
}
else if(base_node->tag_id == MyHTML_TAG_OPTION) {
else if(base_node->tag_id == MyHTML_TAG_OPTION)
{
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "selected", 8);
}

else if(base_node->token && base_node->tag_id >= MyHTML_TAG_LAST_ENTRY)
{
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "checked", 7);
}
return false;
}

Expand Down Expand Up @@ -600,6 +606,14 @@ bool modest_finder_selector_sub_type_pseudo_class_disabled(modest_finder_t* find

return false;
}

/* custom HTML tag*/
if(base_node->token && base_node->tag_id >= MyHTML_TAG_LAST_ENTRY)
{
if (modest_finder_match_attribute_only_key(base_node->token->attr_first, "disabled", 8))
return true;
return false;
}

return false;
}
Expand Down Expand Up @@ -668,6 +682,8 @@ bool modest_finder_selector_sub_type_pseudo_class_first_of_type(modest_finder_t*

bool modest_finder_selector_sub_type_pseudo_class_focus(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if (base_node->token)
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "focus", 5);
return false;
}

Expand All @@ -678,6 +694,8 @@ bool modest_finder_selector_sub_type_pseudo_class_future(modest_finder_t* finder

bool modest_finder_selector_sub_type_pseudo_class_hover(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if (base_node->token)
return modest_finder_match_attribute_only_key(base_node->token->attr_first, "hover", 5);
return false;
}

Expand Down
5 changes: 4 additions & 1 deletion source/modest/finder/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,11 @@ bool modest_finder_thread_spec_is_up(modest_style_raw_specificity_t* spec_f, mod

if(spec_f->c > spec_t->c)
return true;
else if(spec_f->c < spec_t->c)
return false;

return false;
/* when a property is repeated with multiple values take the last one*/
return true;
}

void modest_finder_thread_declaratin_append(modest_finder_thread_found_context_t* found_context, bool is_low_priority,
Expand Down
Loading