OLD | NEW |
---|---|
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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 // If there were no adjacent spanners, it has to mean that there's only one column set, | 747 // If there were no adjacent spanners, it has to mean that there's only one column set, |
748 // since it's only spanners that may cause creation of multiple sets. | 748 // since it's only spanners that may cause creation of multiple sets. |
749 columnSetToRemove = firstMultiColumnSet(); | 749 columnSetToRemove = firstMultiColumnSet(); |
750 ASSERT(columnSetToRemove); | 750 ASSERT(columnSetToRemove); |
751 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet()); | 751 ASSERT(!columnSetToRemove->nextSiblingMultiColumnSet()); |
752 } | 752 } |
753 ASSERT(columnSetToRemove); | 753 ASSERT(columnSetToRemove); |
754 columnSetToRemove->destroy(); | 754 columnSetToRemove->destroy(); |
755 } | 755 } |
756 | 756 |
757 static inline bool needsToReinsertIntoFlowThread(const ComputedStyle& oldStyle, const ComputedStyle& newStyle) | |
758 { | |
759 // If we've become (or are about to become) a container for absolutely posit ioned descendants, | |
leviw_travelin_and_unemployed
2015/07/14 19:43:42
This comment seems to imply we only care if we're
mstensho (USE GERRIT)
2015/07/14 19:49:25
Done.
The code was right, the comment was inaccur
| |
760 // we need to re-evaluate the need for column sets. There may be out-of-flow descendants | |
761 // further down that become part of the flow thread, or cease to be part of the flow thread, | |
762 // because of this change. | |
763 if (oldStyle.hasTransformRelatedProperty() != newStyle.hasTransformRelatedPr operty()) | |
764 return true; | |
765 return (oldStyle.hasInFlowPosition() && newStyle.position() == StaticPositio n) | |
766 || (newStyle.hasInFlowPosition() && oldStyle.position() == StaticPositio n); | |
767 } | |
768 | |
769 static inline bool needsToRemoveFromFlowThread(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) | |
770 { | |
771 // If an in-flow descendant goes out-of-flow, we may have to remove column s ets and spanner placeholders. | |
772 return (newStyle.hasOutOfFlowPosition() && !oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle); | |
773 } | |
774 | |
775 static inline bool needsToInsertIntoFlowThread(const ComputedStyle& oldStyle, co nst ComputedStyle& newStyle) | |
776 { | |
777 // If an out-of-flow descendant goes in-flow, we may have to insert column s ets and spanner placeholders. | |
778 return (!newStyle.hasOutOfFlowPosition() && oldStyle.hasOutOfFlowPosition()) || needsToReinsertIntoFlowThread(oldStyle, newStyle); | |
779 } | |
780 | |
757 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutObje ct* descendant, StyleDifference diff, const ComputedStyle& newStyle) | 781 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleWillChange(LayoutObje ct* descendant, StyleDifference diff, const ComputedStyle& newStyle) |
758 { | 782 { |
759 // If an in-flow descendant goes out-of-flow, we may have to remove a column set. | |
760 if (descendant->isText()) { | 783 if (descendant->isText()) { |
761 // Text nodes inherit all properties from the parent node (including non -inheritable | 784 // Text nodes inherit all properties from the parent node (including non -inheritable |
762 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the | 785 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the |
763 // parent may be the multicol container, and having that accidentally le aked into children | 786 // parent may be the multicol container, and having that accidentally le aked into children |
764 // of the multicol is bad. | 787 // of the multicol is bad. |
765 return; | 788 return; |
766 } | 789 } |
767 if (newStyle.hasOutOfFlowPosition() && !styleRef().hasOutOfFlowPosition()) | 790 if (needsToRemoveFromFlowThread(descendant->styleRef(), newStyle)) |
768 flowThreadDescendantWillBeRemoved(descendant); | 791 flowThreadDescendantWillBeRemoved(descendant); |
769 } | 792 } |
770 | 793 |
771 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutObjec t* descendant, StyleDifference diff, const ComputedStyle& oldStyle) | 794 void LayoutMultiColumnFlowThread::flowThreadDescendantStyleDidChange(LayoutObjec t* descendant, StyleDifference diff, const ComputedStyle& oldStyle) |
772 { | 795 { |
773 // If an out-of-flow descendant goes in-flow, we may have to insert a column set. | |
774 if (descendant->isText()) { | 796 if (descendant->isText()) { |
775 // Text nodes inherit all properties from the parent node (including non -inheritable | 797 // Text nodes inherit all properties from the parent node (including non -inheritable |
776 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the | 798 // ones). We don't care what its 'position' is. In fact, we _must_ ignor e it, since the |
777 // parent may be the multicol container, and having that accidentally le aked into children | 799 // parent may be the multicol container, and having that accidentally le aked into children |
778 // of the multicol is bad. | 800 // of the multicol is bad. |
779 return; | 801 return; |
780 } | 802 } |
781 if (styleRef().hasOutOfFlowPosition()) | 803 if (needsToInsertIntoFlowThread(oldStyle, descendant->styleRef())) { |
782 return; | |
783 | |
784 // We're not out of flow. | |
785 if (oldStyle.hasOutOfFlowPosition()) { | |
786 // ... but we used to be out of flow. So we might need to insert a colum n set (or | |
787 // spanner placeholder, in case this descendant is now a valid column sp anner). | |
788 flowThreadDescendantWasInserted(descendant); | 804 flowThreadDescendantWasInserted(descendant); |
789 return; | 805 return; |
790 } | 806 } |
791 if (descendantIsValidColumnSpanner(descendant)) { | 807 if (descendantIsValidColumnSpanner(descendant)) { |
792 // We went from being regular column content to becoming a spanner. | 808 // We went from being regular column content to becoming a spanner. |
793 ASSERT(!toLayoutBox(descendant)->spannerPlaceholder()); | 809 ASSERT(!toLayoutBox(descendant)->spannerPlaceholder()); |
794 | 810 |
795 // First remove this as regular column content. Note that this will walk the entire subtree | 811 // First remove this as regular column content. Note that this will walk the entire subtree |
796 // of |descendant|. There might be spanners there (which won't be spanne rs anymore, since | 812 // of |descendant|. There might be spanners there (which won't be spanne rs anymore, since |
797 // we're not allowed to nest spanners), whose placeholders must die. | 813 // we're not allowed to nest spanners), whose placeholders must die. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
889 } | 905 } |
890 | 906 |
891 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const | 907 bool LayoutMultiColumnFlowThread::isPageLogicalHeightKnown() const |
892 { | 908 { |
893 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) | 909 if (LayoutMultiColumnSet* columnSet = lastMultiColumnSet()) |
894 return columnSet->pageLogicalHeight(); | 910 return columnSet->pageLogicalHeight(); |
895 return false; | 911 return false; |
896 } | 912 } |
897 | 913 |
898 } | 914 } |
OLD | NEW |