initial import
[vuplus_webkit] / Source / WebCore / rendering / RenderObject.h
1 /*
2  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
4  *           (C) 2000 Dirk Mueller (mueller@kde.org)
5  *           (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6  * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7  * Copyright (C) 2009 Google Inc. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public License
20  * along with this library; see the file COPYING.LIB.  If not, write to
21  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  *
24  */
25
26 #ifndef RenderObject_h
27 #define RenderObject_h
28
29 #include "CachedResourceClient.h"
30 #include "Document.h"
31 #include "Element.h"
32 #include "FloatQuad.h"
33 #include "LayoutTypes.h"
34 #include "PaintPhase.h"
35 #include "RenderObjectChildList.h"
36 #include "RenderStyle.h"
37 #include "TextAffinity.h"
38 #include "TransformationMatrix.h"
39 #include <wtf/UnusedParam.h>
40
41 #if USE(CG) || USE(CAIRO) || USE(SKIA) || PLATFORM(QT)
42 #define HAVE_PATH_BASED_BORDER_RADIUS_DRAWING 1
43 #endif
44
45 namespace WebCore {
46
47 class AffineTransform;
48 class AnimationController;
49 class HitTestResult;
50 class InlineBox;
51 class InlineFlowBox;
52 class OverlapTestRequestClient;
53 class Path;
54 class Position;
55 class RenderBoxModelObject;
56 class RenderInline;
57 class RenderBlock;
58 class RenderFlowThread;
59 class RenderLayer;
60 class RenderTheme;
61 class TransformState;
62 class VisiblePosition;
63 #if ENABLE(SVG)
64 class RenderSVGResourceContainer;
65 #endif
66
67 struct PaintInfo;
68
69 enum HitTestFilter {
70     HitTestAll,
71     HitTestSelf,
72     HitTestDescendants
73 };
74
75 enum HitTestAction {
76     HitTestBlockBackground,
77     HitTestChildBlockBackground,
78     HitTestChildBlockBackgrounds,
79     HitTestFloat,
80     HitTestForeground
81 };
82
83 // Sides used when drawing borders and outlines. The values should run clockwise from top.
84 enum BoxSide {
85     BSTop,
86     BSRight,
87     BSBottom,
88     BSLeft
89 };
90
91 const int caretWidth = 1;
92
93 #if ENABLE(DASHBOARD_SUPPORT)
94 struct DashboardRegionValue {
95     bool operator==(const DashboardRegionValue& o) const
96     {
97         return type == o.type && bounds == o.bounds && clip == o.clip && label == o.label;
98     }
99     bool operator!=(const DashboardRegionValue& o) const
100     {
101         return !(*this == o);
102     }
103
104     String label;
105     IntRect bounds;
106     IntRect clip;
107     int type;
108 };
109 #endif
110
111 #ifndef NDEBUG
112 const int showTreeCharacterOffset = 39;
113 #endif
114
115 // Base class for all rendering tree objects.
116 class RenderObject : public CachedResourceClient {
117     friend class LayoutRepainter;
118     friend class RenderBlock;
119     friend class RenderBox;
120     friend class RenderLayer;
121     friend class RenderObjectChildList;
122     friend class RenderSVGContainer;
123 public:
124     // Anonymous objects should pass the document as their node, and they will then automatically be
125     // marked as anonymous in the constructor.
126     RenderObject(Node*);
127     virtual ~RenderObject();
128
129     RenderTheme* theme() const;
130
131     virtual const char* renderName() const = 0;
132
133     RenderObject* parent() const { return m_parent; }
134     bool isDescendantOf(const RenderObject*) const;
135
136     RenderObject* previousSibling() const { return m_previous; }
137     RenderObject* nextSibling() const { return m_next; }
138
139     RenderObject* firstChild() const
140     {
141         if (const RenderObjectChildList* children = virtualChildren())
142             return children->firstChild();
143         return 0;
144     }
145     RenderObject* lastChild() const
146     {
147         if (const RenderObjectChildList* children = virtualChildren())
148             return children->lastChild();
149         return 0;
150     }
151     RenderObject* beforePseudoElementRenderer() const
152     {
153         if (const RenderObjectChildList* children = virtualChildren())
154             return children->beforePseudoElementRenderer(this);
155         return 0;
156     }
157     RenderObject* afterPseudoElementRenderer() const
158     {
159         if (const RenderObjectChildList* children = virtualChildren())
160             return children->afterPseudoElementRenderer(this);
161         return 0;
162     }
163     virtual RenderObjectChildList* virtualChildren() { return 0; }
164     virtual const RenderObjectChildList* virtualChildren() const { return 0; }
165
166     RenderObject* nextInPreOrder() const;
167     RenderObject* nextInPreOrder(RenderObject* stayWithin) const;
168     RenderObject* nextInPreOrderAfterChildren() const;
169     RenderObject* nextInPreOrderAfterChildren(RenderObject* stayWithin) const;
170     RenderObject* previousInPreOrder() const;
171     RenderObject* childAt(unsigned) const;
172
173     RenderObject* firstLeafChild() const;
174     RenderObject* lastLeafChild() const;
175
176     // The following six functions are used when the render tree hierarchy changes to make sure layers get
177     // properly added and removed.  Since containership can be implemented by any subclass, and since a hierarchy
178     // can contain a mixture of boxes and other object types, these functions need to be in the base class.
179     RenderLayer* enclosingLayer() const;
180     void addLayers(RenderLayer* parentLayer);
181     void removeLayers(RenderLayer* parentLayer);
182     void moveLayers(RenderLayer* oldParent, RenderLayer* newParent);
183     RenderLayer* findNextLayer(RenderLayer* parentLayer, RenderObject* startPoint, bool checkParent = true);
184
185     // Convenience function for getting to the nearest enclosing box of a RenderObject.
186     RenderBox* enclosingBox() const;
187     RenderBoxModelObject* enclosingBoxModelObject() const;
188
189     // Function to return our enclosing flow thread if we are contained inside one.
190     RenderFlowThread* enclosingRenderFlowThread() const;
191
192     virtual bool isEmpty() const { return firstChild() == 0; }
193
194 #ifndef NDEBUG
195     void setHasAXObject(bool flag) { m_hasAXObject = flag; }
196     bool hasAXObject() const { return m_hasAXObject; }
197     bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; }
198     void setNeedsLayoutIsForbidden(bool flag) { m_setNeedsLayoutForbidden = flag; }
199 #endif
200
201     // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
202     // children.
203     virtual RenderBlock* firstLineBlock() const;
204
205     // Called when an object that was floating or positioned becomes a normal flow object
206     // again.  We have to make sure the render tree updates as needed to accommodate the new
207     // normal flow object.
208     void handleDynamicFloatPositionChange();
209     
210     // RenderObject tree manipulation
211     //////////////////////////////////////////
212     virtual bool canHaveChildren() const { return virtualChildren(); }
213     virtual bool isChildAllowed(RenderObject*, RenderStyle*) const { return true; }
214     virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0);
215     virtual void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild = 0) { return addChild(newChild, beforeChild); }
216     virtual void removeChild(RenderObject*);
217     virtual bool createsAnonymousWrapper() const { return false; }
218     //////////////////////////////////////////
219
220 protected:
221     //////////////////////////////////////////
222     // Helper functions. Dangerous to use!
223     void setPreviousSibling(RenderObject* previous) { m_previous = previous; }
224     void setNextSibling(RenderObject* next) { m_next = next; }
225     void setParent(RenderObject* parent) { m_parent = parent; }
226     //////////////////////////////////////////
227 private:
228     void addAbsoluteRectForLayer(IntRect& result);
229     void setLayerNeedsFullRepaint();
230
231 public:
232 #ifndef NDEBUG
233     void showTreeForThis() const;
234     void showRenderTreeForThis() const;
235     void showLineTreeForThis() const;
236
237     void showRenderObject() const;
238     // We don't make printedCharacters an optional parameter so that
239     // showRenderObject can be called from gdb easily.
240     void showRenderObject(int printedCharacters) const;
241     void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLabel2 = 0, int depth = 0) const;
242 #endif
243
244     static RenderObject* createObject(Node*, RenderStyle*);
245
246     // Overloaded new operator.  Derived classes must override operator new
247     // in order to allocate out of the RenderArena.
248     void* operator new(size_t, RenderArena*) throw();
249
250     // Overridden to prevent the normal delete from being called.
251     void operator delete(void*, size_t);
252
253 private:
254     // The normal operator new is disallowed on all render objects.
255     void* operator new(size_t) throw();
256
257 public:
258     RenderArena* renderArena() const { return document()->renderArena(); }
259
260     virtual bool isApplet() const { return false; }
261     virtual bool isBR() const { return false; }
262     virtual bool isBlockFlow() const { return false; }
263     virtual bool isBoxModelObject() const { return false; }
264     virtual bool isCounter() const { return false; }
265     virtual bool isQuote() const { return false; }
266 #if ENABLE(DETAILS)
267     virtual bool isDetails() const { return false; }
268     virtual bool isDetailsMarker() const { return false; }
269 #endif
270     virtual bool isEmbeddedObject() const { return false; }
271     virtual bool isFieldset() const { return false; }
272     virtual bool isFileUploadControl() const { return false; }
273     virtual bool isFrame() const { return false; }
274     virtual bool isFrameSet() const { return false; }
275     virtual bool isImage() const { return false; }
276     virtual bool isInlineBlockOrInlineTable() const { return false; }
277     virtual bool isListBox() const { return false; }
278     virtual bool isListItem() const { return false; }
279     virtual bool isListMarker() const { return false; }
280     virtual bool isMedia() const { return false; }
281     virtual bool isMenuList() const { return false; }
282 #if ENABLE(METER_TAG)
283     virtual bool isMeter() const { return false; }
284 #endif
285 #if ENABLE(PROGRESS_TAG)
286     virtual bool isProgress() const { return false; }
287 #endif
288     virtual bool isRenderBlock() const { return false; }
289     virtual bool isRenderButton() const { return false; }
290     virtual bool isRenderIFrame() const { return false; }
291     virtual bool isRenderImage() const { return false; }
292     virtual bool isRenderInline() const { return false; }
293     virtual bool isRenderPart() const { return false; }
294     virtual bool isRenderRegion() const { return false; }
295     virtual bool isRenderView() const { return false; }
296     virtual bool isReplica() const { return false; }
297
298     virtual bool isRuby() const { return false; }
299     virtual bool isRubyBase() const { return false; }
300     virtual bool isRubyRun() const { return false; }
301     virtual bool isRubyText() const { return false; }
302
303     virtual bool isSlider() const { return false; }
304     virtual bool isSliderThumb() const { return false; }
305 #if ENABLE(DETAILS)
306     virtual bool isSummary() const { return false; }
307 #endif
308     virtual bool isTable() const { return false; }
309     virtual bool isTableCell() const { return false; }
310     virtual bool isTableCol() const { return false; }
311     virtual bool isTableRow() const { return false; }
312     virtual bool isTableSection() const { return false; }
313     virtual bool isTextControl() const { return false; }
314     virtual bool isTextArea() const { return false; }
315     virtual bool isTextField() const { return false; }
316     virtual bool isVideo() const { return false; }
317     virtual bool isWidget() const { return false; }
318     virtual bool isCanvas() const { return false; }
319 #if ENABLE(FULLSCREEN_API)
320     virtual bool isRenderFullScreen() const { return false; }
321     virtual bool isRenderFullScreenPlaceholder() const { return false; }
322 #endif
323
324     virtual bool isRenderFlowThread() const { return false; }
325
326     bool isRoot() const { return document()->documentElement() == m_node; }
327     bool isBody() const;
328     bool isHR() const;
329     bool isLegend() const;
330
331     bool isHTMLMarquee() const;
332
333     inline bool isBeforeContent() const;
334     inline bool isAfterContent() const;
335     inline bool isBeforeOrAfterContent() const;
336     static inline bool isBeforeContent(const RenderObject* obj) { return obj && obj->isBeforeContent(); }
337     static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); }
338     static inline bool isBeforeOrAfterContent(const RenderObject* obj) { return obj && obj->isBeforeOrAfterContent(); }
339
340     bool childrenInline() const { return m_childrenInline; }
341     void setChildrenInline(bool b = true) { m_childrenInline = b; }
342     bool hasColumns() const { return m_hasColumns; }
343     void setHasColumns(bool b = true) { m_hasColumns = b; }
344
345     virtual bool requiresForcedStyleRecalcPropagation() const { return false; }
346
347 #if ENABLE(MATHML)
348     virtual bool isRenderMathMLBlock() const { return false; }
349 #endif // ENABLE(MATHML)
350
351 #if ENABLE(SVG)
352     // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have
353     // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation.
354     virtual bool isSVGRoot() const { return false; }
355     virtual bool isSVGContainer() const { return false; }
356     virtual bool isSVGViewportContainer() const { return false; } 
357     virtual bool isSVGGradientStop() const { return false; }
358     virtual bool isSVGHiddenContainer() const { return false; }
359     virtual bool isSVGPath() const { return false; }
360     virtual bool isSVGText() const { return false; }
361     virtual bool isSVGTextPath() const { return false; }
362     virtual bool isSVGInline() const { return false; }
363     virtual bool isSVGInlineText() const { return false; }
364     virtual bool isSVGImage() const { return false; }
365     virtual bool isSVGForeignObject() const { return false; }
366     virtual bool isSVGResourceContainer() const { return false; }
367     virtual bool isSVGResourceFilter() const { return false; }
368     virtual bool isSVGResourceFilterPrimitive() const { return false; }
369     virtual bool isSVGShadowTreeRootContainer() const { return false; }
370
371     virtual RenderSVGResourceContainer* toRenderSVGResourceContainer();
372
373     // FIXME: Those belong into a SVG specific base-class for all renderers (see above)
374     // Unfortunately we don't have such a class yet, because it's not possible for all renderers
375     // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock inheritance for instance)
376     virtual void setNeedsTransformUpdate() { }
377     virtual void setNeedsBoundariesUpdate();
378
379     // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width.
380     // This is used for all computation of objectBoundingBox relative units and by SVGLocateable::getBBox().
381     // NOTE: Markers are not specifically ignored here by SVG 1.1 spec, but we ignore them
382     // since stroke-width is ignored (and marker size can depend on stroke-width).
383     // objectBoundingBox is returned local coordinates.
384     // The name objectBoundingBox is taken from the SVG 1.1 spec.
385     virtual FloatRect objectBoundingBox() const;
386     virtual FloatRect strokeBoundingBox() const;
387
388     // Returns the smallest rectangle enclosing all of the painted content
389     // respecting clipping, masking, filters, opacity, stroke-width and markers
390     virtual FloatRect repaintRectInLocalCoordinates() const;
391
392     // This only returns the transform="" value from the element
393     // most callsites want localToParentTransform() instead.
394     virtual AffineTransform localTransform() const;
395
396     // Returns the full transform mapping from local coordinates to local coords for the parent SVG renderer
397     // This includes any viewport transforms and x/y offsets as well as the transform="" value off the element.
398     virtual const AffineTransform& localToParentTransform() const;
399
400     // SVG uses FloatPoint precise hit testing, and passes the point in parent
401     // coordinates instead of in repaint container coordinates.  Eventually the
402     // rest of the rendering tree will move to a similar model.
403     virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction);
404 #endif
405
406     bool isAnonymous() const { return m_isAnonymous; }
407     void setIsAnonymous(bool b) { m_isAnonymous = b; }
408     bool isAnonymousBlock() const
409     {
410         // This function is kept in sync with anonymous block creation conditions in
411         // RenderBlock::createAnonymousBlock(). This includes creating an anonymous
412         // RenderBlock having a BLOCK or BOX display. Other classes such as RenderTextFragment
413         // are not RenderBlocks and will return false. See https://bugs.webkit.org/show_bug.cgi?id=56709. 
414         return m_isAnonymous && (style()->display() == BLOCK || style()->display() == BOX) && style()->styleType() == NOPSEUDO && isRenderBlock() && !isListMarker()
415 #if ENABLE(FULLSCREEN_API)
416             && !isRenderFullScreen()
417             && !isRenderFullScreenPlaceholder()
418 #endif
419             ;
420     }
421     bool isAnonymousColumnsBlock() const { return style()->specifiesColumns() && isAnonymousBlock(); }
422     bool isAnonymousColumnSpanBlock() const { return style()->columnSpan() && isAnonymousBlock(); }
423     bool isElementContinuation() const { return node() && node()->renderer() != this; }
424     bool isInlineElementContinuation() const { return isElementContinuation() && isInline(); }
425     bool isBlockElementContinuation() const { return isElementContinuation() && !isInline(); }
426     virtual RenderBoxModelObject* virtualContinuation() const { return 0; }
427
428     bool isFloating() const { return m_floating; }
429     bool isPositioned() const { return m_positioned; } // absolute or fixed positioning
430     bool isRelPositioned() const { return m_relPositioned; } // relative positioning
431     bool isText() const  { return m_isText; }
432     bool isBox() const { return m_isBox; }
433     bool isInline() const { return m_inline; }  // inline object
434     bool isRunIn() const { return style()->display() == RUN_IN; } // run-in object
435     bool isDragging() const { return m_isDragging; }
436     bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
437     bool isHorizontalWritingMode() const { return m_horizontalWritingMode; }
438
439     bool hasLayer() const { return m_hasLayer; }
440     
441     bool hasBoxDecorations() const { return m_paintBackground; }
442     bool borderImageIsLoadedAndCanBeRendered() const;
443     bool mustRepaintBackgroundOrBorder() const;
444     bool hasBackground() const { return style()->hasBackground(); }
445     bool needsLayout() const { return m_needsLayout || m_normalChildNeedsLayout || m_posChildNeedsLayout || m_needsSimplifiedNormalFlowLayout || m_needsPositionedMovementLayout; }
446     bool selfNeedsLayout() const { return m_needsLayout; }
447     bool needsPositionedMovementLayout() const { return m_needsPositionedMovementLayout; }
448     bool needsPositionedMovementLayoutOnly() const { return m_needsPositionedMovementLayout && !m_needsLayout && !m_normalChildNeedsLayout && !m_posChildNeedsLayout && !m_needsSimplifiedNormalFlowLayout; }
449     bool posChildNeedsLayout() const { return m_posChildNeedsLayout; }
450     bool needsSimplifiedNormalFlowLayout() const { return m_needsSimplifiedNormalFlowLayout; }
451     bool normalChildNeedsLayout() const { return m_normalChildNeedsLayout; }
452     
453     bool preferredLogicalWidthsDirty() const { return m_preferredLogicalWidthsDirty; }
454
455     bool isSelectionBorder() const;
456
457     bool hasClip() const { return isPositioned() && style()->hasClip(); }
458     bool hasOverflowClip() const { return m_hasOverflowClip; }
459
460     bool hasTransform() const { return m_hasTransform; }
461     bool hasMask() const { return style() && style()->hasMask(); }
462
463     inline bool preservesNewline() const;
464
465 #if !HAVE(PATH_BASED_BORDER_RADIUS_DRAWING)
466     // FIXME: This function should be removed when all ports implement GraphicsContext::clipConvexPolygon()!!
467     // At that time, everyone can use RenderObject::drawBoxSideFromPath() instead. This should happen soon.
468     void drawArcForBoxSide(GraphicsContext*, int x, int y, float thickness, const IntSize& radius, int angleStart,
469                            int angleSpan, BoxSide, Color, EBorderStyle, bool firstCorner);
470 #endif
471
472     // The pseudo element style can be cached or uncached.  Use the cached method if the pseudo element doesn't respect
473     // any pseudo classes (and therefore has no concept of changing state).
474     RenderStyle* getCachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0) const;
475     PassRefPtr<RenderStyle> getUncachedPseudoStyle(PseudoId, RenderStyle* parentStyle = 0, RenderStyle* ownStyle = 0) const;
476     
477     virtual void updateDragState(bool dragOn);
478
479     RenderView* view() const;
480
481     // Returns true if this renderer is rooted, and optionally returns the hosting view (the root of the hierarchy).
482     bool isRooted(RenderView** = 0);
483
484     Node* node() const { return m_isAnonymous ? 0 : m_node; }
485
486     // Returns the styled node that caused the generation of this renderer.
487     // This is the same as node() except for renderers of :before and :after
488     // pseudo elements for which their parent node is returned.
489     Node* generatingNode() const { return m_node == document() ? 0 : m_node; }
490     void setNode(Node* node) { m_node = node; }
491
492     Document* document() const { return m_node->document(); }
493     Frame* frame() const { return document()->frame(); }
494
495     bool hasOutlineAnnotation() const;
496     bool hasOutline() const { return style()->hasOutline() || hasOutlineAnnotation(); }
497
498     // Returns the object containing this one. Can be different from parent for positioned elements.
499     // If repaintContainer and repaintContainerSkipped are not null, on return *repaintContainerSkipped
500     // is true if the renderer returned is an ancestor of repaintContainer.
501     RenderObject* container(RenderBoxModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const;
502
503     virtual RenderObject* hoverAncestor() const { return parent(); }
504
505     // IE Extension that can be called on any RenderObject.  See the implementation for the details.
506     RenderBoxModelObject* offsetParent() const;
507
508     void markContainingBlocksForLayout(bool scheduleRelayout = true, RenderObject* newRoot = 0);
509     void setNeedsLayout(bool b, bool markParents = true);
510     void setChildNeedsLayout(bool b, bool markParents = true);
511     void setNeedsPositionedMovementLayout();
512     void setNeedsSimplifiedNormalFlowLayout();
513     void setPreferredLogicalWidthsDirty(bool, bool markParents = true);
514     void invalidateContainerPreferredLogicalWidths();
515     
516     void setNeedsLayoutAndPrefWidthsRecalc()
517     {
518         setNeedsLayout(true);
519         setPreferredLogicalWidthsDirty(true);
520     }
521
522     void setPositioned(bool b = true)  { m_positioned = b;  }
523     void setRelPositioned(bool b = true) { m_relPositioned = b; }
524     void setFloating(bool b = true) { m_floating = b; }
525     void setInline(bool b = true) { m_inline = b; }
526     void setHasBoxDecorations(bool b = true) { m_paintBackground = b; }
527     void setIsText() { m_isText = true; }
528     void setIsBox() { m_isBox = true; }
529     void setReplaced(bool b = true) { m_replaced = b; }
530     void setHorizontalWritingMode(bool b = true) { m_horizontalWritingMode = b; }
531     void setHasOverflowClip(bool b = true) { m_hasOverflowClip = b; }
532     void setHasLayer(bool b = true) { m_hasLayer = b; }
533     void setHasTransform(bool b = true) { m_hasTransform = b; }
534     void setHasReflection(bool b = true) { m_hasReflection = b; }
535
536     void scheduleRelayout();
537
538     void updateFillImages(const FillLayer*, const FillLayer*);
539     void updateImage(StyleImage*, StyleImage*);
540
541     virtual void paint(PaintInfo&, const LayoutPoint&);
542
543     // Recursive function that computes the size and position of this object and all its descendants.
544     virtual void layout();
545
546     /* This function performs a layout only if one is needed. */
547     void layoutIfNeeded() { if (needsLayout()) layout(); }
548     
549     // used for element state updates that cannot be fixed with a
550     // repaint and do not need a relayout
551     virtual void updateFromElement() { }
552
553 #if ENABLE(DASHBOARD_SUPPORT)
554     virtual void addDashboardRegions(Vector<DashboardRegionValue>&);
555     void collectDashboardRegions(Vector<DashboardRegionValue>&);
556 #endif
557
558     bool hitTest(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestFilter = HitTestAll);
559     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
560     virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&);
561
562     virtual VisiblePosition positionForPoint(const LayoutPoint&);
563     VisiblePosition createVisiblePosition(int offset, EAffinity);
564     VisiblePosition createVisiblePosition(const Position&);
565
566     virtual void dirtyLinesFromChangedChild(RenderObject*);
567
568     // Called to update a style that is allowed to trigger animations.
569     // FIXME: Right now this will typically be called only when updating happens from the DOM on explicit elements.
570     // We don't yet handle generated content animation such as first-letter or before/after (we'll worry about this later).
571     void setAnimatableStyle(PassRefPtr<RenderStyle>);
572
573     // Set the style of the object and update the state of the object accordingly.
574     virtual void setStyle(PassRefPtr<RenderStyle>);
575
576     // Updates only the local style ptr of the object.  Does not update the state of the object,
577     // and so only should be called when the style is known not to have changed (or from setStyle).
578     void setStyleInternal(PassRefPtr<RenderStyle>);
579
580     // returns the containing block level element for this element.
581     virtual RenderBlock* containingBlock() const;
582
583     // Convert the given local point to absolute coordinates
584     // FIXME: Temporary. If useTransforms is true, take transforms into account. Eventually localToAbsolute() will always be transform-aware.
585     FloatPoint localToAbsolute(const FloatPoint& localPoint = FloatPoint(), bool fixed = false, bool useTransforms = false) const;
586     FloatPoint absoluteToLocal(const FloatPoint&, bool fixed = false, bool useTransforms = false) const;
587
588     // Convert a local quad to absolute coordinates, taking transforms into account.
589     FloatQuad localToAbsoluteQuad(const FloatQuad& quad, bool fixed = false, bool* wasFixed = 0) const
590     {
591         return localToContainerQuad(quad, 0, fixed, wasFixed);
592     }
593     // Convert a local quad into the coordinate system of container, taking transforms into account.
594     FloatQuad localToContainerQuad(const FloatQuad&, RenderBoxModelObject* repaintContainer, bool fixed = false, bool* wasFixed = 0) const;
595
596     // Return the offset from the container() renderer (excluding transforms). In multi-column layout,
597     // different offsets apply at different points, so return the offset that applies to the given point.
598     virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const;
599     // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms.
600     LayoutSize offsetFromAncestorContainer(RenderObject*) const;
601     
602     virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint&) { }
603     // FIXME: useTransforms should go away eventually
604     IntRect absoluteBoundingBoxRect(bool useTransforms = false);
605
606     // Build an array of quads in absolute coords for line boxes
607     virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) { }
608
609     void absoluteFocusRingQuads(Vector<FloatQuad>&);
610
611     // the rect that will be painted if this object is passed as the paintingRoot
612     LayoutRect paintingRootRect(LayoutRect& topLevelRect);
613
614     virtual LayoutUnit minPreferredLogicalWidth() const { return 0; }
615     virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; }
616
617     RenderStyle* style() const { return m_style.get(); }
618     RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); }
619     RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); }
620
621     // Used only by Element::pseudoStyleCacheIsInvalid to get a first line style based off of a
622     // given new style, without accessing the cache.
623     PassRefPtr<RenderStyle> uncachedFirstLineStyle(RenderStyle*) const;
624
625     // Anonymous blocks that are part of of a continuation chain will return their inline continuation's outline style instead.
626     // This is typically only relevant when repainting.
627     virtual RenderStyle* outlineStyleForRepaint() const { return style(); }
628     
629     void getTextDecorationColors(int decorations, Color& underline, Color& overline,
630                                  Color& linethrough, bool quirksMode = false);
631
632     // Return the RenderBox in the container chain which is responsible for painting this object, or 0
633     // if painting is root-relative. This is the container that should be passed to the 'forRepaint'
634     // methods.
635     RenderBoxModelObject* containerForRepaint() const;
636     // Actually do the repaint of rect r for this object which has been computed in the coordinate space
637     // of repaintContainer. If repaintContainer is 0, repaint via the view.
638     void repaintUsingContainer(RenderBoxModelObject* repaintContainer, const LayoutRect&, bool immediate = false);
639     
640     // Repaint the entire object.  Called when, e.g., the color of a border changes, or when a border
641     // style changes.
642     void repaint(bool immediate = false);
643
644     // Repaint a specific subrectangle within a given object.  The rect |r| is in the object's coordinate space.
645     void repaintRectangle(const LayoutRect&, bool immediate = false);
646
647     // Repaint only if our old bounds and new bounds are different. The caller may pass in newBounds and newOutlineBox if they are known.
648     bool repaintAfterLayoutIfNeeded(RenderBoxModelObject* repaintContainer, const LayoutRect& oldBounds, const LayoutRect& oldOutlineBox, const LayoutRect* newBoundsPtr = 0, const LayoutRect* newOutlineBoxPtr = 0);
649
650     // Repaint only if the object moved.
651     virtual void repaintDuringLayoutIfMoved(const LayoutRect&);
652
653     // Called to repaint a block's floats.
654     virtual void repaintOverhangingFloats(bool paintAllDescendants = false);
655
656     bool checkForRepaintDuringLayout() const;
657
658     // Returns the rect that should be repainted whenever this object changes.  The rect is in the view's
659     // coordinate space.  This method deals with outlines and overflow.
660     IntRect absoluteClippedOverflowRect() const
661     {
662         return clippedOverflowRectForRepaint(0);
663     }
664     virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
665     virtual IntRect rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, int outlineWidth) const;
666
667     // Given a rect in the object's coordinate space, compute a rect suitable for repainting
668     // that rect in view coordinates.
669     void computeAbsoluteRepaintRect(IntRect& r, bool fixed = false) const
670     {
671         return computeRectForRepaint(0, r, fixed);
672     }
673     // Given a rect in the object's coordinate space, compute a rect suitable for repainting
674     // that rect in the coordinate space of repaintContainer.
675     virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect&, bool fixed = false) const;
676
677     // If multiple-column layout results in applying an offset to the given point, add the same
678     // offset to the given size.
679     virtual void adjustForColumns(LayoutSize&, const LayoutPoint&) const { }
680
681     virtual unsigned int length() const { return 1; }
682
683     bool isFloatingOrPositioned() const { return (isFloating() || isPositioned()); }
684
685     bool isTransparent() const { return style()->opacity() < 1.0f; }
686     float opacity() const { return style()->opacity(); }
687
688     bool hasReflection() const { return m_hasReflection; }
689
690     // Applied as a "slop" to dirty rect checks during the outline painting phase's dirty-rect checks.
691     int maximalOutlineSize(PaintPhase) const;
692
693     void setHasMarkupTruncation(bool b = true) { m_hasMarkupTruncation = b; }
694     bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
695
696     enum SelectionState {
697         SelectionNone, // The object is not selected.
698         SelectionStart, // The object either contains the start of a selection run or is the start of a run
699         SelectionInside, // The object is fully encompassed by a selection run
700         SelectionEnd, // The object either contains the end of a selection run or is the end of a run
701         SelectionBoth // The object contains an entire run or is the sole selected object in that run
702     };
703
704     // The current selection state for an object.  For blocks, the state refers to the state of the leaf
705     // descendants (as described above in the SelectionState enum declaration).
706     SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState);; }
707
708     // Sets the selection state for an object.
709     virtual void setSelectionState(SelectionState state) { m_selectionState = state; }
710
711     // A single rectangle that encompasses all of the selected objects within this object.  Used to determine the tightest
712     // possible bounding box for the selection.
713     LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
714     virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return LayoutRect(); }
715
716     // Whether or not an object can be part of the leaf elements of the selection.
717     virtual bool canBeSelectionLeaf() const { return false; }
718
719     // Whether or not a block has selected children.
720     bool hasSelectedChildren() const { return m_selectionState != SelectionNone; }
721
722     // Obtains the selection colors that should be used when painting a selection.
723     Color selectionBackgroundColor() const;
724     Color selectionForegroundColor() const;
725     Color selectionEmphasisMarkColor() const;
726
727     // Whether or not a given block needs to paint selection gaps.
728     virtual bool shouldPaintSelectionGaps() const { return false; }
729
730     /**
731      * Returns the local coordinates of the caret within this render object.
732      * @param caretOffset zero-based offset determining position within the render object.
733      * @param extraWidthToEndOfLine optional out arg to give extra width to end of line -
734      * useful for character range rect computations
735      */
736     virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
737
738     bool isMarginBeforeQuirk() const { return m_marginBeforeQuirk; }
739     bool isMarginAfterQuirk() const { return m_marginAfterQuirk; }
740     void setMarginBeforeQuirk(bool b = true) { m_marginBeforeQuirk = b; }
741     void setMarginAfterQuirk(bool b = true) { m_marginAfterQuirk = b; }
742
743     // When performing a global document tear-down, the renderer of the document is cleared.  We use this
744     // as a hook to detect the case of document destruction and don't waste time doing unnecessary work.
745     bool documentBeingDestroyed() const;
746
747     virtual void destroy();
748
749     // Virtual function helpers for the deprecated Flexible Box Layout (display: -webkit-box).
750     virtual bool isDeprecatedFlexibleBox() const { return false; }
751     virtual bool isFlexingChildren() const { return false; }
752     virtual bool isStretchingChildren() const { return false; }
753
754 #if ENABLE(CSS3_FLEXBOX)
755     // Virtual function helper for the new FlexibleBox Layout (display: -webkit-flexbox).
756     virtual bool isFlexibleBox() const { return false; }
757 #endif
758
759     bool isFlexibleBoxIncludingDeprecated() const
760     {
761 #if ENABLE(CSS3_FLEXBOX)
762         return isFlexibleBox() || isDeprecatedFlexibleBox();
763 #else
764         return isDeprecatedFlexibleBox();
765 #endif
766     }
767
768     virtual bool isCombineText() const { return false; }
769
770     virtual int caretMinOffset() const;
771     virtual int caretMaxOffset() const;
772     virtual unsigned caretMaxRenderedOffset() const;
773
774     virtual int previousOffset(int current) const;
775     virtual int previousOffsetForBackwardDeletion(int current) const;
776     virtual int nextOffset(int current) const;
777
778     virtual void imageChanged(CachedImage*, const IntRect* = 0);
779     virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) { }
780     virtual bool willRenderImage(CachedImage*);
781
782     void selectionStartEnd(int& spos, int& epos) const;
783     
784     void remove() { if (parent()) parent()->removeChild(this); }
785
786     AnimationController* animation() const;
787
788     bool visibleToHitTesting() const { return style()->visibility() == VISIBLE && style()->pointerEvents() != PE_NONE; }
789
790     // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use
791     // localToAbsolute/absoluteToLocal methods instead.
792     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
793     virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
794
795     bool shouldUseTransformFromContainer(const RenderObject* container) const;
796     void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const;
797     
798     virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint&) { };
799
800     IntRect absoluteOutlineBounds() const
801     {
802         return outlineBoundsForRepaint(0);
803     }
804
805 protected:
806     // Overrides should call the superclass at the end
807     virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
808     // Overrides should call the superclass at the start
809     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
810     void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
811
812     void drawLineForBoxSide(GraphicsContext*, int x1, int y1, int x2, int y2, BoxSide,
813                             Color, EBorderStyle, int adjbw1, int adjbw2, bool antialias = false);
814
815     void paintFocusRing(GraphicsContext*, const LayoutPoint&, RenderStyle*);
816     void paintOutline(GraphicsContext*, const LayoutRect&);
817     void addPDFURLRect(GraphicsContext*, const IntRect&);
818
819     virtual IntRect viewRect() const;
820
821     void adjustRectForOutlineAndShadow(IntRect&) const;
822
823     virtual void willBeDestroyed();
824     void arenaDelete(RenderArena*, void* objectBase);
825
826     virtual IntRect outlineBoundsForRepaint(RenderBoxModelObject* /*repaintContainer*/, IntPoint* /*cachedOffsetToRepaintContainer*/ = 0) const { return IntRect(); }
827
828 private:
829     RenderStyle* firstLineStyleSlowCase() const;
830     StyleDifference adjustStyleDifference(StyleDifference, unsigned contextSensitiveProperties) const;
831
832     Color selectionColor(int colorProperty) const;
833     
834     RefPtr<RenderStyle> m_style;
835
836     Node* m_node;
837
838     RenderObject* m_parent;
839     RenderObject* m_previous;
840     RenderObject* m_next;
841
842 #ifndef NDEBUG
843     bool m_hasAXObject;
844     bool m_setNeedsLayoutForbidden : 1;
845 #endif
846
847     // 32 bits have been used here. THERE ARE NO FREE BITS AVAILABLE.
848     bool m_needsLayout               : 1;
849     bool m_needsPositionedMovementLayout :1;
850     bool m_normalChildNeedsLayout    : 1;
851     bool m_posChildNeedsLayout       : 1;
852     bool m_needsSimplifiedNormalFlowLayout  : 1;
853     bool m_preferredLogicalWidthsDirty           : 1;
854     bool m_floating                  : 1;
855
856     bool m_positioned                : 1;
857     bool m_relPositioned             : 1;
858     bool m_paintBackground           : 1; // if the box has something to paint in the
859                                           // background painting phase (background, border, etc)
860
861     bool m_isAnonymous               : 1;
862     bool m_isText                    : 1;
863     bool m_isBox                     : 1;
864     bool m_inline                    : 1;
865     bool m_replaced                  : 1;
866     bool m_horizontalWritingMode : 1;
867     bool m_isDragging                : 1;
868
869     bool m_hasLayer                  : 1;
870     bool m_hasOverflowClip           : 1; // Set in the case of overflow:auto/scroll/hidden
871     bool m_hasTransform              : 1;
872     bool m_hasReflection             : 1;
873     
874 public:
875     bool m_hasCounterNodeMap         : 1;
876     bool m_everHadLayout             : 1;
877
878 private:
879     // These bitfields are moved here from subclasses to pack them together
880     // from RenderBlock
881     bool m_childrenInline : 1;
882     bool m_marginBeforeQuirk : 1;
883     bool m_marginAfterQuirk : 1;
884     bool m_hasMarkupTruncation : 1;
885     unsigned m_selectionState : 3; // SelectionState
886     bool m_hasColumns : 1;
887
888 private:
889     // Store state between styleWillChange and styleDidChange
890     static bool s_affectsParentBlock;
891 };
892
893 inline bool RenderObject::documentBeingDestroyed() const
894 {
895     return !document()->renderer();
896 }
897
898 inline bool RenderObject::isBeforeContent() const
899 {
900     if (style()->styleType() != BEFORE)
901         return false;
902     // Text nodes don't have their own styles, so ignore the style on a text node.
903     if (isText() && !isBR())
904         return false;
905     return true;
906 }
907
908 inline bool RenderObject::isAfterContent() const
909 {
910     if (style()->styleType() != AFTER)
911         return false;
912     // Text nodes don't have their own styles, so ignore the style on a text node.
913     if (isText() && !isBR())
914         return false;
915     return true;
916 }
917
918 inline bool RenderObject::isBeforeOrAfterContent() const
919 {
920     return isBeforeContent() || isAfterContent();
921 }
922
923 inline void RenderObject::setNeedsLayout(bool b, bool markParents)
924 {
925     bool alreadyNeededLayout = m_needsLayout;
926     m_needsLayout = b;
927     if (b) {
928         ASSERT(!isSetNeedsLayoutForbidden());
929         if (!alreadyNeededLayout) {
930             if (markParents)
931                 markContainingBlocksForLayout();
932             if (hasLayer())
933                 setLayerNeedsFullRepaint();
934         }
935     } else {
936         m_everHadLayout = true;
937         m_posChildNeedsLayout = false;
938         m_needsSimplifiedNormalFlowLayout = false;
939         m_normalChildNeedsLayout = false;
940         m_needsPositionedMovementLayout = false;
941     }
942 }
943
944 inline void RenderObject::setChildNeedsLayout(bool b, bool markParents)
945 {
946     bool alreadyNeededLayout = m_normalChildNeedsLayout;
947     m_normalChildNeedsLayout = b;
948     if (b) {
949         ASSERT(!isSetNeedsLayoutForbidden());
950         if (!alreadyNeededLayout && markParents)
951             markContainingBlocksForLayout();
952     } else {
953         m_posChildNeedsLayout = false;
954         m_needsSimplifiedNormalFlowLayout = false;
955         m_normalChildNeedsLayout = false;
956         m_needsPositionedMovementLayout = false;
957     }
958 }
959
960 inline void RenderObject::setNeedsPositionedMovementLayout()
961 {
962     bool alreadyNeededLayout = m_needsPositionedMovementLayout;
963     m_needsPositionedMovementLayout = true;
964     ASSERT(!isSetNeedsLayoutForbidden());
965     if (!alreadyNeededLayout) {
966         markContainingBlocksForLayout();
967         if (hasLayer())
968             setLayerNeedsFullRepaint();
969     }
970 }
971
972 inline void RenderObject::setNeedsSimplifiedNormalFlowLayout()
973 {
974     bool alreadyNeededLayout = m_needsSimplifiedNormalFlowLayout;
975     m_needsSimplifiedNormalFlowLayout = true;
976     ASSERT(!isSetNeedsLayoutForbidden());
977     if (!alreadyNeededLayout) {
978         markContainingBlocksForLayout();
979         if (hasLayer())
980             setLayerNeedsFullRepaint();
981     }
982 }
983
984 inline bool objectIsRelayoutBoundary(const RenderObject *obj) 
985 {
986     // FIXME: In future it may be possible to broaden this condition in order to improve performance.
987     // Table cells are excluded because even when their CSS height is fixed, their height()
988     // may depend on their contents.
989     return obj->isTextControl()
990         || (obj->hasOverflowClip() && !obj->style()->width().isIntrinsicOrAuto() && !obj->style()->height().isIntrinsicOrAuto() && !obj->style()->height().isPercent() && !obj->isTableCell())
991 #if ENABLE(SVG)
992            || obj->isSVGRoot()
993 #endif
994            ;
995 }
996
997 inline void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot)
998 {
999     ASSERT(!scheduleRelayout || !newRoot);
1000
1001     RenderObject* o = container();
1002     RenderObject* last = this;
1003
1004     bool simplifiedNormalFlowLayout = needsSimplifiedNormalFlowLayout() && !selfNeedsLayout() && !normalChildNeedsLayout();
1005
1006     while (o) {
1007         // Don't mark the outermost object of an unrooted subtree. That object will be 
1008         // marked when the subtree is added to the document.
1009         RenderObject* container = o->container();
1010         if (!container && !o->isRenderView())
1011             return;
1012         if (!last->isText() && (last->style()->position() == FixedPosition || last->style()->position() == AbsolutePosition)) {
1013             bool willSkipRelativelyPositionedInlines = !o->isRenderBlock();
1014             while (o && !o->isRenderBlock()) // Skip relatively positioned inlines and get to the enclosing RenderBlock.
1015                 o = o->container();
1016             if (!o || o->m_posChildNeedsLayout)
1017                 return;
1018             if (willSkipRelativelyPositionedInlines)
1019                 container = o->container();
1020             o->m_posChildNeedsLayout = true;
1021             simplifiedNormalFlowLayout = true;
1022             ASSERT(!o->isSetNeedsLayoutForbidden());
1023         } else if (simplifiedNormalFlowLayout) {
1024             if (o->m_needsSimplifiedNormalFlowLayout)
1025                 return;
1026             o->m_needsSimplifiedNormalFlowLayout = true;
1027             ASSERT(!o->isSetNeedsLayoutForbidden());
1028         } else {
1029             if (o->m_normalChildNeedsLayout)
1030                 return;
1031             o->m_normalChildNeedsLayout = true;
1032             ASSERT(!o->isSetNeedsLayoutForbidden());
1033         }
1034
1035         if (o == newRoot)
1036             return;
1037
1038         last = o;
1039         if (scheduleRelayout && objectIsRelayoutBoundary(last))
1040             break;
1041         o = container;
1042     }
1043
1044     if (scheduleRelayout)
1045         last->scheduleRelayout();
1046 }
1047
1048 inline bool RenderObject::preservesNewline() const
1049 {
1050 #if ENABLE(SVG)
1051     if (isSVGInlineText())
1052         return false;
1053 #endif
1054         
1055     return style()->preserveNewline();
1056 }
1057
1058 inline void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering)
1059 {
1060 #if !ENABLE(3D_RENDERING)
1061     UNUSED_PARAM(has3DRendering);
1062     matrix.makeAffine();
1063 #else
1064     if (!has3DRendering)
1065         matrix.makeAffine();
1066 #endif
1067 }
1068
1069 inline int adjustForAbsoluteZoom(int value, RenderObject* renderer)
1070 {
1071     return adjustForAbsoluteZoom(value, renderer->style());
1072 }
1073
1074 inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* renderer)
1075 {
1076     float zoom = renderer->style()->effectiveZoom();
1077     if (zoom != 1)
1078         quad.scale(1 / zoom, 1 / zoom);
1079 }
1080
1081 inline void adjustFloatRectForAbsoluteZoom(FloatRect& rect, RenderObject* renderer)
1082 {
1083     float zoom = renderer->style()->effectiveZoom();
1084     if (zoom != 1)
1085         rect.scale(1 / zoom, 1 / zoom);
1086 }
1087
1088 inline void adjustFloatQuadForPageScale(FloatQuad& quad, float pageScale)
1089 {
1090     if (pageScale != 1)
1091         quad.scale(1 / pageScale, 1 / pageScale);
1092 }
1093
1094 inline void adjustFloatRectForPageScale(FloatRect& rect, float pageScale)
1095 {
1096     if (pageScale != 1)
1097         rect.scale(1 / pageScale, 1 / pageScale);
1098 }
1099
1100 } // namespace WebCore
1101
1102 #ifndef NDEBUG
1103 // Outside the WebCore namespace for ease of invocation from gdb.
1104 void showTree(const WebCore::RenderObject*);
1105 void showLineTree(const WebCore::RenderObject*);
1106 void showRenderTree(const WebCore::RenderObject* object1);
1107 // We don't make object2 an optional parameter so that showRenderTree
1108 // can be called from gdb easily.
1109 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderObject* object2);
1110 #endif
1111
1112 #endif // RenderObject_h