Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: Source/core/html/HTMLElement.cpp

Issue 547823002: Track reasons for |Node::SetNeedsStyleRecalc| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 void HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged(Element * child) 743 void HTMLElement::adjustDirectionalityIfNeededAfterChildAttributeChanged(Element * child)
744 { 744 {
745 ASSERT(selfOrAncestorHasDirAutoAttribute()); 745 ASSERT(selfOrAncestorHasDirAutoAttribute());
746 Node* strongDirectionalityTextNode; 746 Node* strongDirectionalityTextNode;
747 TextDirection textDirection = directionality(&strongDirectionalityTextNode); 747 TextDirection textDirection = directionality(&strongDirectionalityTextNode);
748 setHasDirAutoFlagRecursively(child, false); 748 setHasDirAutoFlagRecursively(child, false);
749 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) { 749 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) {
750 Element* elementToAdjust = this; 750 Element* elementToAdjust = this;
751 for (; elementToAdjust; elementToAdjust = elementToAdjust->parentElement ()) { 751 for (; elementToAdjust; elementToAdjust = elementToAdjust->parentElement ()) {
752 if (elementAffectsDirectionality(elementToAdjust)) { 752 if (elementAffectsDirectionality(elementToAdjust)) {
753 elementToAdjust->setNeedsStyleRecalc(SubtreeStyleChange); 753 elementToAdjust->setNeedsStyleRecalc(StyleRecalcDueToWritingMode Change, SubtreeStyleChange);
754 return; 754 return;
755 } 755 }
756 } 756 }
757 } 757 }
758 } 758 }
759 759
760 void HTMLElement::calculateAndAdjustDirectionality() 760 void HTMLElement::calculateAndAdjustDirectionality()
761 { 761 {
762 Node* strongDirectionalityTextNode; 762 Node* strongDirectionalityTextNode;
763 TextDirection textDirection = directionality(&strongDirectionalityTextNode); 763 TextDirection textDirection = directionality(&strongDirectionalityTextNode);
764 setHasDirAutoFlagRecursively(this, hasDirectionAuto(), strongDirectionalityT extNode); 764 setHasDirAutoFlagRecursively(this, hasDirectionAuto(), strongDirectionalityT extNode);
765 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 765 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
766 setHasDirAutoFlagRecursively(root, hasDirectionAuto()); 766 setHasDirAutoFlagRecursively(root, hasDirectionAuto());
767 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection) 767 if (renderer() && renderer()->style() && renderer()->style()->direction() != textDirection)
768 setNeedsStyleRecalc(SubtreeStyleChange); 768 setNeedsStyleRecalc(StyleRecalcDueToWritingModeChange, SubtreeStyleChang e);
769 } 769 }
770 770
771 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(const Childre nChange& change) 771 void HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged(const Childre nChange& change)
772 { 772 {
773 if (!selfOrAncestorHasDirAutoAttribute()) 773 if (!selfOrAncestorHasDirAutoAttribute())
774 return; 774 return;
775 775
776 Node* oldMarkedNode = change.siblingBeforeChange ? NodeTraversal::nextSkippi ngChildren(*change.siblingBeforeChange) : 0; 776 Node* oldMarkedNode = change.siblingBeforeChange ? NodeTraversal::nextSkippi ngChildren(*change.siblingBeforeChange) : 0;
777 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode)) 777 while (oldMarkedNode && elementAffectsDirectionality(oldMarkedNode))
778 oldMarkedNode = NodeTraversal::nextSkippingChildren(*oldMarkedNode, this ); 778 oldMarkedNode = NodeTraversal::nextSkippingChildren(*oldMarkedNode, this );
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 #ifndef NDEBUG 995 #ifndef NDEBUG
996 996
997 // For use in the debugger 997 // For use in the debugger
998 void dumpInnerHTML(blink::HTMLElement*); 998 void dumpInnerHTML(blink::HTMLElement*);
999 999
1000 void dumpInnerHTML(blink::HTMLElement* element) 1000 void dumpInnerHTML(blink::HTMLElement* element)
1001 { 1001 {
1002 printf("%s\n", element->innerHTML().ascii().data()); 1002 printf("%s\n", element->innerHTML().ascii().data());
1003 } 1003 }
1004 #endif 1004 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698