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

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: Update some text expectations, and move the new properties into ComputedStyle, since they aren't ra… 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 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
1900 curr = curr->containingBlock(); 1900 curr = curr->containingBlock();
1901 } 1901 }
1902 return true; 1902 return true;
1903 } 1903 }
1904 1904
1905 bool LayoutBox::hasForcedBreakBefore() const 1905 bool LayoutBox::hasForcedBreakBefore() const
1906 { 1906 {
1907 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1907 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1908 bool checkColumnBreaks = flowThread; 1908 bool checkColumnBreaks = flowThread;
1909 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. 1909 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this.
1910 bool checkBeforeAlways = (checkColumnBreaks && style()->columnBreakBefore() == PBALWAYS) 1910 bool checkBeforeAlways = (checkColumnBreaks && style()->breakBefore() == Bre akColumn)
1911 || (checkPageBreaks && style()->pageBreakBefore() == PBALWAYS); 1911 || (checkPageBreaks && style()->breakBefore() == BreakPage);
1912 return checkBeforeAlways && isForcedBreakAllowed(this); 1912 return checkBeforeAlways && isForcedBreakAllowed(this);
1913 } 1913 }
1914 1914
1915 bool LayoutBox::hasForcedBreakAfter() const 1915 bool LayoutBox::hasForcedBreakAfter() const
1916 { 1916 {
1917 LayoutFlowThread* flowThread = flowThreadContainingBlock(); 1917 LayoutFlowThread* flowThread = flowThreadContainingBlock();
1918 bool checkColumnBreaks = flowThread; 1918 bool checkColumnBreaks = flowThread;
1919 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this. 1919 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); // TODO(mstensho): Once columns can print, we have to check this.
1920 bool checkAfterAlways = (checkColumnBreaks && style()->columnBreakAfter() == PBALWAYS) 1920 bool checkAfterAlways = (checkColumnBreaks && style()->breakAfter() == Break Column)
1921 || (checkPageBreaks && style()->pageBreakAfter() == PBALWAYS); 1921 || (checkPageBreaks && style()->breakAfter() == BreakPage);
1922 return checkAfterAlways && isForcedBreakAllowed(this); 1922 return checkAfterAlways && isForcedBreakAllowed(this);
1923 } 1923 }
1924 1924
1925 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const 1925 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid ationState) const
1926 { 1926 {
1927 if (style()->visibility() != VISIBLE) { 1927 if (style()->visibility() != VISIBLE) {
1928 PaintLayer* layer = enclosingLayer(); 1928 PaintLayer* layer = enclosingLayer();
1929 layer->updateDescendantDependentFlags(); 1929 layer->updateDescendantDependentFlags();
1930 if (layer->subtreeIsInvisible()) 1930 if (layer->subtreeIsInvisible())
1931 return LayoutRect(); 1931 return LayoutRect();
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after
4217 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we 4217 // TODO(mstensho): It is wrong to check isAtomicInlineLevel() as we
4218 // actually look for replaced elements. 4218 // actually look for replaced elements.
4219 if (isAtomicInlineLevel() 4219 if (isAtomicInlineLevel()
4220 || hasUnsplittableScrollingOverflow() 4220 || hasUnsplittableScrollingOverflow()
4221 || (parent() && isWritingModeRoot()) 4221 || (parent() && isWritingModeRoot())
4222 || (isOutOfFlowPositioned() && style()->position() == FixedPosition)) 4222 || (isOutOfFlowPositioned() && style()->position() == FixedPosition))
4223 return ForbidBreaks; 4223 return ForbidBreaks;
4224 4224
4225 bool checkColumnBreaks = flowThreadContainingBlock(); 4225 bool checkColumnBreaks = flowThreadContainingBlock();
4226 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight(); 4226 bool checkPageBreaks = !checkColumnBreaks && view()->layoutState()->pageLogi calHeight();
4227 bool isUnsplittable = (checkColumnBreaks && style()->columnBreakInside() == PBAVOID) 4227 EBreak breakInside = style()->breakInside();
4228 || (checkPageBreaks && style()->pageBreakInside() == PBAVOID); 4228 bool isUnsplittable = (checkColumnBreaks && (breakInside == BreakAvoid || br eakInside == BreakAvoidColumn))
4229 || (checkPageBreaks && (breakInside == BreakAvoid || breakInside == Brea kAvoidPage));
4229 if (isUnsplittable) 4230 if (isUnsplittable)
4230 return AvoidBreaks; 4231 return AvoidBreaks;
4231 return AllowAnyBreaks; 4232 return AllowAnyBreaks;
4232 } 4233 }
4233 4234
4234 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const 4235 LayoutUnit LayoutBox::lineHeight(bool /*firstLine*/, LineDirectionMode direction , LinePositionMode /*linePositionMode*/) const
4235 { 4236 {
4236 if (isAtomicInlineLevel()) 4237 if (isAtomicInlineLevel())
4237 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width(); 4238 return direction == HorizontalLine ? marginHeight() + size().height() : marginWidth() + size().width();
4238 return LayoutUnit(); 4239 return LayoutUnit();
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
4714 4715
4715 void LayoutBox::clearPercentHeightDescendants() 4716 void LayoutBox::clearPercentHeightDescendants()
4716 { 4717 {
4717 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) { 4718 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde r(this)) {
4718 if (curr->isBox()) 4719 if (curr->isBox())
4719 toLayoutBox(curr)->removeFromPercentHeightContainer(); 4720 toLayoutBox(curr)->removeFromPercentHeightContainer();
4720 } 4721 }
4721 } 4722 }
4722 4723
4723 } // namespace blink 4724 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698