Changeset 161278 in webkit
- Timestamp:
- Jan 3, 2014, 12:22:09 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161276 r161278 1 2014-01-03 Andreas Kling <akling@apple.com> 2 3 Deploy more child renderer iterators in RenderBlockFlow. 4 <https://webkit.org/b/126434> 5 6 Reviewed by Sam Weinig. 7 8 * rendering/RenderBlockFlow.cpp: 9 (WebCore::shouldCheckLines): 10 11 Make this helper take a RenderBlockFlow instead of a RenderObject 12 and simplified it a bit. RenderDeprecatedFlexibleBox does not 13 derive from RenderBlockFlow so those checks can be omitted. 14 15 (WebCore::RenderBlockFlow::layoutBlock): 16 (WebCore::RenderBlockFlow::markAllDescendantsWithFloatsForLayout): 17 (WebCore::RenderBlockFlow::lineAtIndex): 18 (WebCore::RenderBlockFlow::lineCount): 19 (WebCore::RenderBlockFlow::clearTruncation): 20 21 Use childrenOfType to iterate over block and block-flow children. 22 Tweaked some early return/continue to reduce nesting. 23 1 24 2014-01-03 Simon Fraser <simon.fraser@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r160598 r161278 387 387 if (oldHeight > newHeight && maxFloatLogicalBottom > newHeight && !childrenInline()) { 388 388 // One of our children's floats may have become an overhanging float for us. We need to look for it. 389 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 390 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPositioned()) { 391 RenderBlockFlow& block = toRenderBlockFlow(*child); 392 if (block.lowestFloatLogicalBottom() + block.logicalTop() > newHeight) 393 addOverhangingFloats(block, false); 394 } 389 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 390 if (blockFlow.isFloatingOrOutOfFlowPositioned()) 391 continue; 392 if (blockFlow.lowestFloatLogicalBottom() + blockFlow.logicalTop() > newHeight) 393 addOverhangingFloats(blockFlow, false); 395 394 } 396 395 } … … 2463 2462 removeFloatingObject(*floatToRemove); 2464 2463 2464 if (childrenInline()) 2465 return; 2466 2465 2467 // Iterate over our children and mark them as needed. 2466 if (!childrenInline()) { 2467 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 2468 if ((!floatToRemove && child->isFloatingOrOutOfFlowPositioned()) || !child->isRenderBlock()) 2469 continue; 2470 if (!child->isRenderBlockFlow()) { 2471 RenderBlock* childBlock = toRenderBlock(child); 2472 if (childBlock->shrinkToAvoidFloats() && childBlock->everHadLayout()) 2473 childBlock->setChildNeedsLayout(markParents); 2474 continue; 2475 } 2476 RenderBlockFlow* childBlock = toRenderBlockFlow(child); 2477 if ((floatToRemove ? childBlock->containsFloat(*floatToRemove) : childBlock->containsFloats()) || childBlock->shrinkToAvoidFloats()) 2478 childBlock->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); 2479 } 2468 for (auto& block : childrenOfType<RenderBlock>(*this)) { 2469 if (!floatToRemove && block.isFloatingOrOutOfFlowPositioned()) 2470 continue; 2471 if (!block.isRenderBlockFlow()) { 2472 if (block.shrinkToAvoidFloats() && block.everHadLayout()) 2473 block.setChildNeedsLayout(markParents); 2474 continue; 2475 } 2476 auto& blockFlow = toRenderBlockFlow(block); 2477 if ((floatToRemove ? blockFlow.containsFloat(*floatToRemove) : blockFlow.containsFloats()) || blockFlow.shrinkToAvoidFloats()) 2478 blockFlow.markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); 2480 2479 } 2481 2480 } … … 2863 2862 } 2864 2863 2865 static bool shouldCheckLines( RenderObject& obj)2866 { 2867 return ! obj.isFloatingOrOutOfFlowPositioned() && !obj.isRunIn() && obj.isRenderBlockFlow() && obj.style().height().isAuto() && (!obj.isDeprecatedFlexibleBox() || obj.style().boxOrient() == VERTICAL);2864 static bool shouldCheckLines(const RenderBlockFlow& blockFlow) 2865 { 2866 return !blockFlow.isFloatingOrOutOfFlowPositioned() && !blockFlow.isRunIn() && blockFlow.style().height().isAuto(); 2868 2867 } 2869 2868 … … 2880 2879 return box; 2881 2880 } 2882 } else { 2883 for (auto child = firstChild(); child; child = child->nextSibling()) { 2884 if (!shouldCheckLines(*child)) 2885 continue; 2886 if (RootInlineBox* box = toRenderBlockFlow(child)->lineAtIndex(i)) 2887 return box; 2888 } 2881 return nullptr; 2882 } 2883 2884 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 2885 if (!shouldCheckLines(blockFlow)) 2886 continue; 2887 if (RootInlineBox* box = blockFlow.lineAtIndex(i)) 2888 return box; 2889 2889 } 2890 2890 … … 2908 2908 } 2909 2909 } 2910 } else { 2911 for (auto child = firstChild(); child; child = child->nextSibling()) { 2912 if (shouldCheckLines(*child)) { 2913 bool recursiveFound = false; 2914 count += toRenderBlockFlow(child)->lineCount(stopRootInlineBox, &recursiveFound); 2915 if (recursiveFound) { 2916 if (found) 2917 *found = true; 2918 break; 2919 } 2920 } 2910 return count; 2911 } 2912 2913 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 2914 if (!shouldCheckLines(blockFlow)) 2915 continue; 2916 bool recursiveFound = false; 2917 count += blockFlow.lineCount(stopRootInlineBox, &recursiveFound); 2918 if (recursiveFound) { 2919 if (found) 2920 *found = true; 2921 break; 2921 2922 } 2922 2923 } … … 2938 2939 RenderBox* normalFlowChildWithoutLines = 0; 2939 2940 for (auto obj = block.firstChildBox(); obj; obj = obj->nextSiblingBox()) { 2940 if ( shouldCheckLines(*obj)) {2941 if (obj->isRenderBlockFlow() && shouldCheckLines(toRenderBlockFlow(*obj))) { 2941 2942 int result = getHeightForLineCount(toRenderBlockFlow(*obj), lineCount, false, count); 2942 2943 if (result != -1) … … 2969 2970 for (auto box = firstRootBox(); box; box = box->nextRootBox()) 2970 2971 box->clearTruncation(); 2971 } else { 2972 for (auto child = firstChild(); child; child = child->nextSibling()) { 2973 if (shouldCheckLines(*child)) 2974 toRenderBlockFlow(child)->clearTruncation(); 2975 } 2972 return; 2973 } 2974 2975 for (auto& blockFlow : childrenOfType<RenderBlockFlow>(*this)) { 2976 if (shouldCheckLines(blockFlow)) 2977 blockFlow.clearTruncation(); 2976 2978 } 2977 2979 }
Note:
See TracChangeset
for help on using the changeset viewer.