UpdateContainsEntireSelectionFlagForElements(old_selection, new_selection);Use below util functions to get old and new elements. If they are not same, set `SetContainsEntireSelection()`
Element* element_to_clear = nullptr;
if (!old_selection.IsNone()) {
Node* old_anchor = old_selection.Anchor().AnchorNode();
Node* old_focus = old_selection.Focus().AnchorNode();
if (old_anchor && old_focus &&
old_anchor->parentElement() == old_focus->parentElement()) {
element_to_clear = old_anchor->parentElement();
}
}Use an existing util function or create a new one to get `element` from selection.
if (element_to_clear) {
if (LayoutObject* layout_object = element_to_clear->GetLayoutObject()) {
if (layout_object->ContainsEntireSelection()) {
layout_object->SetContainsEntireSelection(false);
const ComputedStyle* style = element_to_clear->GetComputedStyle();
if (style && !style->TextOverflow().IsClip()) {
layout_object->SetNeedsLayout(
layout_invalidation_reason::kStyleChange);
}
}
}
}Move this to a function which takes above `element`, and the boolean flag to set
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |