DevTools: Replace camel case variable names (#32726)

* refactor: rename to snake case

* refactor: more renaming

* chore: format

* chore: clean
This commit is contained in:
eri 2024-07-08 13:18:35 +02:00 committed by GitHub
parent b243457ccc
commit 2888193cfe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 363 additions and 323 deletions

View file

@ -160,21 +160,21 @@ pub fn handle_get_layout(
.send(Some(ComputedNodeLayout {
display: String::from(computed_style.Display()),
position: String::from(computed_style.Position()),
zIndex: String::from(computed_style.ZIndex()),
boxSizing: String::from(computed_style.BoxSizing()),
autoMargins: determine_auto_margins(&node),
marginTop: String::from(computed_style.MarginTop()),
marginRight: String::from(computed_style.MarginRight()),
marginBottom: String::from(computed_style.MarginBottom()),
marginLeft: String::from(computed_style.MarginLeft()),
borderTopWidth: String::from(computed_style.BorderTopWidth()),
borderRightWidth: String::from(computed_style.BorderRightWidth()),
borderBottomWidth: String::from(computed_style.BorderBottomWidth()),
borderLeftWidth: String::from(computed_style.BorderLeftWidth()),
paddingTop: String::from(computed_style.PaddingTop()),
paddingRight: String::from(computed_style.PaddingRight()),
paddingBottom: String::from(computed_style.PaddingBottom()),
paddingLeft: String::from(computed_style.PaddingLeft()),
z_index: String::from(computed_style.ZIndex()),
box_sizing: String::from(computed_style.BoxSizing()),
auto_margins: determine_auto_margins(&node),
margin_top: String::from(computed_style.MarginTop()),
margin_right: String::from(computed_style.MarginRight()),
margin_bottom: String::from(computed_style.MarginBottom()),
margin_left: String::from(computed_style.MarginLeft()),
border_top_width: String::from(computed_style.BorderTopWidth()),
border_right_width: String::from(computed_style.BorderRightWidth()),
border_bottom_width: String::from(computed_style.BorderBottomWidth()),
border_left_width: String::from(computed_style.BorderLeftWidth()),
padding_top: String::from(computed_style.PaddingTop()),
padding_right: String::from(computed_style.PaddingRight()),
padding_bottom: String::from(computed_style.PaddingBottom()),
padding_left: String::from(computed_style.PaddingLeft()),
width,
height,
}))
@ -213,14 +213,14 @@ pub fn handle_modify_attribute(
.expect("should be getting layout of element");
for modification in modifications {
match modification.newValue {
match modification.new_value {
Some(string) => {
let _ = elem.SetAttribute(
DOMString::from(modification.attributeName),
DOMString::from(modification.attribute_name),
DOMString::from(string),
);
},
None => elem.RemoveAttribute(DOMString::from(modification.attributeName)),
None => elem.RemoveAttribute(DOMString::from(modification.attribute_name)),
}
}
}

View file

@ -37,10 +37,10 @@ impl Console {
unsafe { describe_scripted_caller(*GlobalScope::get_cx()) }.unwrap_or_default();
let console_message = ConsoleMessage {
message,
logLevel: level,
log_level: level,
filename: caller.filename,
lineNumber: caller.line as usize,
columnNumber: caller.col as usize,
line_number: caller.line as usize,
column_number: caller.col as usize,
};
let worker_id = global
.downcast::<WorkerGlobalScope>()

View file

@ -2299,13 +2299,13 @@ impl GlobalScope {
self.pipeline_id,
PageError {
type_: "PageError".to_string(),
errorMessage: warning.to_string(),
sourceName: self.get_url().to_string(),
lineText: "".to_string(),
lineNumber: 0,
columnNumber: 0,
error_message: warning.to_string(),
source_name: self.get_url().to_string(),
line_text: "".to_string(),
line_number: 0,
column_number: 0,
category: "script".to_string(),
timeStamp: 0, //TODO
time_stamp: 0, //TODO
error: false,
warning: true,
exception: true,
@ -2487,13 +2487,13 @@ impl GlobalScope {
self.pipeline_id,
PageError {
type_: "PageError".to_string(),
errorMessage: error_info.message.clone(),
sourceName: error_info.filename.clone(),
lineText: "".to_string(), //TODO
lineNumber: error_info.lineno,
columnNumber: error_info.column,
error_message: error_info.message.clone(),
source_name: error_info.filename.clone(),
line_text: "".to_string(), //TODO
line_number: error_info.lineno,
column_number: error_info.column,
category: "script".to_string(),
timeStamp: 0, //TODO
time_stamp: 0, //TODO
error: true,
warning: false,
exception: true,

View file

@ -1114,29 +1114,29 @@ impl Node {
pub fn summarize(&self) -> NodeInfo {
let USVString(base_uri) = self.BaseURI();
NodeInfo {
uniqueId: self.unique_id(),
baseURI: base_uri,
unique_id: self.unique_id(),
base_uri,
parent: self
.GetParentNode()
.map_or("".to_owned(), |node| node.unique_id()),
nodeType: self.NodeType(),
namespaceURI: String::new(), //FIXME
nodeName: String::from(self.NodeName()),
numChildren: self.ChildNodes().Length() as usize,
node_type: self.NodeType(),
namespace_uri: String::new(), //FIXME
node_name: String::from(self.NodeName()),
num_children: self.ChildNodes().Length() as usize,
//FIXME doctype nodes only
name: String::new(),
publicId: String::new(),
systemId: String::new(),
public_id: String::new(),
system_id: String::new(),
attrs: self.downcast().map(Element::summarize).unwrap_or(vec![]),
isDocumentElement: self
is_document_element: self
.owner_doc()
.GetDocumentElement()
.map_or(false, |elem| elem.upcast::<Node>() == self),
shortValue: self.GetNodeValue().map(String::from).unwrap_or_default(), //FIXME: truncate
incompleteValue: false, //FIXME: reflect truncation
short_value: self.GetNodeValue().map(String::from).unwrap_or_default(), //FIXME: truncate
incomplete_value: false, //FIXME: reflect truncation
}
}