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

Side by Side Diff: Source/core/rendering/RenderRegion.cpp

Issue 24350009: Reverse style resolution to avoid N^2 walk when building the render tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing loops in Regions Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 // FIXME: Region styling fails for pseudo-elements because the renderers don 't have a node. 544 // FIXME: Region styling fails for pseudo-elements because the renderers don 't have a node.
545 Element* element = toElement(object->node()); 545 Element* element = toElement(object->node());
546 RefPtr<RenderStyle> renderObjectRegionStyle = object->view()->document().sty leResolver()->styleForElement(element, 0, DisallowStyleSharing, MatchAllRules, t his); 546 RefPtr<RenderStyle> renderObjectRegionStyle = object->view()->document().sty leResolver()->styleForElement(element, 0, DisallowStyleSharing, MatchAllRules, t his);
547 547
548 return renderObjectRegionStyle.release(); 548 return renderObjectRegionStyle.release();
549 } 549 }
550 550
551 void RenderRegion::computeChildrenStyleInRegion(const RenderObject* object) 551 void RenderRegion::computeChildrenStyleInRegion(const RenderObject* object)
552 { 552 {
553 for (RenderObject* child = object->firstChild(); child; child = child->nextS ibling()) { 553 for (RenderObject* child = object->lastChild(); child; child = child->previo usSibling()) {
554 554
555 RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find (child); 555 RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find (child);
556 556
557 RefPtr<RenderStyle> childStyleInRegion; 557 RefPtr<RenderStyle> childStyleInRegion;
558 bool objectRegionStyleCached = false; 558 bool objectRegionStyleCached = false;
559 if (it != m_renderObjectRegionStyle.end()) { 559 if (it != m_renderObjectRegionStyle.end()) {
560 childStyleInRegion = it->value.style; 560 childStyleInRegion = it->value.style;
561 objectRegionStyleCached = true; 561 objectRegionStyleCached = true;
562 } else { 562 } else {
563 if (child->isAnonymous() || child->isInFlowRenderFlowThread()) 563 if (child->isAnonymous() || child->isInFlowRenderFlowThread())
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 styleInfo.cached = objectRegionStyleCached; 595 styleInfo.cached = objectRegionStyleCached;
596 m_renderObjectRegionStyle.set(object, styleInfo); 596 m_renderObjectRegionStyle.set(object, styleInfo);
597 } 597 }
598 598
599 void RenderRegion::clearObjectStyleInRegion(const RenderObject* object) 599 void RenderRegion::clearObjectStyleInRegion(const RenderObject* object)
600 { 600 {
601 ASSERT(object); 601 ASSERT(object);
602 m_renderObjectRegionStyle.remove(object); 602 m_renderObjectRegionStyle.remove(object);
603 603
604 // Clear the style for the children of this object. 604 // Clear the style for the children of this object.
605 for (RenderObject* child = object->firstChild(); child; child = child->nextS ibling()) 605 for (RenderObject* child = object->lastChild(); child; child = child->previo usSibling())
606 clearObjectStyleInRegion(child); 606 clearObjectStyleInRegion(child);
607 } 607 }
608 608
609 void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, La youtUnit& maxLogicalWidth) const 609 void RenderRegion::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, La youtUnit& maxLogicalWidth) const
610 { 610 {
611 if (!isValid()) { 611 if (!isValid()) {
612 RenderBlock::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth); 612 RenderBlock::computeIntrinsicLogicalWidths(minLogicalWidth, maxLogicalWi dth);
613 return; 613 return;
614 } 614 }
615 615
(...skipping 29 matching lines...) Expand all
645 645
646 LayoutUnit autoHeight = hasOverrideHeight() ? overrideLogicalContentHeight() : computedAutoHeight(); 646 LayoutUnit autoHeight = hasOverrideHeight() ? overrideLogicalContentHeight() : computedAutoHeight();
647 647
648 LayoutUnit newLogicalHeight = autoHeight + borderAndPaddingLogicalHeight(); 648 LayoutUnit newLogicalHeight = autoHeight + borderAndPaddingLogicalHeight();
649 ASSERT(newLogicalHeight < LayoutUnit::max() / 2); 649 ASSERT(newLogicalHeight < LayoutUnit::max() / 2);
650 if (newLogicalHeight > logicalHeight()) 650 if (newLogicalHeight > logicalHeight())
651 setLogicalHeight(newLogicalHeight); 651 setLogicalHeight(newLogicalHeight);
652 } 652 }
653 653
654 } // namespace WebCore 654 } // namespace WebCore
OLDNEW
« Source/core/dom/shadow/ShadowRoot.cpp ('K') | « Source/core/dom/shadow/ShadowRoot.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698