Commit ae149e74 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

[Squad] Don't create PseudoElementData for setting a nullptr.

SetPseudoElement created a PseudoElementData even if the input was a
nullptr. Early out for null input to avoid unnecessary allocation.

Bug: 836126
Change-Id: If21c9ff8db2f20427b32f124ea0b129ebbebfe80
Reviewed-on: https://chromium-review.googlesource.com/1109962Reviewed-by: default avatarAnders Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569625}
parent ac8e8d3e
......@@ -241,8 +241,11 @@ inline void ElementRareData::ClearPseudoElements() {
inline void ElementRareData::SetPseudoElement(PseudoId pseudo_id,
PseudoElement* element) {
if (!pseudo_element_data_)
if (!pseudo_element_data_) {
if (!element)
return;
pseudo_element_data_ = PseudoElementData::Create();
}
pseudo_element_data_->SetPseudoElement(pseudo_id, element);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment