// Token: 0x06000318 RID: 792 RVA: 0x00008B80 File Offset: 0x00006D80
        private static void UpdateHasLoadedChangeHandlerFlagInAncestry(DependencyObject d, bool addHandler)
        {
            FrameworkObject frameworkObject = new FrameworkObject(d);

            if (!addHandler && BroadcastEventHelper.AreThereLoadedChangeHandlersInSubtree(ref frameworkObject))
            {
                return;
            }
            if (frameworkObject.IsValid)
            {
                if (frameworkObject.SubtreeHasLoadedChangeHandler != addHandler)
                {
                    DependencyObject dependencyObject  = frameworkObject.IsFE ? VisualTreeHelper.GetParent(frameworkObject.FE) : null;
                    DependencyObject parent            = frameworkObject.Parent;
                    DependencyObject dependencyObject2 = null;
                    frameworkObject.SubtreeHasLoadedChangeHandler = addHandler;
                    if (dependencyObject != null)
                    {
                        BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(dependencyObject, addHandler);
                        dependencyObject2 = dependencyObject;
                    }
                    if (parent != null && parent != dependencyObject)
                    {
                        BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(parent, addHandler);
                        if (frameworkObject.IsFCE)
                        {
                            dependencyObject2 = parent;
                        }
                    }
                    if (parent == null && dependencyObject == null)
                    {
                        dependencyObject2 = Helper.FindMentor(frameworkObject.DO.InheritanceContext);
                        if (dependencyObject2 != null)
                        {
                            frameworkObject.ChangeSubtreeHasLoadedChangedHandler(dependencyObject2);
                        }
                    }
                    if (addHandler)
                    {
                        if (frameworkObject.IsFE)
                        {
                            BroadcastEventHelper.UpdateIsLoadedCache(frameworkObject.FE, dependencyObject2);
                            return;
                        }
                        BroadcastEventHelper.UpdateIsLoadedCache(frameworkObject.FCE, dependencyObject2);
                        return;
                    }
                }
            }
            else
            {
                DependencyObject dependencyObject3 = null;
                Visual           reference;
                ContentElement   reference2;
                Visual3D         reference3;
                if ((reference = (d as Visual)) != null)
                {
                    dependencyObject3 = VisualTreeHelper.GetParent(reference);
                }
                else if ((reference2 = (d as ContentElement)) != null)
                {
                    dependencyObject3 = ContentOperations.GetParent(reference2);
                }
                else if ((reference3 = (d as Visual3D)) != null)
                {
                    dependencyObject3 = VisualTreeHelper.GetParent(reference3);
                }
                if (dependencyObject3 != null)
                {
                    BroadcastEventHelper.UpdateHasLoadedChangeHandlerFlagInAncestry(dependencyObject3, addHandler);
                }
            }
        }