| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/rendering/RenderParagraph.h" | 6 #include "sky/engine/core/rendering/RenderParagraph.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/rendering/BidiRunForLine.h" | 8 #include "sky/engine/core/rendering/BidiRunForLine.h" |
| 9 #include "sky/engine/core/rendering/InlineIterator.h" | 9 #include "sky/engine/core/rendering/InlineIterator.h" |
| 10 #include "sky/engine/core/rendering/RenderLayer.h" | 10 #include "sky/engine/core/rendering/RenderLayer.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 determineEndPosition(layoutState, startLine, cleanLineStart, cleanLineBi
diStatus); | 728 determineEndPosition(layoutState, startLine, cleanLineStart, cleanLineBi
diStatus); |
| 729 | 729 |
| 730 if (startLine) { | 730 if (startLine) { |
| 731 if (!layoutState.usesPaintInvalidationBounds()) | 731 if (!layoutState.usesPaintInvalidationBounds()) |
| 732 layoutState.setPaintInvalidationRange(logicalHeight()); | 732 layoutState.setPaintInvalidationRange(logicalHeight()); |
| 733 deleteLineRange(layoutState, startLine); | 733 deleteLineRange(layoutState, startLine); |
| 734 } | 734 } |
| 735 | 735 |
| 736 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB
idiStatus); | 736 layoutRunsAndFloatsInRange(layoutState, resolver, cleanLineStart, cleanLineB
idiStatus); |
| 737 linkToEndLineIfNeeded(layoutState); | 737 linkToEndLineIfNeeded(layoutState); |
| 738 markDirtyFloatsForPaintInvalidation(layoutState.floats()); | |
| 739 } | 738 } |
| 740 | 739 |
| 741 void RenderParagraph::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, | 740 void RenderParagraph::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, |
| 742 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, | 741 InlineBidiResolver& resolver, const InlineIterator& cleanLineStart, |
| 743 const BidiStatus& cleanLineBidiStatus) | 742 const BidiStatus& cleanLineBidiStatus) |
| 744 { | 743 { |
| 745 RenderStyle* styleToUse = style(); | 744 RenderStyle* styleToUse = style(); |
| 746 LineMidpointState& lineMidpointState = resolver.midpointState(); | 745 LineMidpointState& lineMidpointState = resolver.midpointState(); |
| 747 InlineIterator endOfLine = resolver.position(); | 746 InlineIterator endOfLine = resolver.position(); |
| 748 bool checkForEndLineMatch = layoutState.endLine(); | 747 bool checkForEndLineMatch = layoutState.endLine(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 } | 845 } |
| 847 } | 846 } |
| 848 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); | 847 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); |
| 849 } else { | 848 } else { |
| 850 // Delete all the remaining lines. | 849 // Delete all the remaining lines. |
| 851 deleteLineRange(layoutState, layoutState.endLine()); | 850 deleteLineRange(layoutState, layoutState.endLine()); |
| 852 } | 851 } |
| 853 } | 852 } |
| 854 } | 853 } |
| 855 | 854 |
| 856 void RenderParagraph::markDirtyFloatsForPaintInvalidation(Vector<FloatWithRect>&
floats) | |
| 857 { | |
| 858 size_t floatCount = floats.size(); | |
| 859 // Floats that did not have layout did not paint invalidations when we laid
them out. They would have | |
| 860 // painted by now if they had moved, but if they stayed at (0, 0), they stil
l need to be | |
| 861 // painted. | |
| 862 for (size_t i = 0; i < floatCount; ++i) { | |
| 863 if (!floats[i].everHadLayout) { | |
| 864 RenderBox* f = floats[i].object; | |
| 865 if (!f->x() && !f->y() && f->checkForPaintInvalidation()) { | |
| 866 f->setShouldDoFullPaintInvalidation(true); | |
| 867 } | |
| 868 } | |
| 869 } | |
| 870 } | |
| 871 | |
| 872 struct InlineMinMaxIterator { | 855 struct InlineMinMaxIterator { |
| 873 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to | 856 /* InlineMinMaxIterator is a class that will iterate over all render objects tha
t contribute to |
| 874 inline min/max width calculations. Note the following about the way it walks
: | 857 inline min/max width calculations. Note the following about the way it walks
: |
| 875 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) | 858 (1) Positioned content is skipped (since it does not contribute to min/max wi
dth of a block) |
| 876 (2) We do not drill into the children of floats or replaced elements, since y
ou can't break | 859 (2) We do not drill into the children of floats or replaced elements, since y
ou can't break |
| 877 in the middle of such an element. | 860 in the middle of such an element. |
| 878 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c
an have | 861 (3) Inline flows (e.g., <a>, <span>, <i>) are walked twice, since each side c
an have |
| 879 distinct borders/margin/padding that contribute to the min/max width. | 862 distinct borders/margin/padding that contribute to the min/max width. |
| 880 */ | 863 */ |
| 881 RenderObject* parent; | 864 RenderObject* parent; |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 curr->adjustLogicalPosition(logicalLeft, 0); | 1591 curr->adjustLogicalPosition(logicalLeft, 0); |
| 1609 else | 1592 else |
| 1610 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); | 1593 curr->adjustLogicalPosition(logicalLeft - (availableLogicalW
idth - totalLogicalWidth), 0); |
| 1611 } | 1594 } |
| 1612 } | 1595 } |
| 1613 firstLine = false; | 1596 firstLine = false; |
| 1614 } | 1597 } |
| 1615 } | 1598 } |
| 1616 | 1599 |
| 1617 } // namespace blink | 1600 } // namespace blink |
| OLD | NEW |