blob: e60d3c2b36e5ae852cb320d7db2e1595a9119e9f [file] [log] [blame]
hyatt@apple.comc7def062009-02-05 06:15:11 +00001/*
antti@apple.com0b6002b2009-02-13 21:17:46 +00002 * 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.org97cbe002010-06-17 19:50:36 +00005 * Copyright (C) 2010 Google Inc. All rights reserved.
hyatt@apple.comc7def062009-02-05 06:15:11 +00006 *
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.org46c0f522016-11-13 10:05:43 +000024#pragma once
hyatt@apple.comc7def062009-02-05 06:15:11 +000025
jer.noble@apple.comd78e9082017-06-07 17:44:45 +000026#include "FontBaseline.h"
eae@chromium.org9717cd82012-11-07 18:33:44 +000027#include "LayoutRect.h"
fmalita@chromium.org49d26f22012-10-01 22:04:56 +000028#include "RenderLayerModelObject.h"
hyatt@apple.comc7def062009-02-05 06:15:11 +000029
30namespace WebCore {
31
hyatt@apple.comddd8c302010-10-19 18:38:14 +000032// Modes for some of the line-related functions.
33enum LinePositionMode { PositionOnContainingLine, PositionOfInteriorLineBoxes };
34enum LineDirectionMode { HorizontalLine, VerticalLine };
simon.fraser@apple.comdbe8fcb2011-04-19 18:45:17 +000035typedef unsigned BorderEdgeFlags;
hyatt@apple.comddd8c302010-10-19 18:38:14 +000036
simon.fraser@apple.comb1b80be2011-04-20 05:13:32 +000037enum BackgroundBleedAvoidance {
38 BackgroundBleedNone,
39 BackgroundBleedShrinkBackground,
junov@google.com51590f42012-11-14 19:12:02 +000040 BackgroundBleedUseTransparencyLayer,
41 BackgroundBleedBackgroundOverBorder
simon.fraser@apple.comb1b80be2011-04-20 05:13:32 +000042};
43
rosca@adobe.com85471302014-07-07 07:16:04 +000044enum BaseBackgroundColorUsage {
45 BaseBackgroundColorUse,
46 BaseBackgroundColorOnly,
47 BaseBackgroundColorSkip
48};
49
jchaffraix@webkit.org363c3872012-04-17 21:51:22 +000050enum ContentChangeType {
51 ImageChanged,
52 MaskImageChanged,
commit-queue@webkit.orge82edbf2013-04-11 05:47:44 +000053 BackgroundImageChanged,
jchaffraix@webkit.org363c3872012-04-17 21:51:22 +000054 CanvasChanged,
commit-queue@webkit.org76dd3d02012-07-06 17:47:34 +000055 CanvasPixelsChanged,
jchaffraix@webkit.org363c3872012-04-17 21:51:22 +000056 VideoChanged,
57 FullScreenChanged
58};
59
zalan@apple.comce034792014-03-16 04:57:03 +000060class BorderEdge;
stavila@adobe.com6cb976d2013-11-21 06:57:19 +000061class ImageBuffer;
commit-queue@webkit.org37afb392013-11-15 19:21:23 +000062class InlineFlowBox;
akling@apple.coma4df5a12013-08-03 10:15:12 +000063class RenderTextFragment;
simon.fraser@apple.come7f410252012-09-06 23:21:09 +000064class StickyPositionViewportConstraints;
jchaffraix@webkit.org363c3872012-04-17 21:51:22 +000065
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000066class BackgroundImageGeometry {
67public:
zalan@apple.com53ba8282015-02-25 23:19:17 +000068 BackgroundImageGeometry(const LayoutRect& destinationRect, const LayoutSize& tile, const LayoutSize& phase, const LayoutSize& space, bool fixedAttachment)
69 : m_destRect(destinationRect)
simon.fraser@apple.com0d89e452015-07-06 04:29:25 +000070 , m_destOrigin(m_destRect.location())
zalan@apple.com53ba8282015-02-25 23:19:17 +000071 , m_tileSize(tile)
72 , m_phase(phase)
73 , m_space(space)
74 , m_hasNonLocalGeometry(fixedAttachment)
75 {
76 }
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000077
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000078 LayoutRect destRect() const { return m_destRect; }
zalan@apple.com7d4d95b2015-02-24 20:42:41 +000079 LayoutSize phase() const { return m_phase; }
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000080 LayoutSize tileSize() const { return m_tileSize; }
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000081 LayoutSize spaceSize() const { return m_space; }
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000082 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; }
zalan@apple.com53ba8282015-02-25 23:19:17 +000083
simon.fraser@apple.com0d89e452015-07-06 04:29:25 +000084 LayoutSize relativePhase() const
85 {
86 LayoutSize phase = m_phase;
87 phase += m_destRect.location() - m_destOrigin;
88 return phase;
89 }
90
zalan@apple.com53ba8282015-02-25 23:19:17 +000091 void clip(const LayoutRect& clipRect) { m_destRect.intersect(clipRect); }
92
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000093private:
94 LayoutRect m_destRect;
simon.fraser@apple.com0d89e452015-07-06 04:29:25 +000095 LayoutPoint m_destOrigin;
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000096 LayoutSize m_tileSize;
zalan@apple.com53ba8282015-02-25 23:19:17 +000097 LayoutSize m_phase;
stavila@adobe.com4b17ac72014-12-04 17:05:12 +000098 LayoutSize m_space;
99 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect.
100};
101
hyatt@apple.com80ab6e92009-02-05 17:24:00 +0000102// 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.org49d26f22012-10-01 22:04:56 +0000105class RenderBoxModelObject : public RenderLayerModelObject {
fpizlo@apple.comd03c5942017-11-07 19:21:52 +0000106 WTF_MAKE_ISO_ALLOCATED(RenderBoxModelObject);
hyatt@apple.comc7def062009-02-05 06:15:11 +0000107public:
hyatt@apple.comc7def062009-02-05 06:15:11 +0000108 virtual ~RenderBoxModelObject();
hyatt@apple.com80ab6e92009-02-05 17:24:00 +0000109
eae@chromium.orgc20d1632012-05-25 19:40:58 +0000110 LayoutSize relativePositionOffset() const;
akling@apple.com827be9c2013-10-29 02:58:43 +0000111 LayoutSize relativePositionLogicalOffset() const { return style().isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); }
hyatt@apple.com80ab6e92009-02-05 17:24:00 +0000112
simon.fraser@apple.com85fc4dc2014-05-28 04:44:48 +0000113 FloatRect constrainingRectForStickyPosition() const;
antti@apple.com9a637a02019-07-09 15:21:11 +0000114 const RenderBox& enclosingClippingBoxForStickyPosition(const RenderLayer** enclosingClippingLayer = nullptr) const;
simon.fraser@apple.com85fc4dc2014-05-28 04:44:48 +0000115 void computeStickyPositionConstraints(StickyPositionViewportConstraints&, const FloatRect& constrainingRect) const;
simon.fraser@apple.com0281aee2012-08-27 17:39:45 +0000116 LayoutSize stickyPositionOffset() const;
akling@apple.com827be9c2013-10-29 02:58:43 +0000117 LayoutSize stickyPositionLogicalOffset() const { return style().isHorizontalWritingMode() ? stickyPositionOffset() : stickyPositionOffset().transposedSize(); }
simon.fraser@apple.com0281aee2012-08-27 17:39:45 +0000118
simon.fraser@apple.comea93fa02012-08-24 00:52:53 +0000119 LayoutSize offsetForInFlowPosition() const;
120
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000121 // 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.org3097a252011-06-28 23:56:01 +0000123 virtual LayoutUnit offsetLeft() const;
124 virtual LayoutUnit offsetTop() const;
125 virtual LayoutUnit offsetWidth() const = 0;
126 virtual LayoutUnit offsetHeight() const = 0;
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000127
darin@apple.com11ff47c2016-03-04 16:47:55 +0000128 void updateFromStyle() override;
hyatt@apple.com0de4d642009-02-05 22:26:53 +0000129
darin@apple.com11ff47c2016-03-04 16:47:55 +0000130 bool requiresLayer() const override { return isDocumentElementRenderer() || isPositioned() || createsGroup() || hasClipPath() || hasTransformRelatedProperty() || hasHiddenBackface() || hasReflection(); }
hyatt@apple.com0de4d642009-02-05 22:26:53 +0000131
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000132 // This will work on inlines to return the bounding box of all of the lines' border boxes.
zalan@apple.com21f447c2016-03-29 01:06:56 +0000133 virtual LayoutRect borderBoundingBox() const = 0;
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000134
jchaffraix@webkit.org8caa9de2012-04-11 04:15:37 +0000135 // These return the CSS computed padding values.
akling@apple.com827be9c2013-10-29 02:58:43 +0000136 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.org8caa9de2012-04-11 04:15:37 +0000144
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.com0d4818f2009-02-08 05:39:22 +0000155
ross.kirsling@sony.com80414652019-05-21 01:36:11 +0000156 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.com562a50d2014-02-20 20:01:19 +0000160 virtual LayoutUnit horizontalBorderExtent() const { return borderLeft() + borderRight(); }
161 virtual LayoutUnit verticalBorderExtent() const { return borderTop() + borderBottom(); }
ross.kirsling@sony.com80414652019-05-21 01:36:11 +0000162 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.com0d4818f2009-02-08 05:39:22 +0000166
zoltan@webkit.org8e79cc22013-06-14 00:39:36 +0000167 LayoutUnit borderAndPaddingStart() const { return borderStart() + paddingStart(); }
168 LayoutUnit borderAndPaddingBefore() const { return borderBefore() + paddingBefore(); }
169 LayoutUnit borderAndPaddingAfter() const { return borderAfter() + paddingAfter(); }
170
bjonesbe@adobe.com562a50d2014-02-20 20:01:19 +0000171 LayoutUnit verticalBorderAndPaddingExtent() const { return borderTop() + borderBottom() + paddingTop() + paddingBottom(); }
172 LayoutUnit horizontalBorderAndPaddingExtent() const { return borderLeft() + borderRight() + paddingLeft() + paddingRight(); }
zoltan@webkit.org8e79cc22013-06-14 00:39:36 +0000173 LayoutUnit borderAndPaddingLogicalHeight() const { return borderAndPaddingBefore() + borderAndPaddingAfter(); }
eae@chromium.orgfad42ed2011-07-13 22:24:30 +0000174 LayoutUnit borderAndPaddingLogicalWidth() const { return borderStart() + borderEnd() + paddingStart() + paddingEnd(); }
akling@apple.com827be9c2013-10-29 02:58:43 +0000175 LayoutUnit borderAndPaddingLogicalLeft() const { return style().isHorizontalWritingMode() ? borderLeft() + paddingLeft() : borderTop() + paddingTop(); }
hyatt@apple.come16585a2011-02-28 23:21:36 +0000176
akling@apple.com827be9c2013-10-29 02:58:43 +0000177 LayoutUnit borderLogicalLeft() const { return style().isHorizontalWritingMode() ? borderLeft() : borderTop(); }
178 LayoutUnit borderLogicalRight() const { return style().isHorizontalWritingMode() ? borderRight() : borderBottom(); }
betravis@adobe.comedfb6512013-11-14 21:26:53 +0000179 LayoutUnit borderLogicalWidth() const { return borderStart() + borderEnd(); }
180 LayoutUnit borderLogicalHeight() const { return borderBefore() + borderAfter(); }
hamaji@chromium.org61bc60b2010-04-23 17:33:19 +0000181
akling@apple.com827be9c2013-10-29 02:58:43 +0000182 LayoutUnit paddingLogicalLeft() const { return style().isHorizontalWritingMode() ? paddingLeft() : paddingTop(); }
183 LayoutUnit paddingLogicalRight() const { return style().isHorizontalWritingMode() ? paddingRight() : paddingBottom(); }
betravis@adobe.comedfb6512013-11-14 21:26:53 +0000184 LayoutUnit paddingLogicalWidth() const { return paddingStart() + paddingEnd(); }
185 LayoutUnit paddingLogicalHeight() const { return paddingBefore() + paddingAfter(); }
186
eae@chromium.org05181562011-06-29 21:41:41 +0000187 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.org49863d02015-03-30 02:00:20 +0000191 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.com562a50d2014-02-20 20:01:19 +0000195 LayoutUnit verticalMarginExtent() const { return marginTop() + marginBottom(); }
196 LayoutUnit horizontalMarginExtent() const { return marginLeft() + marginRight(); }
hyatt@apple.comfce3dc72013-03-11 20:00:37 +0000197 LayoutUnit marginLogicalHeight() const { return marginBefore() + marginAfter(); }
198 LayoutUnit marginLogicalWidth() const { return marginStart() + marginEnd(); }
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000199
hyatt@apple.com0415e5d2010-10-07 17:40:25 +0000200 bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDirectionBordersOrPadding() || marginStart()|| marginEnd(); }
201 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || borderEnd() || paddingStart()|| paddingEnd(); }
hyatt@apple.com0d4818f2009-02-08 05:39:22 +0000202
eae@chromium.org9ddbcc52011-08-19 20:40:57 +0000203 virtual LayoutUnit containingBlockLogicalWidthForContent() const;
hyatt@apple.com36dd9e62009-02-13 02:10:35 +0000204
zalan@apple.com196c7fe2014-03-14 03:44:03 +0000205 void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle&, BackgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
timothy_horton@apple.com3a2b0ce72019-12-01 06:10:25 +0000206 bool paintNinePieceImage(GraphicsContext&, const LayoutRect&, const RenderStyle&, const NinePieceImage&, CompositeOperator = CompositeOperator::SourceOver);
zalan@apple.com196c7fe2014-03-14 03:44:03 +0000207 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle&, ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true);
timothy_horton@apple.com3a2b0ce72019-12-01 06:10:25 +0000208 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.com51590f42012-11-14 19:12:02 +0000209
zalan@apple.comfecbc342015-05-15 17:39:05 +0000210 virtual bool boxShadowShouldBeAppliedToBackground(const LayoutPoint& absolutePaintPostion, BackgroundBleedAvoidance, InlineFlowBox* = nullptr) const;
mitz@apple.com82d31e12012-02-15 21:57:02 +0000211
hyatt@apple.comddd8c302010-10-19 18:38:14 +0000212 // Overridden by subclasses to determine line height and baseline position.
eae@chromium.org9ddbcc52011-08-19 20:40:57 +0000213 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
eae@chromium.org82b94982012-10-22 18:38:29 +0000214 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const = 0;
hyatt@apple.com4f81f3e2009-02-10 23:00:37 +0000215
darin@apple.com11ff47c2016-03-04 16:47:55 +0000216 void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) const override;
commit-queue@webkit.orge0ab12b2011-12-02 08:26:05 +0000217
darin@apple.com11ff47c2016-03-04 16:47:55 +0000218 void setSelectionState(SelectionState) override;
simon.fraser@apple.com73cb0b32011-07-09 00:43:14 +0000219
hyatt@apple.come0d2e0f2017-09-27 16:19:08 +0000220 bool canHaveBoxInfoInFragment() const { return !isFloating() && !isReplaced() && !isInline() && !isTableCell() && isRenderBlock() && !isRenderSVGBlock(); }
commit-queue@webkit.orgd43b24e2013-07-02 15:00:31 +0000221
zalan@apple.comfecbc342015-05-15 17:39:05 +0000222 void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, const LayoutPoint& paintOffset, FloatRect& destRect, FloatSize& phase, FloatSize& tileSize) const;
jchaffraix@webkit.org363c3872012-04-17 21:51:22 +0000223 void contentChanged(ContentChangeType);
224 bool hasAcceleratedCompositing() const;
225
zalan@apple.comd423bcc2016-02-06 23:07:54 +0000226 RenderBoxModelObject* continuation() const;
antti@apple.com7a593712017-11-08 23:13:42 +0000227 WEBCORE_EXPORT RenderInline* inlineContinuation() const;
antti@apple.comf24da8d2017-11-02 11:31:06 +0000228
229 void insertIntoContinuationChainAfter(RenderBoxModelObject&);
230 void removeFromContinuationChain();
zalan@apple.comd423bcc2016-02-06 23:07:54 +0000231
hyatt@apple.com80914862017-03-06 18:00:35 +0000232 virtual LayoutRect paintRectToClipOutFromBorder(const LayoutRect&) { return LayoutRect(); };
graouts@webkit.orgc44b6c42018-10-01 17:44:39 +0000233
234 bool hasRunningAcceleratedAnimations() const;
rego@igalia.comfdd982a2018-12-21 12:29:57 +0000235
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.com0d4818f2009-02-08 05:39:22 +0000241protected:
antti@apple.com454418f2016-04-25 19:49:23 +0000242 RenderBoxModelObject(Element&, RenderStyle&&, BaseTypeFlags);
243 RenderBoxModelObject(Document&, RenderStyle&&, BaseTypeFlags);
akling@apple.com42e10632013-10-14 17:55:52 +0000244
zalan@apple.comfde57e42018-02-22 00:20:40 +0000245 void willBeDestroyed() override;
simon.fraser@apple.com73cb0b32011-07-09 00:43:14 +0000246
commit-queue@webkit.org24fb7492012-05-30 20:30:51 +0000247 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const;
commit-queue@webkit.org3a27f9d2012-05-08 19:11:14 +0000248
hyatt@apple.com09485b12016-05-17 21:02:01 +0000249 bool hasVisibleBoxDecorationStyle() const;
zalan@apple.comfecbc342015-05-15 17:39:05 +0000250 BackgroundImageGeometry calculateBackgroundImageGeometry(const RenderLayerModelObject* paintContainer, const FillLayer&, const LayoutPoint& paintOffset,
251 const LayoutRect& paintRect, RenderElement* = nullptr) const;
simon.fraser@apple.comb1b80be2011-04-20 05:13:32 +0000252 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
simon.fraser@apple.com620f56b2011-07-23 00:39:54 +0000253 bool borderObscuresBackground() const;
zalan@apple.com187d0872014-02-23 16:25:43 +0000254 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.com0d4818f2009-02-08 05:39:22 +0000256
simon.fraser@apple.comff671592016-01-29 23:15:58 +0000257 InterpolationQuality chooseInterpolationQuality(GraphicsContext&, Image&, const void*, const LayoutSize&);
senorblanco@chromium.org97cbe002010-06-17 19:50:36 +0000258
commit-queue@webkit.orgf5887ce2012-06-09 01:56:42 +0000259 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIndentOffset);
260
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000261 static bool shouldAntialiasLines(GraphicsContext&);
darin@apple.comafab5aa2011-09-23 03:00:38 +0000262
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000263 static void clipRoundedInnerRect(GraphicsContext&, const FloatRect&, const FloatRoundedRect& clipRect);
commit-queue@webkit.orgbd84fe72012-10-17 07:16:26 +0000264
robert@webkit.org3d44aef2013-02-16 13:06:03 +0000265 bool hasAutoHeightOrContainingBlockWithAutoHeight() const;
266
commit-queue@webkit.org8e6a8692017-07-16 21:36:54 +0000267 DecodingMode decodingModeForImageDraw(const Image&, const PaintInfo&) const;
commit-queue@webkit.orge9683d32017-07-13 02:20:19 +0000268
commit-queue@webkit.orge1944ce2012-01-05 08:51:51 +0000269public:
commit-queue@webkit.orgeea2d6a2018-05-25 01:42:36 +0000270 // For RenderBlocks and RenderInlines with m_style->styleType() == PseudoId::FirstLetter, this tracks their remaining text fragments
akling@apple.coma4df5a12013-08-03 10:15:12 +0000271 RenderTextFragment* firstLetterRemainingText() const;
antti@apple.comd6e18df2017-11-02 08:05:36 +0000272 void setFirstLetterRemainingText(RenderTextFragment&);
273 void clearFirstLetterRemainingText();
commit-queue@webkit.orge1944ce2012-01-05 08:51:51 +0000274
hmuller@adobe.com126a59c2014-03-10 18:41:34 +0000275 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom };
commit-queue@webkit.org4b12ad12015-10-12 19:51:11 +0000276 LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
hmuller@adobe.com126a59c2014-03-10 18:41:34 +0000277
hyatt@apple.com790f8712017-06-08 20:06:44 +0000278 RenderBlock* containingBlockForAutoHeightDetection(Length logicalHeight) const;
279
zalan@apple.com9b46a842018-02-21 22:27:00 +0000280 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.comf24da8d2017-11-02 11:31:06 +0000294
krit@webkit.orge2c5c6a2018-07-17 16:52:04 +0000295protected:
296 LayoutUnit computedCSSPadding(const Length&) const;
zalan@apple.com6fd57f02020-01-15 06:32:01 +0000297 virtual void absoluteQuadsIgnoringContinuation(const FloatRect&, Vector<FloatQuad>&, bool* /*wasFixed*/) const { ASSERT_NOT_REACHED(); }
298 void collectAbsoluteQuadsForContinuation(Vector<FloatQuad>& quads, bool* wasFixed) const;
krit@webkit.orge2c5c6a2018-07-17 16:52:04 +0000299
hyatt@apple.com0de4d642009-02-05 22:26:53 +0000300private:
antti@apple.comf24da8d2017-11-02 11:31:06 +0000301 ContinuationChainNode& ensureContinuationChainNode();
simon.fraser@apple.com0281aee2012-08-27 17:39:45 +0000302
303 virtual LayoutRect frameRectForStickyPositioning() const = 0;
mitz@apple.com0a597b12009-08-22 16:32:53 +0000304
zalan@apple.com565d8b92015-02-24 22:53:09 +0000305 LayoutSize calculateFillTileSize(const FillLayer&, const LayoutSize& scaledPositioningAreaSize) const;
bdakin@apple.comae2078f2012-06-01 20:20:33 +0000306
leviw@chromium.org9cc00d12011-07-12 18:37:09 +0000307 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight,
junov@google.com51590f42012-11-14 19:12:02 +0000308 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const;
simon.fraser@apple.coma5614962013-01-19 01:20:32 +0000309
310 bool fixedBackgroundPaintsInLocalCoordinates() const;
commit-queue@webkit.org06b50ed2012-10-16 03:26:49 +0000311
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000312 void clipBorderSidePolygon(GraphicsContext&, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
simon.fraser@apple.comdbe8fcb2011-04-19 18:45:17 +0000313 BoxSide, bool firstEdgeMatches, bool secondEdgeMatches);
simon.fraser@apple.com4c073ea2016-06-09 16:59:17 +0000314
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000315 void paintOneBorderSide(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
zalan@apple.comce034792014-03-16 04:57:03 +0000316 const LayoutRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacentSide2, const BorderEdge[],
commit-queue@webkit.org49863d02015-03-30 02:00:20 +0000317 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias, const Color* overrideColor = nullptr);
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000318 void paintTranslucentBorderSides(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& innerBorderAdjustment,
zalan@apple.comce034792014-03-16 04:57:03 +0000319 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false);
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000320 void paintBorderSides(GraphicsContext&, const RenderStyle&, const RoundedRect& outerBorder, const RoundedRect& innerBorder,
zalan@apple.comce034792014-03-16 04:57:03 +0000321 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance,
commit-queue@webkit.org49863d02015-03-30 02:00:20 +0000322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false, const Color* overrideColor = nullptr);
mmaxfield@apple.coma93d7ef2015-08-29 06:15:28 +0000323 void drawBoxSideFromPath(GraphicsContext&, const LayoutRect&, const Path&, const BorderEdge[],
zalan@apple.com196c7fe2014-03-14 03:44:03 +0000324 float thickness, float drawThickness, BoxSide, const RenderStyle&,
commit-queue@webkit.org1a4e6672018-05-21 16:55:45 +0000325 Color, BorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge);
abucur@adobe.com7f9668a2014-05-16 13:22:00 +0000326 void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&);
hyatt@apple.comc7def062009-02-05 06:15:11 +0000327};
328
hyatt@apple.comc7def062009-02-05 06:15:11 +0000329} // namespace WebCore
330
cdumez@apple.comf85e2f62014-10-07 00:26:25 +0000331SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBoxModelObject, isBoxModelObject())