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
Pseudo element build flow and box #1496
Closed
parkjaeman
wants to merge
8
commits into
servo:master
from
parkjaeman:pseudo-element-build-flow-and-box
+469
−12
Closed
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
66f325a
Create before_parent_node and before_node
parkjaeman 75aaa1d
Add some function for pseudo_node and reduce duplication in construct.rs
hyunjunekim 49dff11
Rebase PR
parkjaeman 21f58a2
Change after and before parent, child node to struct
sammykim c684327
Fix indent and unefficient code
sammykim 0d541f9
Remove duplicate get_pseudo_node and so on
parkjaeman 5e14445
Add initialize_layout_data without a channel
sammykim 684a2e0
Add debug message in MoseOver Event
sammykim File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Change after and before parent, child node to struct
- Loading branch information
commit 21f58a23263a00912864e9de5f498e5280e04365
| @@ -188,7 +188,46 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> { | ||
| self.node | ||
| } | ||
|
|
||
| fn get_pseudo_node(&self, pseudo_element: PseudoElement) -> Option<LayoutNode<'ln>> { | ||
| fn get_pseudo_node(&self, pseudo_type: PseudoElement) -> Option<LayoutNode<'ln>> { | ||
| if unsafe { self.get_abstract().is_text() } { | ||
| let layout_data_ref = self.borrow_layout_data(); | ||
| return layout_data_ref.get().as_ref().and_then(|ldw|{ | ||
| let pseudo_element = ldw.data.get_pseudo_element(pseudo_type); | ||
| pseudo_element.and_then(|pseudo_node|{ | ||
| if pseudo_node.parent.get_display() == display::inline { | ||
| unsafe{ | ||
jdm
Member
|
||
| Some(self.new_with_this_lifetime(pseudo_node.element.node)) | ||
| } | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| }); | ||
| } else if self.is_element() { | ||
| match self.first_child() { | ||
| Some(first_child) => { | ||
| let layout_data_ref = first_child.borrow_layout_data(); | ||
| return layout_data_ref.get().as_ref().and_then(|ldw|{ | ||
| let pseudo_element = ldw.data.get_pseudo_element(pseudo_type); | ||
| pseudo_element.and_then(|pseudo_node|{ | ||
| if pseudo_node.parent.get_display() == display::block { | ||
| unsafe{ | ||
|
||
| Some(self.new_with_this_lifetime(pseudo_node.parent.node)) | ||
| } | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| }); | ||
| } | ||
| None => { | ||
| return None | ||
| } | ||
| } | ||
| } else { | ||
| return None | ||
jdm
Member
|
||
| } | ||
| /* | ||
| macro_rules! get_pseudo_node( | ||
| ($pseudo_parent_node: ident, $pseudo_node: ident) => { | ||
| if unsafe { self.get_abstract().is_text() } { | ||
| @@ -240,6 +279,7 @@ impl<'ln> TLayoutNode for LayoutNode<'ln> { | ||
| } else { | ||
| return None | ||
| } | ||
| */ | ||
| } | ||
| } | ||
|
|
||
| @@ -523,7 +563,48 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> { | ||
| self.node | ||
| } | ||
|
|
||
| fn get_pseudo_node(&self, pseudo_element: PseudoElement) -> Option<ThreadSafeLayoutNode<'ln>> { | ||
| fn get_pseudo_node(&self, pseudo_type: PseudoElement) -> Option<ThreadSafeLayoutNode<'ln>> { | ||
|
|
||
| if unsafe { self.get_abstract().is_text() } { | ||
| let layout_data_ref = self.borrow_layout_data(); | ||
| return layout_data_ref.get().as_ref().and_then(|ldw|{ | ||
| let pseudo_element = ldw.data.get_pseudo_element(pseudo_type); | ||
| pseudo_element.and_then(|pseudo_node|{ | ||
| if pseudo_node.parent.get_display() == display::inline { | ||
| unsafe{ | ||
| Some(self.new_with_this_lifetime(pseudo_node.element.node)) | ||
| } | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| }); | ||
| } else if unsafe { self.get_abstract().is_element() } { | ||
| match self.first_child() { | ||
| Some(first_child) => { | ||
| let layout_data_ref = first_child.borrow_layout_data(); | ||
| return layout_data_ref.get().as_ref().and_then(|ldw|{ | ||
| let pseudo_element = ldw.data.get_pseudo_element(pseudo_type); | ||
| pseudo_element.and_then(|pseudo_node|{ | ||
| if pseudo_node.parent.get_display() == display::block { | ||
| unsafe{ | ||
| Some(self.new_with_this_lifetime(pseudo_node.parent.node)) | ||
| } | ||
| } else { | ||
| None | ||
| } | ||
| }) | ||
| }); | ||
| } | ||
| None => { | ||
| return None | ||
| } | ||
| } | ||
| } else { | ||
| return None | ||
| } | ||
|
|
||
| /* | ||
| macro_rules! get_pseudo_node( | ||
| ($pseudo_parent_node: ident, $pseudo_node: ident) => { | ||
| if unsafe { self.get_abstract().is_text() } { | ||
| @@ -574,7 +655,7 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> { | ||
| return get_pseudo_node!(after_parent_node, after_node) | ||
| } else { | ||
| return None | ||
| } | ||
| }*/ | ||
| } | ||
| } | ||
|
|
||
| @@ -710,10 +791,10 @@ impl<'ln> ThreadSafeLayoutNode<'ln> { | ||
| let p_ldw = p.borrow_layout_data(); | ||
| let p_ldw_ref = p_ldw.get().get_ref(); | ||
|
|
||
| if p_ldw_ref.data.before_style.is_some() && ldw_ref.data.before_node.is_none() { | ||
| if p_ldw_ref.data.before_style.is_some() && ldw_ref.data.before.is_none() { | ||
| pseudo_elements.push(Before); | ||
| } | ||
| if p_ldw_ref.data.after_style.is_some() && ldw_ref.data.after_node.is_none() { | ||
| if p_ldw_ref.data.after_style.is_some() && ldw_ref.data.after.is_none() { | ||
| pseudo_elements.push(After); | ||
| } | ||
|
|
||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Use a match here, perhaps?