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

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

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 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
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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 ASSERT(!needsLayout() || (node() && node()->isElementNode() && toElement(nod e())->shadowPseudoId() == "-webkit-input-placeholder")); 345 ASSERT(!needsLayout() || (node() && node()->isElementNode() && toElement(nod e())->shadowPseudoId() == "-webkit-input-placeholder"));
346 346
347 if (logicalHeight() > LayoutUnit() 347 if (logicalHeight() > LayoutUnit()
348 || borderAndPaddingLogicalHeight() 348 || borderAndPaddingLogicalHeight()
349 || style()->logicalMinHeight().isPositive() 349 || style()->logicalMinHeight().isPositive()
350 || style()->marginBeforeCollapse() == MarginCollapseSeparate || style()- >marginAfterCollapse() == MarginCollapseSeparate) 350 || style()->marginBeforeCollapse() == MarginCollapseSeparate || style()- >marginAfterCollapse() == MarginCollapseSeparate)
351 return false; 351 return false;
352 352
353 Length logicalHeightLength = style()->logicalHeight(); 353 Length logicalHeightLength = style()->logicalHeight();
354 bool hasAutoHeight = logicalHeightLength.isAuto(); 354 bool hasAutoHeight = logicalHeightLength.isAuto();
355 if (logicalHeightLength.hasPercent() && !document().inQuirksMode()) { 355 if (logicalHeightLength.isPercentOrCalc() && !document().inQuirksMode()) {
356 hasAutoHeight = true; 356 hasAutoHeight = true;
357 for (LayoutBlock* cb = containingBlock(); !cb->isLayoutView(); cb = cb-> containingBlock()) { 357 for (LayoutBlock* cb = containingBlock(); !cb->isLayoutView(); cb = cb-> containingBlock()) {
358 if (cb->style()->logicalHeight().isFixed() || cb->isTableCell()) 358 if (cb->style()->logicalHeight().isFixed() || cb->isTableCell())
359 hasAutoHeight = false; 359 hasAutoHeight = false;
360 } 360 }
361 } 361 }
362 362
363 // If the height is 0 or auto, then whether or not we are a self-collapsing block depends 363 // If the height is 0 or auto, then whether or not we are a self-collapsing block depends
364 // on whether we have content that is all self-collapsing or not. 364 // on whether we have content that is all self-collapsing or not.
365 // TODO(alancutter): Make this work correctly for calc lengths. 365 // TODO(alancutter): Make this work correctly for calc lengths.
366 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength. hasPercent()) && logicalHeightLength.isZero())) { 366 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength. isPercentOrCalc()) && logicalHeightLength.isZero())) {
367 // If the block has inline children, see if we generated any line boxes. If we have any 367 // If the block has inline children, see if we generated any line boxes. If we have any
368 // line boxes, then we can't be self-collapsing, since we have content. 368 // line boxes, then we can't be self-collapsing, since we have content.
369 if (childrenInline()) 369 if (childrenInline())
370 return !firstLineBox(); 370 return !firstLineBox();
371 371
372 // Whether or not we collapse is dependent on whether all our normal flo w children 372 // Whether or not we collapse is dependent on whether all our normal flo w children
373 // are also self-collapsing. 373 // are also self-collapsing.
374 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) { 374 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli ngBox()) {
375 if (child->isFloatingOrOutOfFlowPositioned()) 375 if (child->isFloatingOrOutOfFlowPositioned())
376 continue; 376 continue;
(...skipping 3373 matching lines...) Expand 10 before | Expand all | Expand 10 after
3750 3750
3751 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 3751 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
3752 } 3752 }
3753 3753
3754 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval idationReason) const 3754 void LayoutBlockFlow::invalidateDisplayItemClients(PaintInvalidationReason inval idationReason) const
3755 { 3755 {
3756 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe ason); 3756 BlockFlowPaintInvalidator(*this).invalidateDisplayItemClients(invalidationRe ason);
3757 } 3757 }
3758 3758
3759 } // namespace blink 3759 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698