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

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: Actually test switching between multicol and non-multicol using the new implementation as well. 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) && document().regionBasedCo lumnsEnabled()) {
eseidel 2014/04/09 17:57:51 It may read nicer as a helper. I'm not sure the be
mstensho (USE GERRIT) 2014/04/09 18:58:27 Done.
1868 bool needsFlowThread = style()->specifiesColumns();
1869 if (!needsFlowThread != !multiColumnFlowThread()) {
esprehn 2014/04/09 18:19:08 Please don't do this double negation with the ! on
mstensho (USE GERRIT) 2014/04/09 18:58:27 Done.
1870 if (needsFlowThread) {
1871 RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowT hread::createAnonymous(document(), style());
1872 addChild(flowThread);
1873 flowThread->populate();
1874 RenderBlockFlowRareData& rareData = ensureRareData();
1875 ASSERT(!rareData.m_multiColumnFlowThread);
1876 rareData.m_multiColumnFlowThread = flowThread;
esprehn 2014/04/09 18:19:08 Can all of this live in a method instead of here?
mstensho (USE GERRIT) 2014/04/09 18:58:27 Done.
1877 } else {
1878 multiColumnFlowThread()->evacuateAndDestroy();
eseidel 2014/04/09 17:57:51 Is it typical for renderers to move their children
esprehn 2014/04/09 18:19:08 I don't think we normally do this, instead we usua
mstensho (USE GERRIT) 2014/04/09 18:58:27 No, I think this is pretty special. The renderer o
1879 ASSERT(!multiColumnFlowThread());
1880 }
1881 }
1882 }
1868 } 1883 }
1869 1884
1870 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop) 1885 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop)
1871 { 1886 {
1872 if (child->style()->isOriginalDisplayInlineType()) 1887 if (child->style()->isOriginalDisplayInlineType())
1873 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor Line(logicalTop, false)); 1888 setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetFor Line(logicalTop, false));
1874 else 1889 else
1875 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent ()); 1890 setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent ());
1876 } 1891 }
1877 1892
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 bool hasStrongDirectionality; 2786 bool hasStrongDirectionality;
2772 run.setDirection(directionForRun(run, hasStrongDirectionality)); 2787 run.setDirection(directionForRun(run, hasStrongDirectionality));
2773 return run; 2788 return run;
2774 } 2789 }
2775 2790
2776 RootInlineBox* RenderBlockFlow::createRootInlineBox() 2791 RootInlineBox* RenderBlockFlow::createRootInlineBox()
2777 { 2792 {
2778 return new RootInlineBox(*this); 2793 return new RootInlineBox(*this);
2779 } 2794 }
2780 2795
2781 void RenderBlockFlow::createMultiColumnFlowThreadIfNeeded()
2782 {
2783 if ((style()->hasAutoColumnCount() && style()->hasAutoColumnWidth()) || !doc ument().regionBasedColumnsEnabled())
2784 return;
2785
2786 if (multiColumnFlowThread())
2787 return;
2788
2789 setChildrenInline(false);
2790 RenderMultiColumnFlowThread* flowThread = RenderMultiColumnFlowThread::creat eAnonymous(document(), style());
2791 RenderBlock::addChild(flowThread);
2792 RenderBlockFlowRareData& rareData = ensureRareData();
2793 ASSERT(!rareData.m_multiColumnFlowThread);
2794 rareData.m_multiColumnFlowThread = flowThread;
2795 }
2796
2797 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() 2796 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData()
2798 { 2797 {
2799 if (m_rareData) 2798 if (m_rareData)
2800 return *m_rareData; 2799 return *m_rareData;
2801 2800
2802 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); 2801 m_rareData = adoptPtr(new RenderBlockFlowRareData(this));
2803 return *m_rareData; 2802 return *m_rareData;
2804 } 2803 }
2805 2804
2806 } // namespace WebCore 2805 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698