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

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

Issue 218663004: Changing between multicol and regular block shouldn't recreate all renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review Created 6 years, 8 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after
1857 } 1857 }
1858 } 1858 }
1859 } 1859 }
1860 } 1860 }
1861 } 1861 }
1862 1862
1863 parentBlockFlow->markAllDescendantsWithFloatsForLayout(); 1863 parentBlockFlow->markAllDescendantsWithFloatsForLayout();
1864 parentBlockFlow->markSiblingsWithFloatsForLayout(); 1864 parentBlockFlow->markSiblingsWithFloatsForLayout();
1865 } 1865 }
1866 1866
1867 createMultiColumnFlowThreadIfNeeded(); 1867 if (diff == StyleDifferenceLayout || !oldStyle)
1868 createOrDestroyMultiColumnFlowThreadIfNeeded();
1868 } 1869 }
1869 1870
1870 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop) 1871 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop)
1871 { 1872 {
1872 if (child->style()->isOriginalDisplayInlineType()) 1873 if (child->style()->isOriginalDisplayInlineType())
1873 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor Line(logicalTop, false)); 1874 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor Line(logicalTop, false));
1874 else 1875 else
1875 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent ()); 1876 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent ());
1876 } 1877 }
1877 1878
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 bool hasStrongDirectionality; 2772 bool hasStrongDirectionality;
2772 run.setDirection(directionForRun(run, hasStrongDirectionality)); 2773 run.setDirection(directionForRun(run, hasStrongDirectionality));
2773 return run; 2774 return run;
2774 } 2775 }
2775 2776
2776 RootInlineBox* RenderBlockFlow::createRootInlineBox() 2777 RootInlineBox* RenderBlockFlow::createRootInlineBox()
2777 { 2778 {
2778 return new RootInlineBox(*this); 2779 return new RootInlineBox(*this);
2779 } 2780 }
2780 2781
2781 void RenderBlockFlow::createMultiColumnFlowThreadIfNeeded() 2782 void RenderBlockFlow::createOrDestroyMultiColumnFlowThreadIfNeeded()
2782 { 2783 {
2783 if ((style()->hasAutoColumnCount() && style()->hasAutoColumnWidth()) || !doc ument().regionBasedColumnsEnabled()) 2784 if (!document().regionBasedColumnsEnabled())
2784 return; 2785 return;
2785 2786
2786 if (multiColumnFlowThread()) 2787 bool needsFlowThread = style()->specifiesColumns();
2787 return; 2788 if (needsFlowThread != static_cast<bool>(multiColumnFlowThread())) {
2788 2789 if (needsFlowThread) {
2789 setChildrenInline(false); 2790 RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowThrea d::createAnonymous(document(), style());
2790 RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowThread::creat eAnonymous(document(), style()); 2791 addChild(flowThread);
2791 RenderBlock::addChild(flowThread); 2792 flowThread->populate();
2792 RenderBlockFlowRareData& rareData = ensureRareData(); 2793 RenderBlockFlowRareData& rareData = ensureRareData();
2793 ASSERT(!rareData.m_multiColumnFlowThread); 2794 ASSERT(!rareData.m_multiColumnFlowThread);
2794 rareData.m_multiColumnFlowThread = flowThread; 2795 rareData.m_multiColumnFlowThread = flowThread;
2796 } else {
2797 multiColumnFlowThread()->evacuateAndDestroy();
2798 ASSERT(!multiColumnFlowThread());
2799 }
2800 }
2795 } 2801 }
2796 2802
2797 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2803 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2798 { 2804 {
2799 if (m_rareData) 2805 if (m_rareData)
2800 return *m_rareData; 2806 return *m_rareData;
2801 2807
2802 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2808 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2803 return *m_rareData; 2809 return *m_rareData;
2804 } 2810 }
2805 2811
2806 } // namespace WebCore 2812 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockFlow.h ('k') | Source/core/rendering/RenderMultiColumnFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698