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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1916693002: Rewrite overhanging float arithmetic to work near numeric limits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/float/overhanging-float-overflow-crash-expected.txt ('k') | no next file » | 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) 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 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 LayoutObject* prev = previousSibling(); 992 LayoutObject* prev = previousSibling();
993 while (prev && (!prev->isBox() || !prev->isLayoutBlock() || toLayoutBlock(pr ev)->avoidsFloats() || toLayoutBlock(prev)->createsNewFormattingContext())) { 993 while (prev && (!prev->isBox() || !prev->isLayoutBlock() || toLayoutBlock(pr ev)->avoidsFloats() || toLayoutBlock(prev)->createsNewFormattingContext())) {
994 if (prev->isFloating()) 994 if (prev->isFloating())
995 siblingFloatMayIntrude = true; 995 siblingFloatMayIntrude = true;
996 prev = prev->previousSibling(); 996 prev = prev->previousSibling();
997 } 997 }
998 998
999 // First add in floats from the parent. Self-collapsing blocks let their par ent track any floats that intrude into 999 // First add in floats from the parent. Self-collapsing blocks let their par ent track any floats that intrude into
1000 // them (as opposed to floats they contain themselves) so check for those he re too. If margin collapsing has moved 1000 // them (as opposed to floats they contain themselves) so check for those he re too. If margin collapsing has moved
1001 // us up past the top a previous sibling then we need to check for floats fr om the parent too. 1001 // us up past the top a previous sibling then we need to check for floats fr om the parent too.
1002 LayoutUnit logicalTopOffset = logicalTop(); 1002 bool parentFloatsMayIntrude = !siblingFloatMayIntrude && (!prev || toLayoutB lockFlow(prev)->isSelfCollapsingBlock() || toLayoutBlock(prev)->logicalTop() > l ogicalTop())
1003 bool parentFloatsMayIntrude = !siblingFloatMayIntrude && (!prev || toLayoutB lockFlow(prev)->isSelfCollapsingBlock() || toLayoutBlock(prev)->logicalTop() > l ogicalTopOffset) 1003 && parentBlockFlow->lowestFloatLogicalBottom() > logicalTop();
1004 && parentBlockFlow->lowestFloatLogicalBottom() > logicalTopOffset;
1005 if (siblingFloatMayIntrude || parentFloatsMayIntrude) 1004 if (siblingFloatMayIntrude || parentFloatsMayIntrude)
1006 addIntrudingFloats(parentBlockFlow, parentBlockFlow->logicalLeftOffsetFo rContent(), logicalTopOffset); 1005 addIntrudingFloats(parentBlockFlow, parentBlockFlow->logicalLeftOffsetFo rContent(), logicalTop());
1007 1006
1008 // Add overhanging floats from the previous LayoutBlockFlow, but only if it has a float that intrudes into our space. 1007 // Add overhanging floats from the previous LayoutBlockFlow, but only if it has a float that intrudes into our space.
1009 if (prev) { 1008 if (prev) {
1010 LayoutBlockFlow* blockFlow = toLayoutBlockFlow(prev); 1009 LayoutBlockFlow* previousBlockFlow = toLayoutBlockFlow(prev);
1011 logicalTopOffset -= blockFlow->logicalTop(); 1010 if (logicalTop() < previousBlockFlow->logicalTop() + previousBlockFlow-> lowestFloatLogicalBottom())
1012 if (blockFlow->lowestFloatLogicalBottom() > logicalTopOffset) 1011 addIntrudingFloats(previousBlockFlow, LayoutUnit(), logicalTop() - p reviousBlockFlow->logicalTop());
1013 addIntrudingFloats(blockFlow, LayoutUnit(), logicalTopOffset);
1014 } 1012 }
1015 1013
1016 if (childrenInline()) { 1014 if (childrenInline()) {
1017 LayoutUnit changeLogicalTop = LayoutUnit::max(); 1015 LayoutUnit changeLogicalTop = LayoutUnit::max();
1018 LayoutUnit changeLogicalBottom = LayoutUnit::min(); 1016 LayoutUnit changeLogicalBottom = LayoutUnit::min();
1019 if (m_floatingObjects) { 1017 if (m_floatingObjects) {
1020 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set( ); 1018 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set( );
1021 FloatingObjectSetIterator end = floatingObjectSet.end(); 1019 FloatingObjectSetIterator end = floatingObjectSet.end();
1022 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { 1020 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
1023 const FloatingObject& floatingObject = *it->get(); 1021 const FloatingObject& floatingObject = *it->get();
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 // FIXME: Glyph overflow will get lost in this case, but not really a big de al. 3038 // FIXME: Glyph overflow will get lost in this case, but not really a big de al.
3041 GlyphOverflowAndFallbackFontsMap textBoxDataMap; 3039 GlyphOverflowAndFallbackFontsMap textBoxDataMap;
3042 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) { 3040 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin(); it != lineBoxes.end(); ++it) {
3043 RootInlineBox* box = *it; 3041 RootInlineBox* box = *it;
3044 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap); 3042 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataMap);
3045 } 3043 }
3046 return childrenOverflowChanged; 3044 return childrenOverflowChanged;
3047 } 3045 }
3048 3046
3049 } // namespace blink 3047 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/block/float/overhanging-float-overflow-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698