| 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 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. | 4 * Copyright (C) 2003, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 enum ContentChangeType { | 45 enum ContentChangeType { |
| 46 ImageChanged, | 46 ImageChanged, |
| 47 CanvasChanged, | 47 CanvasChanged, |
| 48 CanvasContextChanged | 48 CanvasContextChanged |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 struct BorderEdge; | 51 struct BorderEdge; |
| 52 class RenderTextFragment; | 52 class RenderTextFragment; |
| 53 class BackgroundImageGeometry; |
| 53 | 54 |
| 54 // This class is the base for all objects that adhere to the CSS box model as de
scribed | 55 // This class is the base for all objects that adhere to the CSS box model as de
scribed |
| 55 // at http://www.w3.org/TR/CSS21/box.html | 56 // at http://www.w3.org/TR/CSS21/box.html |
| 56 | 57 |
| 57 class RenderBoxModelObject : public RenderLayerModelObject { | 58 class RenderBoxModelObject : public RenderLayerModelObject { |
| 58 public: | 59 public: |
| 59 RenderBoxModelObject(ContainerNode*); | 60 RenderBoxModelObject(ContainerNode*); |
| 60 virtual ~RenderBoxModelObject(); | 61 virtual ~RenderBoxModelObject(); |
| 61 | 62 |
| 62 LayoutSize relativePositionOffset() const; | 63 LayoutSize relativePositionOffset() const; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDire
ctionBordersOrPadding() || marginStart()|| marginEnd(); } | 152 bool hasInlineDirectionBordersPaddingOrMargin() const { return hasInlineDire
ctionBordersOrPadding() || marginStart()|| marginEnd(); } |
| 152 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || bo
rderEnd() || paddingStart()|| paddingEnd(); } | 153 bool hasInlineDirectionBordersOrPadding() const { return borderStart() || bo
rderEnd() || paddingStart()|| paddingEnd(); } |
| 153 | 154 |
| 154 virtual LayoutUnit containingBlockLogicalWidthForContent() const; | 155 virtual LayoutUnit containingBlockLogicalWidthForContent() const; |
| 155 | 156 |
| 156 virtual void childBecameNonInline(RenderObject* /*child*/) { } | 157 virtual void childBecameNonInline(RenderObject* /*child*/) { } |
| 157 | 158 |
| 158 void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, Ba
ckgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true
, bool includeLogicalRightEdge = true); | 159 void paintBorder(const PaintInfo&, const LayoutRect&, const RenderStyle*, Ba
ckgroundBleedAvoidance = BackgroundBleedNone, bool includeLogicalLeftEdge = true
, bool includeLogicalRightEdge = true); |
| 159 bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderSt
yle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); | 160 bool paintNinePieceImage(GraphicsContext*, const LayoutRect&, const RenderSt
yle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver); |
| 160 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*,
ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge =
true); | 161 void paintBoxShadow(const PaintInfo&, const LayoutRect&, const RenderStyle*,
ShadowStyle, bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge =
true); |
| 161 void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer&
, const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox* = 0, const LayoutS
ize& = LayoutSize(), CompositeOperator = CompositeSourceOver, RenderObject* back
groundObject = 0, bool skipBaseColor = false); | |
| 162 | 162 |
| 163 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox* = 0) const; | 163 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox* = 0) const; |
| 164 | 164 |
| 165 // Overridden by subclasses to determine line height and baseline position. | 165 // Overridden by subclasses to determine line height and baseline position. |
| 166 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const = 0; | 166 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio
nMode = PositionOnContainingLine) const = 0; |
| 167 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const = 0; | 167 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const = 0; |
| 168 | 168 |
| 169 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c
onst OVERRIDE; | 169 virtual void mapAbsoluteToLocalPoint(MapCoordinatesFlags, TransformState&) c
onst OVERRIDE; |
| 170 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; | 170 virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; |
| 171 | 171 |
| 172 virtual void setSelectionState(SelectionState) OVERRIDE; | 172 virtual void setSelectionState(SelectionState) OVERRIDE; |
| 173 | 173 |
| 174 void contentChanged(ContentChangeType); | 174 void contentChanged(ContentChangeType); |
| 175 bool hasAcceleratedCompositing() const; | 175 bool hasAcceleratedCompositing() const; |
| 176 | 176 |
| 177 virtual void computeLayerHitTestRects(LayerHitTestRects&) const OVERRIDE; | 177 virtual void computeLayerHitTestRects(LayerHitTestRects&) const OVERRIDE; |
| 178 | 178 |
| 179 // FIXME: Slimming Paint: make these two methods private again after moving
paint code in this class to paint/ | |
| 180 void paintRootBackgroundColor(const PaintInfo&, const LayoutRect&, const Col
or&); | |
| 181 bool isDocumentElementWithOpaqueBackground() const; | |
| 182 | |
| 183 protected: | 179 protected: |
| 184 virtual void willBeDestroyed() OVERRIDE; | 180 virtual void willBeDestroyed() OVERRIDE; |
| 185 | 181 |
| 186 class BackgroundImageGeometry { | |
| 187 public: | |
| 188 BackgroundImageGeometry() | |
| 189 : m_hasNonLocalGeometry(false) | |
| 190 { } | |
| 191 | |
| 192 IntPoint destOrigin() const { return m_destOrigin; } | |
| 193 void setDestOrigin(const IntPoint& destOrigin) | |
| 194 { | |
| 195 m_destOrigin = destOrigin; | |
| 196 } | |
| 197 | |
| 198 IntRect destRect() const { return m_destRect; } | |
| 199 void setDestRect(const IntRect& destRect) | |
| 200 { | |
| 201 m_destRect = destRect; | |
| 202 } | |
| 203 | |
| 204 // Returns the phase relative to the destination rectangle. | |
| 205 IntPoint relativePhase() const; | |
| 206 | |
| 207 IntPoint phase() const { return m_phase; } | |
| 208 void setPhase(const IntPoint& phase) | |
| 209 { | |
| 210 m_phase = phase; | |
| 211 } | |
| 212 | |
| 213 IntSize tileSize() const { return m_tileSize; } | |
| 214 void setTileSize(const IntSize& tileSize) | |
| 215 { | |
| 216 m_tileSize = tileSize; | |
| 217 } | |
| 218 | |
| 219 // Space-size represents extra width and height that may be added to | |
| 220 // the image if used as a pattern with repeat: space | |
| 221 IntSize spaceSize() const { return m_repeatSpacing; } | |
| 222 void setSpaceSize(const IntSize& repeatSpacing) | |
| 223 { | |
| 224 m_repeatSpacing = repeatSpacing; | |
| 225 } | |
| 226 | |
| 227 void setPhaseX(int x) { m_phase.setX(x); } | |
| 228 void setPhaseY(int y) { m_phase.setY(y); } | |
| 229 | |
| 230 void setNoRepeatX(int xOffset); | |
| 231 void setNoRepeatY(int yOffset); | |
| 232 | |
| 233 void useFixedAttachment(const IntPoint& attachmentPoint); | |
| 234 | |
| 235 void clip(const IntRect&); | |
| 236 | |
| 237 void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonL
ocalGeometry = hasNonLocalGeometry; } | |
| 238 bool hasNonLocalGeometry() const { return m_hasNonLocalGeometry; } | |
| 239 | |
| 240 private: | |
| 241 IntRect m_destRect; | |
| 242 IntPoint m_destOrigin; | |
| 243 IntPoint m_phase; | |
| 244 IntSize m_tileSize; | |
| 245 IntSize m_repeatSpacing; | |
| 246 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies
that we can't always cheaply compute destRect. | |
| 247 }; | |
| 248 | |
| 249 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const
; | 182 LayoutPoint adjustedPositionRelativeToOffsetParent(const LayoutPoint&) const
; |
| 250 | 183 |
| 251 bool calculateHasBoxDecorations() const; | 184 bool calculateHasBoxDecorations() const; |
| 252 void calculateBackgroundImageGeometry(const RenderLayerModelObject* paintCon
tainer, const FillLayer&, const LayoutRect& paintRect, BackgroundImageGeometry&,
RenderObject* = 0) const; | |
| 253 RoundedRect backgroundRoundedRectAdjustedForBleedAvoidance(GraphicsContext*,
const LayoutRect&, BackgroundBleedAvoidance, InlineFlowBox*, const LayoutSize&,
bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; | |
| 254 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const
LayoutRect&, BackgroundBleedAvoidance) const; | 185 LayoutRect borderInnerRectAdjustedForBleedAvoidance(GraphicsContext*, const
LayoutRect&, BackgroundBleedAvoidance) const; |
| 255 | 186 |
| 256 InterpolationQuality chooseInterpolationQuality(GraphicsContext*, Image*, co
nst void*, const LayoutSize&); | |
| 257 | |
| 258 RenderBoxModelObject* continuation() const; | 187 RenderBoxModelObject* continuation() const; |
| 259 void setContinuation(RenderBoxModelObject*); | 188 void setContinuation(RenderBoxModelObject*); |
| 260 | 189 |
| 261 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn
dentOffset); | 190 LayoutRect localCaretRectForEmptyElement(LayoutUnit width, LayoutUnit textIn
dentOffset); |
| 262 | 191 |
| 263 static void clipRoundedInnerRect(GraphicsContext*, const LayoutRect&, const
RoundedRect& clipRect); | |
| 264 | |
| 265 bool hasAutoHeightOrContainingBlockWithAutoHeight() const; | 192 bool hasAutoHeightOrContainingBlockWithAutoHeight() const; |
| 266 | 193 |
| 267 public: | 194 public: |
| 268 static bool shouldAntialiasLines(GraphicsContext*); | 195 static bool shouldAntialiasLines(GraphicsContext*); |
| 269 | 196 |
| 270 // For RenderBlocks and RenderInlines with m_style->styleType() == FIRST_LET
TER, this tracks their remaining text fragments | 197 // For RenderBlocks and RenderInlines with m_style->styleType() == FIRST_LET
TER, this tracks their remaining text fragments |
| 271 RenderTextFragment* firstLetterRemainingText() const; | 198 RenderTextFragment* firstLetterRemainingText() const; |
| 272 void setFirstLetterRemainingText(RenderTextFragment*); | 199 void setFirstLetterRemainingText(RenderTextFragment*); |
| 273 | 200 |
| 274 // These functions are only used internally to manipulate the render tree st
ructure via remove/insert/appendChildNode. | 201 // These functions are only used internally to manipulate the render tree st
ructure via remove/insert/appendChildNode. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 295 } | 222 } |
| 296 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse
rt = false); | 223 void moveChildrenTo(RenderBoxModelObject* toBoxModelObject, RenderObject* st
artChild, RenderObject* endChild, RenderObject* beforeChild, bool fullRemoveInse
rt = false); |
| 297 | 224 |
| 298 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; | 225 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffective
Zoom }; |
| 299 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; | 226 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaled
PositioningAreaSize, ScaleByEffectiveZoomOrNot) const; |
| 300 | 227 |
| 301 private: | 228 private: |
| 302 LayoutUnit computedCSSPadding(const Length&) const; | 229 LayoutUnit computedCSSPadding(const Length&) const; |
| 303 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; } | 230 virtual bool isBoxModelObject() const OVERRIDE FINAL { return true; } |
| 304 | 231 |
| 305 IntSize calculateFillTileSize(const FillLayer&, const IntSize& scaledPositio
ningAreaSize) const; | |
| 306 | |
| 307 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, Layo
utUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, | |
| 308 bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const; | |
| 309 | |
| 310 bool fixedBackgroundPaintsInLocalCoordinates() const; | |
| 311 | |
| 312 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder,
const RoundedRect& innerBorder, | 232 void clipBorderSidePolygon(GraphicsContext*, const RoundedRect& outerBorder,
const RoundedRect& innerBorder, |
| 313 BoxSide, bool firstEdgeMatches, bool secondEdgeMa
tches); | 233 BoxSide, bool firstEdgeMatches, bool secondEdgeMa
tches); |
| 314 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&,
const RoundedRect&, BoxSide, const BorderEdge[]); | 234 void clipBorderSideForComplexInnerPath(GraphicsContext*, const RoundedRect&,
const RoundedRect&, BoxSide, const BorderEdge[]); |
| 315 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR
ect& outerBorder, const RoundedRect& innerBorder, | 235 void paintOneBorderSide(GraphicsContext*, const RenderStyle*, const RoundedR
ect& outerBorder, const RoundedRect& innerBorder, |
| 316 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacen
tSide2, const BorderEdge[], | 236 const IntRect& sideRect, BoxSide, BoxSide adjacentSide1, BoxSide adjacen
tSide2, const BorderEdge[], |
| 317 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool
includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); | 237 const Path*, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool
includeLogicalRightEdge, bool antialias, const Color* overrideColor = 0); |
| 318 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const
RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner
BorderAdjustment, | 238 void paintTranslucentBorderSides(GraphicsContext*, const RenderStyle*, const
RoundedRect& outerBorder, const RoundedRect& innerBorder, const IntPoint& inner
BorderAdjustment, |
| 319 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); | 239 const BorderEdge[], BorderEdgeFlags, BackgroundBleedAvoidance, bool incl
udeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialias = false); |
| 320 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec
t& outerBorder, const RoundedRect& innerBorder, | 240 void paintBorderSides(GraphicsContext*, const RenderStyle*, const RoundedRec
t& outerBorder, const RoundedRect& innerBorder, |
| 321 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFla
gs, BackgroundBleedAvoidance, | 241 const IntPoint& innerBorderAdjustment, const BorderEdge[], BorderEdgeFla
gs, BackgroundBleedAvoidance, |
| 322 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); | 242 bool includeLogicalLeftEdge, bool includeLogicalRightEdge, bool antialia
s = false, const Color* overrideColor = 0); |
| 323 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c
onst BorderEdge[], | 243 void drawBoxSideFromPath(GraphicsContext*, const LayoutRect&, const Path&, c
onst BorderEdge[], |
| 324 float thickness, float drawThickness, BoxSide, const
RenderStyle*, | 244 float thickness, float drawThickness, BoxSide, const
RenderStyle*, |
| 325 Color, EBorderStyle, BackgroundBleedAvoidance, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge); | 245 Color, EBorderStyle, BackgroundBleedAvoidance, bool
includeLogicalLeftEdge, bool includeLogicalRightEdge); |
| 326 }; | 246 }; |
| 327 | 247 |
| 328 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); | 248 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderBoxModelObject, isBoxModelObject()); |
| 329 | 249 |
| 330 } // namespace blink | 250 } // namespace blink |
| 331 | 251 |
| 332 #endif // RenderBoxModelObject_h | 252 #endif // RenderBoxModelObject_h |
| OLD | NEW |