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

Side by Side Diff: Source/core/layout/LayoutMultiColumnFlowThread.cpp

Issue 1320843005: Update outer flow thread membership before changing multicolness. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/LayoutMultiColumnFlowThread.h ('k') | Source/core/layout/LayoutObject.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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 // If an in-flow descendant goes out-of-flow, we may have to remove column s ets and spanner placeholders. 830 // If an in-flow descendant goes out-of-flow, we may have to remove column s ets and spanner placeholders.
831 return (newStyle.hasOutOfFlowPosition() && !oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle); 831 return (newStyle.hasOutOfFlowPosition() && !oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle);
832 } 832 }
833 833
834 static inline bool needsToInsertIntoFlowThread(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) 834 static inline bool needsToInsertIntoFlowThread(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle)
835 { 835 {
836 // If an out-of-flow descendant goes in-flow, we may have to insert column s ets and spanner placeholders. 836 // If an out-of-flow descendant goes in-flow, we may have to insert column s ets and spanner placeholders.
837 return (!newStyle.hasOutOfFlowPosition() && oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle); 837 return (!newStyle.hasOutOfFlowPosition() && oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle);
838 } 838 }
839 839
840 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutObje ct* descendant, StyleDifference diff, const ComputedStyle& newStyle) 840 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutBox* descendant, StyleDifference diff, const ComputedStyle& newStyle)
841 { 841 {
842 if (descendant->isText()) {
843 // Text nodes inherit all properties from the parent node (including non -inheritable
844 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the
845 // parent may be the multicol container, and having that accidentally le aked into children
846 // of the multicol is bad.
847 return;
848 }
849 if (needsToRemoveFromFlowThread(descendant->styleRef(), newStyle)) 842 if (needsToRemoveFromFlowThread(descendant->styleRef(), newStyle))
850 flowThreadDescendantWillBeRemoved(descendant); 843 flowThreadDescendantWillBeRemoved(descendant);
851 } 844 }
852 845
853 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutObjec t* descendant, StyleDifference diff, const ComputedStyle& oldStyle) 846 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutBox* descendant, StyleDifference diff, const ComputedStyle& oldStyle)
854 { 847 {
855 if (descendant->isText()) {
856 // Text nodes inherit all properties from the parent node (including non -inheritable
857 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the
858 // parent may be the multicol container, and having that accidentally le aked into children
859 // of the multicol is bad.
860 return;
861 }
862 if (needsToInsertIntoFlowThread(oldStyle, descendant->styleRef())) { 848 if (needsToInsertIntoFlowThread(oldStyle, descendant->styleRef())) {
863 flowThreadDescendantWasInserted(descendant); 849 flowThreadDescendantWasInserted(descendant);
864 return; 850 return;
865 } 851 }
866 if (descendantIsValidColumnSpanner(descendant)) { 852 if (descendantIsValidColumnSpanner(descendant)) {
867 // We went from being regular column content to becoming a spanner. 853 // We went from being regular column content to becoming a spanner.
868 ASSERT(!toLayoutBox(descendant)->spannerPlaceholder()); 854 ASSERT(!descendant->spannerPlaceholder());
869 855
870 // First remove this as regular column content. Note that this will walk the entire subtree 856 // First remove this as regular column content. Note that this will walk the entire subtree
871 // of |descendant|. There might be spanners there (which won't be spanne rs anymore, since 857 // of |descendant|. There might be spanners there (which won't be spanne rs anymore, since
872 // we're not allowed to nest spanners), whose placeholders must die. 858 // we're not allowed to nest spanners), whose placeholders must die.
873 flowThreadDescendantWillBeRemoved(descendant); 859 flowThreadDescendantWillBeRemoved(descendant);
874 860
875 createAndInsertSpannerPlaceholder(toLayoutBox(descendant), nextInPreOrde rAfterChildrenSkippingOutOfFlow(this, descendant)); 861 createAndInsertSpannerPlaceholder(descendant, nextInPreOrderAfterChildre nSkippingOutOfFlow(this, descendant));
876 } 862 }
877 } 863 }
878 864
879 void LayoutMultiColumnFlowThread::computePreferredLogicalWidths() 865 void LayoutMultiColumnFlowThread::computePreferredLogicalWidths()
880 { 866 {
881 LayoutFlowThread::computePreferredLogicalWidths(); 867 LayoutFlowThread::computePreferredLogicalWidths();
882 868
883 // The min/max intrinsic widths calculated really tell how much space elemen ts need when 869 // The min/max intrinsic widths calculated really tell how much space elemen ts need when
884 // laid out inside the columns. In order to eventually end up with the desir ed column width, 870 // laid out inside the columns. In order to eventually end up with the desir ed column width,
885 // we need to convert them to values pertaining to the multicol container. 871 // we need to convert them to values pertaining to the multicol container.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { 951 if (LayoutMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) {
966 multicolSet->addContentRun(offset); 952 multicolSet->addContentRun(offset);
967 if (offsetBreakAdjustment) 953 if (offsetBreakAdjustment)
968 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe mainingLogicalHeightForOffset(offset, AssociateWithFormerPage) : LayoutUnit(); 954 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe mainingLogicalHeightForOffset(offset, AssociateWithFormerPage) : LayoutUnit();
969 return true; 955 return true;
970 } 956 }
971 return false; 957 return false;
972 } 958 }
973 959
974 } 960 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutMultiColumnFlowThread.h ('k') | Source/core/layout/LayoutObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698