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

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

Issue 1681273003: Add CSS parser support for break-after, break-before and break-inside. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase master Created 4 years, 10 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) 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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 curr = curr->containingBlock(); 1860 curr = curr->containingBlock();
1861 } 1861 }
1862 return true; 1862 return true;
1863 } 1863 }
1864 1864
1865 bool LayoutBox::hasForcedBreakBefore() const 1865 bool LayoutBox::hasForcedBreakBefore() const
1866 { 1866 {
1867 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1867 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1868 bool checkColumnBreaks = flowThread; 1868 bool checkColumnBreaks = flowThread;
1869 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. 1869 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this.
1870 bool checkBeforeAlways = (checkColumnBreaks && style()->columnBreakBefore() == PBALWAYS) 1870 bool checkBeforeAlways = (checkColumnBreaks && style()->breakBefore() == Bre akColumn)
1871 || (checkPageBreaks && style()->pageBreakBefore() == PBALWAYS); 1871 || (checkPageBreaks && style()->breakBefore() == BreakPage);
1872 return checkBeforeAlways && isForcedBreakAllowed(this); 1872 return checkBeforeAlways && isForcedBreakAllowed(this);
1873 } 1873 }
1874 1874
1875 bool LayoutBox::hasForcedBreakAfter() const 1875 bool LayoutBox::hasForcedBreakAfter() const
1876 { 1876 {
1877 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1877 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1878 bool checkColumnBreaks = flowThread; 1878 bool checkColumnBreaks = flowThread;
1879 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. 1879 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this.
1880 bool checkAfterAlways = (checkColumnBreaks && style()->columnBreakAfter() == PBALWAYS) 1880 bool checkAfterAlways = (checkColumnBreaks && style()->breakAfter() == Break Column)
1881 || (checkPageBreaks && style()->pageBreakAfter() == PBALWAYS); 1881 || (checkPageBreaks && style()->breakAfter() == BreakPage);
1882 return checkAfterAlways && isForcedBreakAllowed(this); 1882 return checkAfterAlways && isForcedBreakAllowed(this);
1883 } 1883 }
1884 1884
1885 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const 1885 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const
1886 { 1886 {
1887 if (style()->visibility() != VISIBLE) { 1887 if (style()->visibility() != VISIBLE) {
1888 PaintLayer* layer = enclosingLayer(); 1888 PaintLayer* layer = enclosingLayer();
1889 layer->updateDescendantDependentFlags(); 1889 layer->updateDescendantDependentFlags();
1890 if (layer->subtreeIsInvisible()) 1890 if (layer->subtreeIsInvisible())
1891 return LayoutRect(); 1891 return LayoutRect();
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after
4177 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we 4177 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we
4178 // actually look for replaced elements. 4178 // actually look for replaced elements.
4179 if (isAtomicInlineLevel() 4179 if (isAtomicInlineLevel()
4180 || hasUnsplittableScrollingOverflow() 4180 || hasUnsplittableScrollingOverflow()
4181 || (parent() && isWritingModeRoot()) 4181 || (parent() && isWritingModeRoot())
4182 || (isOutOfFlowPositioned() && style()->position() == FixedPosition)) 4182 || (isOutOfFlowPositioned() && style()->position() == FixedPosition))
4183 return ForbidBreaks; 4183 return ForbidBreaks;
4184 4184
4185 bool checkColumnBreaks = flowThreadContainingBlock(); 4185 bool checkColumnBreaks = flowThreadContainingBlock();
4186 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); 4186 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight();
4187 bool isUnsplittable = (checkColumnBreaks && style()->columnBreakInside() == PBAVOID) 4187 EBreak breakInside = style()->breakInside();
4188 || (checkPageBreaks && style()->pageBreakInside() == PBAVOID); 4188 bool isUnsplittable = (checkColumnBreaks && (breakInside == BreakAvoid || br eakInside == BreakAvoidColumn))
4189 || (checkPageBreaks && (breakInside == BreakAvoid || breakInside == Brea kAvoidPage));
4189 if (isUnsplittable) 4190 if (isUnsplittable)
4190 return AvoidBreaks; 4191 return AvoidBreaks;
4191 return AllowAnyBreaks; 4192 return AllowAnyBreaks;
4192 } 4193 }
4193 4194
4194 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4195 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4195 { 4196 {
4196 if (isAtomicInlineLevel()) 4197 if (isAtomicInlineLevel())
4197 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width(); 4198 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width();
4198 return LayoutUnit(); 4199 return LayoutUnit();
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 } 4682 }
4682 4683
4683 void LayoutBox::IntrinsicSizingInfo::transpose() 4684 void LayoutBox::IntrinsicSizingInfo::transpose()
4684 { 4685 {
4685 size = size.transposedSize(); 4686 size = size.transposedSize();
4686 aspectRatio = aspectRatio.transposedSize(); 4687 aspectRatio = aspectRatio.transposedSize();
4687 std::swap(hasWidth, hasHeight); 4688 std::swap(hasWidth, hasHeight);
4688 } 4689 }
4689 4690
4690 } // namespace blink 4691 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.cpp ('k') | third_party/WebKit/Source/core/style/ComputedStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698