Rewild Your Web
web browser dweb
at main 36 lines 1.2 kB view raw
1--- original 2+++ modified 3@@ -68,6 +68,9 @@ 4 if name == "viewport" { 5 self.parse_and_send_viewport_if_necessary(); 6 } 7+ if name == "theme-color" { 8+ self.parse_and_send_theme_color(); 9+ } 10 // https://html.spec.whatwg.org/multipage/#attr-meta-http-equiv 11 } else if !self.HttpEquiv().is_empty() { 12 // TODO: Implement additional http-equiv candidates 13@@ -91,6 +94,23 @@ 14 } 15 } 16 17+ fn parse_and_send_theme_color(&self) { 18+ let window = self.owner_window(); 19+ if !window.is_top_level() { 20+ return; 21+ } 22+ 23+ if let Some(content) = self 24+ .upcast::<Element>() 25+ .get_attribute(&ns!(), &local_name!("content")) 26+ .filter(|attr| !attr.value().is_empty()) 27+ { 28+ // Store the theme color on the document, which will notify the parent 29+ self.owner_document() 30+ .set_theme_color(content.value().to_string()); 31+ } 32+ } 33+ 34 /// <https://html.spec.whatwg.org/multipage/#meta-referrer> 35 fn apply_referrer(&self) { 36 let doc = self.owner_document();