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

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

Issue 1426673005: Introduce LayoutBox::paginationBreakability(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 4385 matching lines...) Expand 10 before | Expand all | Expand 10 after
4396 // We do have overflow. We'll still be willing to paginate as long as the bl ock 4396 // We do have overflow. We'll still be willing to paginate as long as the bl ock
4397 // has auto logical height, auto or undefined max-logical-height and a zero or auto min-logical-height. 4397 // has auto logical height, auto or undefined max-logical-height and a zero or auto min-logical-height.
4398 // Note this is just a heuristic, and it's still possible to have overflow u nder these 4398 // Note this is just a heuristic, and it's still possible to have overflow u nder these
4399 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow 4399 // conditions, but it should work out to be good enough for common cases. Pa ginating overflow
4400 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway. 4400 // with scrollbars present is not the end of the world and is what we used t o do in the old model anyway.
4401 return !style()->logicalHeight().isIntrinsicOrAuto() 4401 return !style()->logicalHeight().isIntrinsicOrAuto()
4402 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().hasPercent() || pe rcentageLogicalHeightIsResolvable())) 4402 || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logica lMaxHeight().isMaxSizeNone() && (!style()->logicalMaxHeight().hasPercent() || pe rcentageLogicalHeightIsResolvable()))
4403 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().hasPercent() || percen tageLogicalHeightIsResolvable())); 4403 || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logical MinHeight().isPositive() && (!style()->logicalMinHeight().hasPercent() || percen tageLogicalHeightIsResolvable()));
4404 } 4404 }
4405 4405
4406 bool LayoutBox::isUnsplittableForPagination() const 4406 LayoutBox::PaginationBreakability LayoutBox::paginationBreakability() const
4407 { 4407 {
4408 return isReplaced() 4408 if (isReplaced()
4409 || hasUnsplittableScrollingOverflow() 4409 || hasUnsplittableScrollingOverflow()
4410 || (parent() && isWritingModeRoot()) 4410 || (parent() && isWritingModeRoot())
4411 || (isOutOfFlowPositioned() && style()->position() == FixedPosition); 4411 || (isOutOfFlowPositioned() && style()->position() == FixedPosition))
4412 return ForbidBreaks;
4413
4414 bool checkColumnBreaks = flowThreadContainingBlock();
4415 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight();
4416 bool isUnsplittable = (checkColumnBreaks && style()->columnBreakInside() == PBAVOID)
4417 || (checkPageBreaks && style()->pageBreakInside() == PBAVOID);
4418 if (isUnsplittable)
4419 return AvoidBreaks;
4420 return AllowAnyBreaks;
4412 } 4421 }
4413 4422
4414 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4423 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4415 { 4424 {
4416 if (isReplaced()) 4425 if (isReplaced())
4417 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width(); 4426 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width();
4418 return LayoutUnit(); 4427 return LayoutUnit();
4419 } 4428 }
4420 4429
4421 int LayoutBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L ineDirectionMode direction, LinePositionMode linePositionMode) const 4430 int LayoutBox::baselinePosition(FontBaseline baselineType, bool /*firstLine*/, L ineDirectionMode direction, LinePositionMode linePositionMode) const
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 StyleImage* borderImage = style()->borderImage().image(); 4845 StyleImage* borderImage = style()->borderImage().image();
4837 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4846 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4838 } 4847 }
4839 4848
4840 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4849 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4841 { 4850 {
4842 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4851 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4843 } 4852 }
4844 4853
4845 } // namespace blink 4854 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698