hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 1 | /* |
antti@apple.com | 0b6002b | 2009-02-13 21:17:46 +0000 | [diff] [blame] | 2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 | * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. |
senorblanco@chromium.org | 97cbe00 | 2010-06-17 19:50:36 +0000 | [diff] [blame] | 5 | * Copyright (C) 2010 Google Inc. All rights reserved. |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Library General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Library General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Library General Public License |
| 18 | * along with this library; see the file COPYING.LIB. If not, write to |
| 19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | * |
| 22 | */ |
| 23 | |
commit-queue@webkit.org | 46c0f52 | 2016-11-13 10:05:43 +0000 | [diff] [blame] | 24 | #pragma once |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 25 | |
jer.noble@apple.com | d78e908 | 2017-06-07 17:44:45 +0000 | [diff] [blame] | 26 | #include "FontBaseline.h" |
eae@chromium.org | 9717cd8 | 2012-11-07 18:33:44 +0000 | [diff] [blame] | 27 | #include "LayoutRect.h" |
fmalita@chromium.org | 49d26f2 | 2012-10-01 22:04:56 +0000 | [diff] [blame] | 28 | #include "RenderLayerModelObject.h" |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 29 | |
| 30 | namespace WebCore { |
| 31 | |
hyatt@apple.com | ddd8c30 | 2010-10-19 18:38:14 +0000 | [diff] [blame] | 32 | // Modes for some of the line-related functions. |
| 33 | enum LinePositionMode { PositionOnContainingLine, PositionOfInteriorLineBoxes }; |
| 34 | enum LineDirectionMode { HorizontalLine, VerticalLine }; |
simon.fraser@apple.com | dbe8fcb | 2011-04-19 18:45:17 +0000 | [diff] [blame] | 35 | typedef unsigned BorderEdgeFlags; |
hyatt@apple.com | ddd8c30 | 2010-10-19 18:38:14 +0000 | [diff] [blame] | 36 | |
simon.fraser@apple.com | b1b80be | 2011-04-20 05:13:32 +0000 | [diff] [blame] | 37 | enum BackgroundBleedAvoidance { |
| 38 | BackgroundBleedNone, |
| 39 | BackgroundBleedShrinkBackground, |
junov@google.com | 51590f4 | 2012-11-14 19:12:02 +0000 | [diff] [blame] | 40 | BackgroundBleedUseTransparencyLayer, |
| 41 | BackgroundBleedBackgroundOverBorder |
simon.fraser@apple.com | b1b80be | 2011-04-20 05:13:32 +0000 | [diff] [blame] | 42 | }; |
| 43 | |
rosca@adobe.com | 8547130 | 2014-07-07 07:16:04 +0000 | [diff] [blame] | 44 | enum BaseBackgroundColorUsage { |
| 45 | BaseBackgroundColorUse, |
| 46 | BaseBackgroundColorOnly, |
| 47 | BaseBackgroundColorSkip |
| 48 | }; |
| 49 | |
jchaffraix@webkit.org | 363c387 | 2012-04-17 21:51:22 +0000 | [diff] [blame] | 50 | enum ContentChangeType { |
| 51 | ImageChanged, |
| 52 | MaskImageChanged, |
commit-queue@webkit.org | e82edbf | 2013-04-11 05:47:44 +0000 | [diff] [blame] | 53 | BackgroundImageChanged, |
jchaffraix@webkit.org | 363c387 | 2012-04-17 21:51:22 +0000 | [diff] [blame] | 54 | CanvasChanged, |
commit-queue@webkit.org | 76dd3d0 | 2012-07-06 17:47:34 +0000 | [diff] [blame] | 55 | CanvasPixelsChanged, |
jchaffraix@webkit.org | 363c387 | 2012-04-17 21:51:22 +0000 | [diff] [blame] | 56 | VideoChanged, |
| 57 | FullScreenChanged |
| 58 | }; |
| 59 | |
zalan@apple.com | ce03479 | 2014-03-16 04:57:03 +0000 | [diff] [blame] | 60 | class BorderEdge; |
stavila@adobe.com | 6cb976d | 2013-11-21 06:57:19 +0000 | [diff] [blame] | 61 | class ImageBuffer; |
commit-queue@webkit.org | 37afb39 | 2013-11-15 19:21:23 +0000 | [diff] [blame] | 62 | class InlineFlowBox; |
akling@apple.com | a4df5a1 | 2013-08-03 10:15:12 +0000 | [diff] [blame] | 63 | class RenderTextFragment; |
simon.fraser@apple.com | e7f41025 | 2012-09-06 23:21:09 +0000 | [diff] [blame] | 64 | class StickyPositionViewportConstraints; |
jchaffraix@webkit.org | 363c387 | 2012-04-17 21:51:22 +0000 | [diff] [blame] | 65 | |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 66 | class BackgroundImageGeometry { |
| 67 | public: |
zalan@apple.com | 53ba828 | 2015-02-25 23:19:17 +0000 | [diff] [blame] | 68 | BackgroundImageGeometry(const LayoutRect& destinationRect, const LayoutSize& tile, const LayoutSize& phase, const LayoutSize& space, bool fixedAttachment) |
| 69 | : m_destRect(destinationRect) |
simon.fraser@apple.com | 0d89e45 | 2015-07-06 04:29:25 +0000 | [diff] [blame] | 70 | , m_destOrigin(m_destRect.location()) |
zalan@apple.com | 53ba828 | 2015-02-25 23:19:17 +0000 | [diff] [blame] | 71 | , m_tileSize(tile) |
| 72 | , m_phase(phase) |
| 73 | , m_space(space) |
| 74 | , m_hasNonLocalGeometry(fixedAttachment) |
| 75 | { |
| 76 | } |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 77 | |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 78 | LayoutRect destRect() const { return m_destRect; } |
zalan@apple.com | 7d4d95b | 2015-02-24 20:42:41 +0000 | [diff] [blame] | 79 | LayoutSize phase() const { return m_phase; } |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 80 | LayoutSize tileSize() const { return m_tileSize; } |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 81 | LayoutSize spaceSize() const { return m_space; } |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 82 | bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } |
zalan@apple.com | 53ba828 | 2015-02-25 23:19:17 +0000 | [diff] [blame] | 83 | |
simon.fraser@apple.com | 0d89e45 | 2015-07-06 04:29:25 +0000 | [diff] [blame] | 84 | LayoutSize relativePhase() const |
| 85 | { |
| 86 | LayoutSize phase = m_phase; |
| 87 | phase += m_destRect.location() - m_destOrigin; |
| 88 | return phase; |
| 89 | } |
| 90 | |
zalan@apple.com | 53ba828 | 2015-02-25 23:19:17 +0000 | [diff] [blame] | 91 | void clip(const LayoutRect& clipRect) { m_destRect.intersect(clipRect); } |
| 92 | |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 93 | private: |
| 94 | LayoutRect m_destRect; |
simon.fraser@apple.com | 0d89e45 | 2015-07-06 04:29:25 +0000 | [diff] [blame] | 95 | LayoutPoint m_destOrigin; |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 96 | LayoutSize m_tileSize; |
zalan@apple.com | 53ba828 | 2015-02-25 23:19:17 +0000 | [diff] [blame] | 97 | LayoutSize m_phase; |
stavila@adobe.com | 4b17ac7 | 2014-12-04 17:05:12 +0000 | [diff] [blame] | 98 | LayoutSize m_space; |
| 99 | bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect. |
| 100 | }; |
| 101 | |
hyatt@apple.com | 80ab6e9 | 2009-02-05 17:24:00 +0000 | [diff] [blame] | 102 | // This class is the base for all objects that adhere to the CSS box model as described |
| 103 | // at http://www.w3.org/TR/CSS21/box.html |
| 104 | |
fmalita@chromium.org | 49d26f2 | 2012-10-01 22:04:56 +0000 | [diff] [blame] | 105 | class RenderBoxModelObject : public RenderLayerModelObject { |
fpizlo@apple.com | d03c594 | 2017-11-07 19:21:52 +0000 | [diff] [blame] | 106 | WTF_MAKE_ISO_ALLOCATED(RenderBoxModelObject); |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 107 | public: |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 108 | virtual ~RenderBoxModelObject(); |
hyatt@apple.com | 80ab6e9 | 2009-02-05 17:24:00 +0000 | [diff] [blame] | 109 | |
eae@chromium.org | c20d163 | 2012-05-25 19:40:58 +0000 | [diff] [blame] | 110 | LayoutSize relativePositionOffset() const; |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 111 | LayoutSize relativePositionLogicalOffset() const { return style().isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } |
hyatt@apple.com | 80ab6e9 | 2009-02-05 17:24:00 +0000 | [diff] [blame] | 112 | |
simon.fraser@apple.com | 85fc4dc | 2014-05-28 04:44:48 +0000 | [diff] [blame] | 113 | FloatRect constrainingRectForStickyPosition() const; |
antti@apple.com | 9a637a0 | 2019-07-09 15:21:11 +0000 | [diff] [blame] | 114 | const RenderBox& enclosingClippingBoxForStickyPosition(const RenderLayer** enclosingClippingLayer = nullptr) const; |
simon.fraser@apple.com | 85fc4dc | 2014-05-28 04:44:48 +0000 | [diff] [blame] | 115 | void computeStickyPositionConstraints(StickyPositionViewportConstraints&, const FloatRect& constrainingRect) const; |
simon.fraser@apple.com | 0281aee | 2012-08-27 17:39:45 +0000 | [diff] [blame] | 116 | LayoutSize stickyPositionOffset() const; |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 117 | LayoutSize stickyPositionLogicalOffset() const { return style().isHorizontalWritingMode() ? stickyPositionOffset() : stickyPositionOffset().transposedSize(); } |
simon.fraser@apple.com | 0281aee | 2012-08-27 17:39:45 +0000 | [diff] [blame] | 118 | |
simon.fraser@apple.com | ea93fa0 | 2012-08-24 00:52:53 +0000 | [diff] [blame] | 119 | LayoutSize offsetForInFlowPosition() const; |
| 120 | |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 121 | // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) |
| 122 | // to return the remaining width on a given line (and the height of a single line). |
eae@chromium.org | 3097a25 | 2011-06-28 23:56:01 +0000 | [diff] [blame] | 123 | virtual LayoutUnit offsetLeft() const; |
| 124 | virtual LayoutUnit offsetTop() const; |
| 125 | virtual LayoutUnit offsetWidth() const = 0; |
| 126 | virtual LayoutUnit offsetHeight() const = 0; |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 127 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 128 | void updateFromStyle() override; |
hyatt@apple.com | 0de4d64 | 2009-02-05 22:26:53 +0000 | [diff] [blame] | 129 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 130 | bool requiresLayer() const override { return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection(); } |
hyatt@apple.com | 0de4d64 | 2009-02-05 22:26:53 +0000 | [diff] [blame] | 131 | |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 132 | // This will work on inlines to return the bounding box of all of the lines' border boxes. |
zalan@apple.com | 21f447c | 2016-03-29 01:06:56 +0000 | [diff] [blame] | 133 | virtual LayoutRect borderBoundingBox() const = 0; |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 134 | |
jchaffraix@webkit.org | 8caa9de | 2012-04-11 04:15:37 +0000 | [diff] [blame] | 135 | // These return the CSS computed padding values. |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 136 | LayoutUnit computedCSSPaddingTop() const { return computedCSSPadding(style().paddingTop()); } |
| 137 | LayoutUnit computedCSSPaddingBottom() const { return computedCSSPadding(style().paddingBottom()); } |
| 138 | LayoutUnit computedCSSPaddingLeft() const { return computedCSSPadding(style().paddingLeft()); } |
| 139 | LayoutUnit computedCSSPaddingRight() const { return computedCSSPadding(style().paddingRight()); } |
| 140 | LayoutUnit computedCSSPaddingBefore() const { return computedCSSPadding(style().paddingBefore()); } |
| 141 | LayoutUnit computedCSSPaddingAfter() const { return computedCSSPadding(style().paddingAfter()); } |
| 142 | LayoutUnit computedCSSPaddingStart() const { return computedCSSPadding(style().paddingStart()); } |
| 143 | LayoutUnit computedCSSPaddingEnd() const { return computedCSSPadding(style().paddingEnd()); } |
jchaffraix@webkit.org | 8caa9de | 2012-04-11 04:15:37 +0000 | [diff] [blame] | 144 | |
| 145 | // These functions are used during layout. Table cells and the MathML |
| 146 | // code override them to include some extra intrinsic padding. |
| 147 | virtual LayoutUnit paddingTop() const { return computedCSSPaddingTop(); } |
| 148 | virtual LayoutUnit paddingBottom() const { return computedCSSPaddingBottom(); } |
| 149 | virtual LayoutUnit paddingLeft() const { return computedCSSPaddingLeft(); } |
| 150 | virtual LayoutUnit paddingRight() const { return computedCSSPaddingRight(); } |
| 151 | virtual LayoutUnit paddingBefore() const { return computedCSSPaddingBefore(); } |
| 152 | virtual LayoutUnit paddingAfter() const { return computedCSSPaddingAfter(); } |
| 153 | virtual LayoutUnit paddingStart() const { return computedCSSPaddingStart(); } |
| 154 | virtual LayoutUnit paddingEnd() const { return computedCSSPaddingEnd(); } |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 155 | |
ross.kirsling@sony.com | 8041465 | 2019-05-21 01:36:11 +0000 | [diff] [blame] | 156 | virtual LayoutUnit borderTop() const { return LayoutUnit(style().borderTopWidth()); } |
| 157 | virtual LayoutUnit borderBottom() const { return LayoutUnit(style().borderBottomWidth()); } |
| 158 | virtual LayoutUnit borderLeft() const { return LayoutUnit(style().borderLeftWidth()); } |
| 159 | virtual LayoutUnit borderRight() const { return LayoutUnit(style().borderRightWidth()); } |
bjonesbe@adobe.com | 562a50d | 2014-02-20 20:01:19 +0000 | [diff] [blame] | 160 | virtual LayoutUnit horizontalBorderExtent() const { return borderLeft() + borderRight(); } |
| 161 | virtual LayoutUnit verticalBorderExtent() const { return borderTop() + borderBottom(); } |
ross.kirsling@sony.com | 8041465 | 2019-05-21 01:36:11 +0000 | [diff] [blame] | 162 | virtual LayoutUnit borderBefore() const { return LayoutUnit(style().borderBeforeWidth()); } |
| 163 | virtual LayoutUnit borderAfter() const { return LayoutUnit(style().borderAfterWidth()); } |
| 164 | virtual LayoutUnit borderStart() const { return LayoutUnit(style().borderStartWidth()); } |
| 165 | virtual LayoutUnit borderEnd() const { return LayoutUnit(style().borderEndWidth()); } |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 166 | |
zoltan@webkit.org | 8e79cc2 | 2013-06-14 00:39:36 +0000 | [diff] [blame] | 167 | LayoutUnit borderAndPaddingStart() const { return borderStart() + paddingStart(); } |
| 168 | LayoutUnit borderAndPaddingBefore() const { return borderBefore() + paddingBefore(); } |
| 169 | LayoutUnit borderAndPaddingAfter() const { return borderAfter() + paddingAfter(); } |
| 170 | |
bjonesbe@adobe.com | 562a50d | 2014-02-20 20:01:19 +0000 | [diff] [blame] | 171 | LayoutUnit verticalBorderAndPaddingExtent() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); } |
| 172 | LayoutUnit horizontalBorderAndPaddingExtent() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); } |
zoltan@webkit.org | 8e79cc2 | 2013-06-14 00:39:36 +0000 | [diff] [blame] | 173 | LayoutUnit borderAndPaddingLogicalHeight() const { return borderAndPaddingBefore() + borderAndPaddingAfter(); } |
eae@chromium.org | fad42ed | 2011-07-13 22:24:30 +0000 | [diff] [blame] | 174 | LayoutUnit borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); } |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 175 | LayoutUnit borderAndPaddingLogicalLeft() const { return style().isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); } |
hyatt@apple.com | e16585a | 2011-02-28 23:21:36 +0000 | [diff] [blame] | 176 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 177 | LayoutUnit borderLogicalLeft() const { return style().isHorizontalWritingMode() ? borderLeft() : borderTop(); } |
| 178 | LayoutUnit borderLogicalRight() const { return style().isHorizontalWritingMode() ? borderRight() : borderBottom(); } |
betravis@adobe.com | edfb651 | 2013-11-14 21:26:53 +0000 | [diff] [blame] | 179 | LayoutUnit borderLogicalWidth() const { return borderStart() + borderEnd(); } |
| 180 | LayoutUnit borderLogicalHeight() const { return borderBefore() + borderAfter(); } |
hamaji@chromium.org | 61bc60b | 2010-04-23 17:33:19 +0000 | [diff] [blame] | 181 | |
akling@apple.com | 827be9c | 2013-10-29 02:58:43 +0000 | [diff] [blame] | 182 | LayoutUnit paddingLogicalLeft() const { return style().isHorizontalWritingMode() ? paddingLeft() : paddingTop(); } |
| 183 | LayoutUnit paddingLogicalRight() const { return style().isHorizontalWritingMode() ? paddingRight() : paddingBottom(); } |
betravis@adobe.com | edfb651 | 2013-11-14 21:26:53 +0000 | [diff] [blame] | 184 | LayoutUnit paddingLogicalWidth() const { return paddingStart() + paddingEnd(); } |
| 185 | LayoutUnit paddingLogicalHeight() const { return paddingBefore() + paddingAfter(); } |
| 186 | |
eae@chromium.org | 0518156 | 2011-06-29 21:41:41 +0000 | [diff] [blame] | 187 | virtual LayoutUnit marginTop() const = 0; |
| 188 | virtual LayoutUnit marginBottom() const = 0; |
| 189 | virtual LayoutUnit marginLeft() const = 0; |
| 190 | virtual LayoutUnit marginRight() const = 0; |
commit-queue@webkit.org | 49863d0 | 2015-03-30 02:00:20 +0000 | [diff] [blame] | 191 | virtual LayoutUnit marginBefore(const RenderStyle* otherStyle = nullptr) const = 0; |
| 192 | virtual LayoutUnit marginAfter(const RenderStyle* otherStyle = nullptr) const = 0; |
| 193 | virtual LayoutUnit marginStart(const RenderStyle* otherStyle = nullptr) const = 0; |
| 194 | virtual LayoutUnit marginEnd(const RenderStyle* otherStyle = nullptr) const = 0; |
bjonesbe@adobe.com | 562a50d | 2014-02-20 20:01:19 +0000 | [diff] [blame] | 195 | LayoutUnit verticalMarginExtent() const { return marginTop() + marginBottom(); } |
| 196 | LayoutUnit horizontalMarginExtent() const { return marginLeft() + marginRight(); } |
hyatt@apple.com | fce3dc7 | 2013-03-11 20:00:37 +0000 | [diff] [blame] | 197 | LayoutUnit marginLogicalHeight() const { return marginBefore() + marginAfter(); } |
| 198 | LayoutUnit marginLogicalWidth() const { return marginStart() + marginEnd(); } |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 199 | |
hyatt@apple.com | 0415e5d | 2010-10-07 17:40:25 +0000 | [diff] [blame] | 200 | bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDirectionBordersOrPadding() || marginStart()|| marginEnd(); } |
| 201 | bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); } |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 202 | |
eae@chromium.org | 9ddbcc5 | 2011-08-19 20:40:57 +0000 | [diff] [blame] | 203 | virtual LayoutUnit containingBlockLogicalWidthForContent() const; |
hyatt@apple.com | 36dd9e6 | 2009-02-13 02:10:35 +0000 | [diff] [blame] | 204 | |
zalan@apple.com | 196c7fe | 2014-03-14 03:44:03 +0000 | [diff] [blame] | 205 | void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); |
timothy_horton@apple.com | 3a2b0ce7 | 2019-12-01 06:10:25 +0000 | [diff] [blame] | 206 | bool paintNinePieceImage(GraphicsContext&, const LayoutRect&, const RenderStyle&, const NinePieceImage&, CompositeOperator = CompositeOperator::SourceOver); |
zalan@apple.com | 196c7fe | 2014-03-14 03:44:03 +0000 | [diff] [blame] | 207 | void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true); |
timothy_horton@apple.com | 3a2b0ce7 | 2019-12-01 06:10:25 +0000 | [diff] [blame] | 208 | void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = nullptr, const LayoutSize& = LayoutSize(), CompositeOperator = CompositeOperator::SourceOver, RenderElement* backgroundObject = nullptr, BaseBackgroundColorUsage = BaseBackgroundColorUse); |
junov@google.com | 51590f4 | 2012-11-14 19:12:02 +0000 | [diff] [blame] | 209 | |
zalan@apple.com | fecbc34 | 2015-05-15 17:39:05 +0000 | [diff] [blame] | 210 | virtual bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& absolutePaintPostion, BackgroundBleedAvoidance, InlineFlowBox* = nullptr) const; |
mitz@apple.com | 82d31e1 | 2012-02-15 21:57:02 +0000 | [diff] [blame] | 211 | |
hyatt@apple.com | ddd8c30 | 2010-10-19 18:38:14 +0000 | [diff] [blame] | 212 | // Overridden by subclasses to determine line height and baseline position. |
eae@chromium.org | 9ddbcc5 | 2011-08-19 20:40:57 +0000 | [diff] [blame] | 213 | virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; |
eae@chromium.org | 82b9498 | 2012-10-22 18:38:29 +0000 | [diff] [blame] | 214 | virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0; |
hyatt@apple.com | 4f81f3e | 2009-02-10 23:00:37 +0000 | [diff] [blame] | 215 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 216 | void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override; |
commit-queue@webkit.org | e0ab12b | 2011-12-02 08:26:05 +0000 | [diff] [blame] | 217 | |
darin@apple.com | 11ff47c | 2016-03-04 16:47:55 +0000 | [diff] [blame] | 218 | void setSelectionState(SelectionState) override; |
simon.fraser@apple.com | 73cb0b3 | 2011-07-09 00:43:14 +0000 | [diff] [blame] | 219 | |
hyatt@apple.com | e0d2e0f | 2017-09-27 16:19:08 +0000 | [diff] [blame] | 220 | bool canHaveBoxInfoInFragment() const { return !isFloating() && !isReplaced() && !isInline() && !isTableCell() && isRenderBlock() && !isRenderSVGBlock(); } |
commit-queue@webkit.org | d43b24e | 2013-07-02 15:00:31 +0000 | [diff] [blame] | 221 | |
zalan@apple.com | fecbc34 | 2015-05-15 17:39:05 +0000 | [diff] [blame] | 222 | void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, const LayoutPoint& paintOffset, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const; |
jchaffraix@webkit.org | 363c387 | 2012-04-17 21:51:22 +0000 | [diff] [blame] | 223 | void contentChanged(ContentChangeType); |
| 224 | bool hasAcceleratedCompositing() const; |
| 225 | |
zalan@apple.com | d423bcc | 2016-02-06 23:07:54 +0000 | [diff] [blame] | 226 | RenderBoxModelObject* continuation() const; |
antti@apple.com | 7a59371 | 2017-11-08 23:13:42 +0000 | [diff] [blame] | 227 | WEBCORE_EXPORT RenderInline* inlineContinuation() const; |
antti@apple.com | f24da8d | 2017-11-02 11:31:06 +0000 | [diff] [blame] | 228 | |
| 229 | void insertIntoContinuationChainAfter(RenderBoxModelObject&); |
| 230 | void removeFromContinuationChain(); |
zalan@apple.com | d423bcc | 2016-02-06 23:07:54 +0000 | [diff] [blame] | 231 | |
hyatt@apple.com | 8091486 | 2017-03-06 18:00:35 +0000 | [diff] [blame] | 232 | virtual LayoutRect paintRectToClipOutFromBorder(const LayoutRect&) { return LayoutRect(); }; |
graouts@webkit.org | c44b6c4 | 2018-10-01 17:44:39 +0000 | [diff] [blame] | 233 | |
| 234 | bool hasRunningAcceleratedAnimations() const; |
rego@igalia.com | fdd982a | 2018-12-21 12:29:57 +0000 | [diff] [blame] | 235 | |
| 236 | virtual Optional<LayoutUnit> overrideContainingBlockContentWidth() const { ASSERT_NOT_REACHED(); return -1_lu; } |
| 237 | virtual Optional<LayoutUnit> overrideContainingBlockContentHeight() const { ASSERT_NOT_REACHED(); return -1_lu; } |
| 238 | virtual bool hasOverrideContainingBlockContentWidth() const { return false; } |
| 239 | virtual bool hasOverrideContainingBlockContentHeight() const { return false; } |
| 240 | |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 241 | protected: |
antti@apple.com | 454418f | 2016-04-25 19:49:23 +0000 | [diff] [blame] | 242 | RenderBoxModelObject(Element&, RenderStyle&&, BaseTypeFlags); |
| 243 | RenderBoxModelObject(Document&, RenderStyle&&, BaseTypeFlags); |
akling@apple.com | 42e1063 | 2013-10-14 17:55:52 +0000 | [diff] [blame] | 244 | |
zalan@apple.com | fde57e4 | 2018-02-22 00:20:40 +0000 | [diff] [blame] | 245 | void willBeDestroyed() override; |
simon.fraser@apple.com | 73cb0b3 | 2011-07-09 00:43:14 +0000 | [diff] [blame] | 246 | |
commit-queue@webkit.org | 24fb749 | 2012-05-30 20:30:51 +0000 | [diff] [blame] | 247 | LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const; |
commit-queue@webkit.org | 3a27f9d | 2012-05-08 19:11:14 +0000 | [diff] [blame] | 248 | |
hyatt@apple.com | 09485b1 | 2016-05-17 21:02:01 +0000 | [diff] [blame] | 249 | bool hasVisibleBoxDecorationStyle() const; |
zalan@apple.com | fecbc34 | 2015-05-15 17:39:05 +0000 | [diff] [blame] | 250 | BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&, const LayoutPoint& paintOffset, |
| 251 | const LayoutRect& paintRect, RenderElement* = nullptr) const; |
simon.fraser@apple.com | b1b80be | 2011-04-20 05:13:32 +0000 | [diff] [blame] | 252 | bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const; |
simon.fraser@apple.com | 620f56b | 2011-07-23 00:39:54 +0000 | [diff] [blame] | 253 | bool borderObscuresBackground() const; |
zalan@apple.com | 187d087 | 2014-02-23 16:25:43 +0000 | [diff] [blame] | 254 | RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; |
| 255 | LayoutRect borderInnerRectAdjustedForBleedAvoidance(const GraphicsContext&, const LayoutRect&, BackgroundBleedAvoidance) const; |
hyatt@apple.com | 0d4818f | 2009-02-08 05:39:22 +0000 | [diff] [blame] | 256 | |
simon.fraser@apple.com | ff67159 | 2016-01-29 23:15:58 +0000 | [diff] [blame] | 257 | InterpolationQuality chooseInterpolationQuality(GraphicsContext&, Image&, const void*, const LayoutSize&); |
senorblanco@chromium.org | 97cbe00 | 2010-06-17 19:50:36 +0000 | [diff] [blame] | 258 | |
commit-queue@webkit.org | f5887ce | 2012-06-09 01:56:42 +0000 | [diff] [blame] | 259 | LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset); |
| 260 | |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 261 | static bool shouldAntialiasLines(GraphicsContext&); |
darin@apple.com | afab5aa | 2011-09-23 03:00:38 +0000 | [diff] [blame] | 262 | |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 263 | static void clipRoundedInnerRect(GraphicsContext&, const FloatRect&, const FloatRoundedRect& clipRect); |
commit-queue@webkit.org | bd84fe7 | 2012-10-17 07:16:26 +0000 | [diff] [blame] | 264 | |
robert@webkit.org | 3d44aef | 2013-02-16 13:06:03 +0000 | [diff] [blame] | 265 | bool hasAutoHeightOrContainingBlockWithAutoHeight() const; |
| 266 | |
commit-queue@webkit.org | 8e6a869 | 2017-07-16 21:36:54 +0000 | [diff] [blame] | 267 | DecodingMode decodingModeForImageDraw(const Image&, const PaintInfo&) const; |
commit-queue@webkit.org | e9683d3 | 2017-07-13 02:20:19 +0000 | [diff] [blame] | 268 | |
commit-queue@webkit.org | e1944ce | 2012-01-05 08:51:51 +0000 | [diff] [blame] | 269 | public: |
commit-queue@webkit.org | eea2d6a | 2018-05-25 01:42:36 +0000 | [diff] [blame] | 270 | // For RenderBlocks and RenderInlines with m_style->styleType() == PseudoId::FirstLetter, this tracks their remaining text fragments |
akling@apple.com | a4df5a1 | 2013-08-03 10:15:12 +0000 | [diff] [blame] | 271 | RenderTextFragment* firstLetterRemainingText() const; |
antti@apple.com | d6e18df | 2017-11-02 08:05:36 +0000 | [diff] [blame] | 272 | void setFirstLetterRemainingText(RenderTextFragment&); |
| 273 | void clearFirstLetterRemainingText(); |
commit-queue@webkit.org | e1944ce | 2012-01-05 08:51:51 +0000 | [diff] [blame] | 274 | |
hmuller@adobe.com | 126a59c | 2014-03-10 18:41:34 +0000 | [diff] [blame] | 275 | enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom }; |
commit-queue@webkit.org | 4b12ad1 | 2015-10-12 19:51:11 +0000 | [diff] [blame] | 276 | LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const; |
hmuller@adobe.com | 126a59c | 2014-03-10 18:41:34 +0000 | [diff] [blame] | 277 | |
hyatt@apple.com | 790f871 | 2017-06-08 20:06:44 +0000 | [diff] [blame] | 278 | RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const; |
| 279 | |
zalan@apple.com | 9b46a84 | 2018-02-21 22:27:00 +0000 | [diff] [blame] | 280 | struct ContinuationChainNode { |
| 281 | WeakPtr<RenderBoxModelObject> renderer; |
| 282 | ContinuationChainNode* previous { nullptr }; |
| 283 | ContinuationChainNode* next { nullptr }; |
| 284 | |
| 285 | ContinuationChainNode(RenderBoxModelObject&); |
| 286 | ~ContinuationChainNode(); |
| 287 | |
| 288 | void insertAfter(ContinuationChainNode&); |
| 289 | |
| 290 | WTF_MAKE_FAST_ALLOCATED; |
| 291 | }; |
| 292 | |
| 293 | ContinuationChainNode* continuationChainNode() const; |
antti@apple.com | f24da8d | 2017-11-02 11:31:06 +0000 | [diff] [blame] | 294 | |
krit@webkit.org | e2c5c6a | 2018-07-17 16:52:04 +0000 | [diff] [blame] | 295 | protected: |
| 296 | LayoutUnit computedCSSPadding(const Length&) const; |
zalan@apple.com | 6fd57f0 | 2020-01-15 06:32:01 +0000 | [diff] [blame] | 297 | virtual void absoluteQuadsIgnoringContinuation(const FloatRect&, Vector<FloatQuad>&, bool* /*wasFixed*/) const { ASSERT_NOT_REACHED(); } |
| 298 | void collectAbsoluteQuadsForContinuation(Vector<FloatQuad>& quads, bool* wasFixed) const; |
krit@webkit.org | e2c5c6a | 2018-07-17 16:52:04 +0000 | [diff] [blame] | 299 | |
hyatt@apple.com | 0de4d64 | 2009-02-05 22:26:53 +0000 | [diff] [blame] | 300 | private: |
antti@apple.com | f24da8d | 2017-11-02 11:31:06 +0000 | [diff] [blame] | 301 | ContinuationChainNode& ensureContinuationChainNode(); |
simon.fraser@apple.com | 0281aee | 2012-08-27 17:39:45 +0000 | [diff] [blame] | 302 | |
| 303 | virtual LayoutRect frameRectForStickyPositioning() const = 0; |
mitz@apple.com | 0a597b1 | 2009-08-22 16:32:53 +0000 | [diff] [blame] | 304 | |
zalan@apple.com | 565d8b9 | 2015-02-24 22:53:09 +0000 | [diff] [blame] | 305 | LayoutSize calculateFillTileSize(const FillLayer&, const LayoutSize& scaledPositioningAreaSize) const; |
bdakin@apple.com | ae2078f | 2012-06-01 20:20:33 +0000 | [diff] [blame] | 306 | |
leviw@chromium.org | 9cc00d1 | 2011-07-12 18:37:09 +0000 | [diff] [blame] | 307 | RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, |
junov@google.com | 51590f4 | 2012-11-14 19:12:02 +0000 | [diff] [blame] | 308 | bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; |
simon.fraser@apple.com | a561496 | 2013-01-19 01:20:32 +0000 | [diff] [blame] | 309 | |
| 310 | bool fixedBackgroundPaintsInLocalCoordinates() const; |
commit-queue@webkit.org | 06b50ed | 2012-10-16 03:26:49 +0000 | [diff] [blame] | 311 | |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 312 | void clipBorderSidePolygon(GraphicsContext&, const RoundedRect& outerBorder, const RoundedRect& innerBorder, |
simon.fraser@apple.com | dbe8fcb | 2011-04-19 18:45:17 +0000 | [diff] [blame] | 313 | BoxSide, bool firstEdgeMatches, bool secondEdgeMatches); |
simon.fraser@apple.com | 4c073ea | 2016-06-09 16:59:17 +0000 | [diff] [blame] | 314 | |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 315 | void paintOneBorderSide(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder, |
zalan@apple.com | ce03479 | 2014-03-16 04:57:03 +0000 | [diff] [blame] | 316 | const LayoutRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge[], |
commit-queue@webkit.org | 49863d0 | 2015-03-30 02:00:20 +0000 | [diff] [blame] | 317 | const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = nullptr); |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 318 | void paintTranslucentBorderSides(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& innerBorderAdjustment, |
zalan@apple.com | ce03479 | 2014-03-16 04:57:03 +0000 | [diff] [blame] | 319 | const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 320 | void paintBorderSides(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder, |
zalan@apple.com | ce03479 | 2014-03-16 04:57:03 +0000 | [diff] [blame] | 321 | const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, |
commit-queue@webkit.org | 49863d0 | 2015-03-30 02:00:20 +0000 | [diff] [blame] | 322 | bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false, const Color* overrideColor = nullptr); |
mmaxfield@apple.com | a93d7ef | 2015-08-29 06:15:28 +0000 | [diff] [blame] | 323 | void drawBoxSideFromPath(GraphicsContext&, const LayoutRect&, const Path&, const BorderEdge[], |
zalan@apple.com | 196c7fe | 2014-03-14 03:44:03 +0000 | [diff] [blame] | 324 | float thickness, float drawThickness, BoxSide, const RenderStyle&, |
commit-queue@webkit.org | 1a4e667 | 2018-05-21 16:55:45 +0000 | [diff] [blame] | 325 | Color, BorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); |
abucur@adobe.com | 7f9668a | 2014-05-16 13:22:00 +0000 | [diff] [blame] | 326 | void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&); |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 327 | }; |
| 328 | |
hyatt@apple.com | c7def06 | 2009-02-05 06:15:11 +0000 | [diff] [blame] | 329 | } // namespace WebCore |
| 330 | |
cdumez@apple.com | f85e2f6 | 2014-10-07 00:26:25 +0000 | [diff] [blame] | 331 | SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBoxModelObject, isBoxModelObject()) |