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

Side by Side Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2439973005: Revert of Move Layout Tree Construction code into Element::rebuildLayoutTree() (Closed)
Patch Set: Revert "Move Layout Tree Construction code into Element::rebuildLayoutTree()" Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 while (node->parentNode()) 383 while (node->parentNode())
384 node = node->parentNode(); 384 node = node->parentNode();
385 return const_cast<Node&>(*node); 385 return const_cast<Node&>(*node);
386 } 386 }
387 387
388 Node* Node::getRootNode(const GetRootNodeOptions& options) const { 388 Node* Node::getRootNode(const GetRootNodeOptions& options) const {
389 return (options.hasComposed() && options.composed()) ? &shadowIncludingRoot() 389 return (options.hasComposed() && options.composed()) ? &shadowIncludingRoot()
390 : &treeRoot(); 390 : &treeRoot();
391 } 391 }
392 392
393 Text* Node::nextTextSibling() const {
394 for (Node* sibling = nextSibling();
395 sibling &&
396 (!sibling->isElementNode() || !toElement(sibling)->layoutObject());
397 sibling = sibling->nextSibling()) {
398 if (sibling->isTextNode()) {
399 return toText(sibling);
400 }
401 }
402 return nullptr;
403 }
404
405 Node* Node::insertBefore(Node* newChild, 393 Node* Node::insertBefore(Node* newChild,
406 Node* refChild, 394 Node* refChild,
407 ExceptionState& exceptionState) { 395 ExceptionState& exceptionState) {
408 if (isContainerNode()) 396 if (isContainerNode())
409 return toContainerNode(this)->insertBefore(newChild, refChild, 397 return toContainerNode(this)->insertBefore(newChild, refChild,
410 exceptionState); 398 exceptionState);
411 399
412 exceptionState.throwDOMException( 400 exceptionState.throwDOMException(
413 HierarchyRequestError, "This node type does not support this method."); 401 HierarchyRequestError, "This node type does not support this method.");
414 return nullptr; 402 return nullptr;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 690 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
703 } 691 }
704 692
705 void Node::markAncestorsWithChildNeedsStyleRecalc() { 693 void Node::markAncestorsWithChildNeedsStyleRecalc() {
706 for (ContainerNode* p = parentOrShadowHostNode(); 694 for (ContainerNode* p = parentOrShadowHostNode();
707 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode()) 695 p && !p->childNeedsStyleRecalc(); p = p->parentOrShadowHostNode())
708 p->setChildNeedsStyleRecalc(); 696 p->setChildNeedsStyleRecalc();
709 document().scheduleLayoutTreeUpdateIfNeeded(); 697 document().scheduleLayoutTreeUpdateIfNeeded();
710 } 698 }
711 699
712 void Node::markAncestorsWithChildNeedsReattachLayoutTree() {
713 for (ContainerNode* p = parentOrShadowHostNode();
714 p && !p->childNeedsReattachLayoutTree(); p = p->parentOrShadowHostNode())
715 p->setChildNeedsReattachLayoutTree();
716 }
717
718 void Node::setNeedsReattachLayoutTree() {
719 setFlag(NeedsReattachLayoutTree);
720 markAncestorsWithChildNeedsReattachLayoutTree();
721 }
722
723 void Node::setNeedsStyleRecalc(StyleChangeType changeType, 700 void Node::setNeedsStyleRecalc(StyleChangeType changeType,
724 const StyleChangeReasonForTracing& reason) { 701 const StyleChangeReasonForTracing& reason) {
725 DCHECK(changeType != NoStyleChange); 702 DCHECK(changeType != NoStyleChange);
726 if (!inActiveDocument()) 703 if (!inActiveDocument())
727 return; 704 return;
728 705
729 TRACE_EVENT_INSTANT1( 706 TRACE_EVENT_INSTANT1(
730 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"), 707 TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"),
731 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data", 708 "StyleRecalcInvalidationTracking", TRACE_EVENT_SCOPE_THREAD, "data",
732 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason)); 709 InspectorStyleRecalcInvalidationTrackingEvent::data(this, reason));
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 881
905 void Node::attachLayoutTree(const AttachContext&) { 882 void Node::attachLayoutTree(const AttachContext&) {
906 DCHECK(document().inStyleRecalc() || isDocumentNode()); 883 DCHECK(document().inStyleRecalc() || isDocumentNode());
907 DCHECK(!document().lifecycle().inDetach()); 884 DCHECK(!document().lifecycle().inDetach());
908 DCHECK(needsAttach()); 885 DCHECK(needsAttach());
909 DCHECK(!layoutObject() || 886 DCHECK(!layoutObject() ||
910 (layoutObject()->style() && 887 (layoutObject()->style() &&
911 (layoutObject()->parent() || layoutObject()->isLayoutView()))); 888 (layoutObject()->parent() || layoutObject()->isLayoutView())));
912 889
913 clearNeedsStyleRecalc(); 890 clearNeedsStyleRecalc();
914 clearNeedsReattachLayoutTree();
915 891
916 if (AXObjectCache* cache = document().axObjectCache()) 892 if (AXObjectCache* cache = document().axObjectCache())
917 cache->updateCacheAfterNodeIsAttached(this); 893 cache->updateCacheAfterNodeIsAttached(this);
918 } 894 }
919 895
920 void Node::detachLayoutTree(const AttachContext& context) { 896 void Node::detachLayoutTree(const AttachContext& context) {
921 DCHECK(document().lifecycle().stateAllowsDetach()); 897 DCHECK(document().lifecycle().stateAllowsDetach());
922 DocumentLifecycle::DetachScope willDetach(document().lifecycle()); 898 DocumentLifecycle::DetachScope willDetach(document().lifecycle());
923 899
924 if (layoutObject()) 900 if (layoutObject())
(...skipping 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after
2492 if (node) { 2468 if (node) {
2493 std::stringstream stream; 2469 std::stringstream stream;
2494 node->printNodePathTo(stream); 2470 node->printNodePathTo(stream);
2495 LOG(INFO) << stream.str(); 2471 LOG(INFO) << stream.str();
2496 } else { 2472 } else {
2497 LOG(INFO) << "Cannot showNodePath for <null>"; 2473 LOG(INFO) << "Cannot showNodePath for <null>";
2498 } 2474 }
2499 } 2475 }
2500 2476
2501 #endif 2477 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | third_party/WebKit/Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698