OLD | NEW |
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 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 } | 1902 } |
1903 | 1903 |
1904 EBreak LayoutBox::breakInside() const | 1904 EBreak LayoutBox::breakInside() const |
1905 { | 1905 { |
1906 EBreak breakValue = style()->breakInside(); | 1906 EBreak breakValue = style()->breakInside(); |
1907 if (breakValue == BreakAuto || isBreakInsideControllable(breakValue)) | 1907 if (breakValue == BreakAuto || isBreakInsideControllable(breakValue)) |
1908 return breakValue; | 1908 return breakValue; |
1909 return BreakAuto; | 1909 return BreakAuto; |
1910 } | 1910 } |
1911 | 1911 |
1912 bool LayoutBox::hasForcedBreakBefore() const | 1912 // At a class A break point [1], the break value with the highest precedence win
s. If the two values |
| 1913 // have the same precedence (e.g. "left" and "right"), the value specified on a
latter object wins. |
| 1914 // |
| 1915 // [1] https://drafts.csswg.org/css-break/#possible-breaks |
| 1916 static inline int fragmentainerBreakPrecedence(EBreak breakValue) |
1913 { | 1917 { |
1914 return isForcedFragmentainerBreakValue(breakBefore()); | 1918 // "auto" has the lowest priority. |
| 1919 // "avoid*" values win over "auto". |
| 1920 // "avoid-page" wins over "avoid-column". |
| 1921 // "avoid" wins over "avoid-page". |
| 1922 // Forced break values win over "avoid". |
| 1923 // Any forced page break value wins over "column" forced break. |
| 1924 // More specific break values (left, right, recto, verso) wins over generic
"page" values. |
| 1925 |
| 1926 switch (breakValue) { |
| 1927 default: |
| 1928 ASSERT_NOT_REACHED(); |
| 1929 // fall-through |
| 1930 case BreakAuto: |
| 1931 return 0; |
| 1932 case BreakAvoidColumn: |
| 1933 return 1; |
| 1934 case BreakAvoidPage: |
| 1935 return 2; |
| 1936 case BreakAvoid: |
| 1937 return 3; |
| 1938 case BreakColumn: |
| 1939 return 4; |
| 1940 case BreakPage: |
| 1941 return 5; |
| 1942 case BreakLeft: |
| 1943 case BreakRight: |
| 1944 case BreakRecto: |
| 1945 case BreakVerso: |
| 1946 return 6; |
| 1947 } |
1915 } | 1948 } |
1916 | 1949 |
1917 bool LayoutBox::hasForcedBreakAfter() const | 1950 EBreak LayoutBox::joinFragmentainerBreakValues(EBreak firstValue, EBreak secondV
alue) |
1918 { | 1951 { |
1919 return isForcedFragmentainerBreakValue(breakAfter()); | 1952 if (fragmentainerBreakPrecedence(secondValue) >= fragmentainerBreakPrecedenc
e(firstValue)) |
| 1953 return secondValue; |
| 1954 return firstValue; |
| 1955 } |
| 1956 |
| 1957 EBreak LayoutBox::classABreakPointValue(EBreak previousBreakAfterValue) const |
| 1958 { |
| 1959 ASSERT(isBreakBetweenControllable(previousBreakAfterValue)); |
| 1960 return joinFragmentainerBreakValues(previousBreakAfterValue, breakBefore()); |
| 1961 } |
| 1962 |
| 1963 bool LayoutBox::needsForcedBreakBefore(EBreak previousBreakAfterValue) const |
| 1964 { |
| 1965 return isForcedFragmentainerBreakValue(classABreakPointValue(previousBreakAf
terValue)); |
1920 } | 1966 } |
1921 | 1967 |
1922 LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const | 1968 LayoutRect LayoutBox::localOverflowRectForPaintInvalidation() const |
1923 { | 1969 { |
1924 if (style()->visibility() != VISIBLE) { | 1970 if (style()->visibility() != VISIBLE) { |
1925 PaintLayer* layer = enclosingLayer(); | 1971 PaintLayer* layer = enclosingLayer(); |
1926 layer->updateDescendantDependentFlags(); | 1972 layer->updateDescendantDependentFlags(); |
1927 if (layer->subtreeIsInvisible()) | 1973 if (layer->subtreeIsInvisible()) |
1928 return LayoutRect(); | 1974 return LayoutRect(); |
1929 } | 1975 } |
(...skipping 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4701 | 4747 |
4702 void LayoutBox::clearPercentHeightDescendants() | 4748 void LayoutBox::clearPercentHeightDescendants() |
4703 { | 4749 { |
4704 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { | 4750 for (LayoutObject* curr = slowFirstChild(); curr; curr = curr->nextInPreOrde
r(this)) { |
4705 if (curr->isBox()) | 4751 if (curr->isBox()) |
4706 toLayoutBox(curr)->removeFromPercentHeightContainer(); | 4752 toLayoutBox(curr)->removeFromPercentHeightContainer(); |
4707 } | 4753 } |
4708 } | 4754 } |
4709 | 4755 |
4710 } // namespace blink | 4756 } // namespace blink |
OLD | NEW |