Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All r ights reserved. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 | 339 |
| 340 #if !ENABLE(OILPAN) | 340 #if !ENABLE(OILPAN) |
| 341 // RenderObjects are allocated out of the rendering partition. | 341 // RenderObjects are allocated out of the rendering partition. |
| 342 void* operator new(size_t); | 342 void* operator new(size_t); |
| 343 void operator delete(void*); | 343 void operator delete(void*); |
| 344 #endif | 344 #endif |
| 345 | 345 |
| 346 public: | 346 public: |
| 347 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } | 347 bool isPseudoElement() const { return node() && node()->isPseudoElement(); } |
| 348 | 348 |
| 349 virtual bool isBoxModelObject() const { return false; } | 349 virtual bool isBoxModelObject() const { return false; } |
|
Daniel Bratell
2014/10/01 13:12:48
Move isBoxModelObject to the other meta checks.
| |
| 350 virtual bool isBR() const { return false; } | 350 bool isBR() const { return isOfType(RenderObjectBr); } |
| 351 virtual bool isCanvas() const { return false; } | 351 bool isCanvas() const { return isOfType(RenderObjectCanvas); } |
| 352 virtual bool isCounter() const { return false; } | 352 bool isCounter() const { return isOfType(RenderObjectCounter); } |
| 353 virtual bool isDetailsMarker() const { return false; } | 353 bool isDetailsMarker() const { return isOfType(RenderObjectDetailsMarker); } |
| 354 virtual bool isEmbeddedObject() const { return false; } | 354 bool isEmbeddedObject() const { return isOfType(RenderObjectEmbeddedObject); } |
| 355 virtual bool isFieldset() const { return false; } | 355 bool isFieldset() const { return isOfType(RenderObjectFieldset); } |
| 356 virtual bool isFileUploadControl() const { return false; } | 356 bool isFileUploadControl() const { return isOfType(RenderObjectFileUploadCon trol); } |
| 357 virtual bool isFrame() const { return false; } | 357 bool isFrame() const { return isOfType(RenderObjectFrame); } |
| 358 virtual bool isFrameSet() const { return false; } | 358 bool isFrameSet() const { return isOfType(RenderObjectFrameSet); } |
| 359 bool isListBox() const { return isOfType(RenderObjectListBox); } | |
| 360 bool isListItem() const { return isOfType(RenderObjectListItem); } | |
| 361 bool isListMarker() const { return isOfType(RenderObjectListMarker); } | |
| 362 bool isMarquee() const { return isOfType(RenderObjectMarquee); } | |
| 363 bool isMedia() const { return isOfType(RenderObjectMedia); } | |
| 364 bool isMenuList() const { return isOfType(RenderObjectMenuList); } | |
| 365 bool isMeter() const { return isOfType(RenderObjectMeter); } | |
| 366 bool isProgress() const { return isOfType(RenderObjectProgress); } | |
| 367 bool isQuote() const { return isOfType(RenderObjectQuote); } | |
| 368 bool isRenderButton() const { return isOfType(RenderObjectRenderButton); } | |
| 369 bool isRenderFullScreen() const { return isOfType(RenderObjectRenderFullScre en); } | |
| 370 bool isRenderFullScreenPlaceholder() const { return isOfType(RenderObjectRen derFullScreenPlaceholder); } | |
| 371 bool isRenderGrid() const { return isOfType(RenderObjectRenderGrid); } | |
| 372 bool isRenderIFrame() const { return isOfType(RenderObjectRenderIFrame); } | |
| 373 bool isRenderImage() const { return isOfType(RenderObjectRenderImage); } | |
| 374 bool isRenderMultiColumnSet() const { return isOfType(RenderObjectRenderMult iColumnSet); } | |
| 375 bool isRenderRegion() const { return isOfType(RenderObjectRenderRegion); } | |
| 376 bool isRenderScrollbarPart() const { return isOfType(RenderObjectRenderScrol lbarPart); } | |
| 377 bool isRenderTableCol() const { return isOfType(RenderObjectRenderTableCol); } | |
| 378 bool isRenderView() const { return isOfType(RenderObjectRenderView); } | |
| 379 bool isReplica() const { return isOfType(RenderObjectReplica); } | |
| 380 bool isRuby() const { return isOfType(RenderObjectRuby); } | |
| 381 bool isRubyBase() const { return isOfType(RenderObjectRubyBase); } | |
| 382 bool isRubyRun() const { return isOfType(RenderObjectRubyRun); } | |
| 383 bool isRubyText() const { return isOfType(RenderObjectRubyText); } | |
| 384 bool isSlider() const { return isOfType(RenderObjectSlider); } | |
| 385 bool isSliderThumb() const { return isOfType(RenderObjectSliderThumb); } | |
| 386 bool isTable() const { return isOfType(RenderObjectTable); } | |
| 387 bool isTableCaption() const { return isOfType(RenderObjectTableCaption); } | |
| 388 bool isTableCell() const { return isOfType(RenderObjectTableCell); } | |
| 389 bool isTableRow() const { return isOfType(RenderObjectTableRow); } | |
| 390 bool isTableSection() const { return isOfType(RenderObjectTableSection); } | |
| 391 bool isTextArea() const { return isOfType(RenderObjectTextArea); } | |
| 392 bool isTextControl() const { return isOfType(RenderObjectTextControl); } | |
| 393 bool isTextField() const { return isOfType(RenderObjectTextField); } | |
| 394 bool isVideo() const { return isOfType(RenderObjectVideo); } | |
| 395 bool isWidget() const { return isOfType(RenderObjectWidget); } | |
| 396 | |
| 359 virtual bool isImage() const { return false; } | 397 virtual bool isImage() const { return false; } |
| 398 | |
| 360 virtual bool isInlineBlockOrInlineTable() const { return false; } | 399 virtual bool isInlineBlockOrInlineTable() const { return false; } |
| 361 virtual bool isLayerModelObject() const { return false; } | 400 virtual bool isLayerModelObject() const { return false; } |
| 362 virtual bool isListBox() const { return false; } | |
| 363 virtual bool isListItem() const { return false; } | |
| 364 virtual bool isListMarker() const { return false; } | |
| 365 virtual bool isMarquee() const { return false; } | |
| 366 virtual bool isMedia() const { return false; } | |
| 367 virtual bool isMenuList() const { return false; } | |
| 368 virtual bool isMeter() const { return false; } | |
| 369 virtual bool isProgress() const { return false; } | |
| 370 virtual bool isQuote() const { return false; } | |
| 371 virtual bool isRenderBlock() const { return false; } | 401 virtual bool isRenderBlock() const { return false; } |
| 372 virtual bool isRenderBlockFlow() const { return false; } | 402 virtual bool isRenderBlockFlow() const { return false; } |
| 373 virtual bool isRenderButton() const { return false; } | |
| 374 virtual bool isRenderFlowThread() const { return false; } | 403 virtual bool isRenderFlowThread() const { return false; } |
| 375 virtual bool isRenderFullScreen() const { return false; } | |
| 376 virtual bool isRenderFullScreenPlaceholder() const { return false; } | |
| 377 virtual bool isRenderGrid() const { return false; } | |
| 378 virtual bool isRenderIFrame() const { return false; } | |
| 379 virtual bool isRenderImage() const { return false; } | |
| 380 virtual bool isRenderInline() const { return false; } | 404 virtual bool isRenderInline() const { return false; } |
| 381 virtual bool isRenderMultiColumnSet() const { return false; } | |
| 382 virtual bool isRenderPart() const { return false; } | 405 virtual bool isRenderPart() const { return false; } |
| 383 virtual bool isRenderRegion() const { return false; } | |
| 384 virtual bool isRenderScrollbarPart() const { return false; } | |
| 385 virtual bool isRenderTableCol() const { return false; } | |
| 386 virtual bool isRenderView() const { return false; } | |
| 387 virtual bool isReplica() const { return false; } | |
| 388 virtual bool isRuby() const { return false; } | |
| 389 virtual bool isRubyBase() const { return false; } | |
| 390 virtual bool isRubyRun() const { return false; } | |
| 391 virtual bool isRubyText() const { return false; } | |
| 392 virtual bool isSlider() const { return false; } | |
| 393 virtual bool isSliderThumb() const { return false; } | |
| 394 virtual bool isTable() const { return false; } | |
| 395 virtual bool isTableCaption() const { return false; } | |
| 396 virtual bool isTableCell() const { return false; } | |
| 397 virtual bool isTableRow() const { return false; } | |
| 398 virtual bool isTableSection() const { return false; } | |
| 399 virtual bool isTextArea() const { return false; } | |
| 400 virtual bool isTextControl() const { return false; } | |
| 401 virtual bool isTextField() const { return false; } | |
| 402 virtual bool isVideo() const { return false; } | |
| 403 virtual bool isWidget() const { return false; } | |
| 404 | 406 |
| 405 bool isDocumentElement() const { return document().documentElement() == m_no de; } | 407 bool isDocumentElement() const { return document().documentElement() == m_no de; } |
| 406 // isBody is called from RenderBox::styleWillChange and is thus quite hot. | 408 // isBody is called from RenderBox::styleWillChange and is thus quite hot. |
| 407 bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag ); } | 409 bool isBody() const { return node() && node()->hasTagName(HTMLNames::bodyTag ); } |
| 408 bool isHR() const; | 410 bool isHR() const; |
| 409 bool isLegend() const; | 411 bool isLegend() const; |
| 410 | 412 |
| 411 bool isTablePart() const { return isTableCell() || isRenderTableCol() || isT ableCaption() || isTableRow() || isTableSection(); } | 413 bool isTablePart() const { return isTableCell() || isRenderTableCol() || isT ableCaption() || isTableRow() || isTableSection(); } |
| 412 | 414 |
| 413 inline bool isBeforeContent() const; | 415 inline bool isBeforeContent() const; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 InsideInFlowThread = 2, | 451 InsideInFlowThread = 2, |
| 450 }; | 452 }; |
| 451 | 453 |
| 452 void setFlowThreadStateIncludingDescendants(FlowThreadState); | 454 void setFlowThreadStateIncludingDescendants(FlowThreadState); |
| 453 | 455 |
| 454 FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState (); } | 456 FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState (); } |
| 455 void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadSt ate(state); } | 457 void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadSt ate(state); } |
| 456 | 458 |
| 457 // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have | 459 // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have |
| 458 // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation. | 460 // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation. |
| 459 virtual bool isSVG() const { return false; } | 461 bool isSVG() const { return isOfType(RenderObjectSVG); } |
| 460 virtual bool isSVGRoot() const { return false; } | 462 bool isSVGRoot() const { return isOfType(RenderObjectSVGRoot); } |
| 461 virtual bool isSVGContainer() const { return false; } | 463 bool isSVGContainer() const { return isOfType(RenderObjectSVGContainer); } |
| 462 virtual bool isSVGTransformableContainer() const { return false; } | 464 bool isSVGTransformableContainer() const { return isOfType(RenderObjectSVGTr ansformableContainer); } |
| 463 virtual bool isSVGViewportContainer() const { return false; } | 465 bool isSVGViewportContainer() const { return isOfType(RenderObjectSVGViewpor tContainer); } |
| 464 virtual bool isSVGGradientStop() const { return false; } | 466 bool isSVGGradientStop() const { return isOfType(RenderObjectSVGGradientStop ); } |
| 465 virtual bool isSVGHiddenContainer() const { return false; } | 467 bool isSVGHiddenContainer() const { return isOfType(RenderObjectSVGHiddenCon tainer); } |
| 466 virtual bool isSVGShape() const { return false; } | 468 bool isSVGShape() const { return isOfType(RenderObjectSVGShape); } |
| 467 virtual bool isSVGText() const { return false; } | 469 bool isSVGText() const { return isOfType(RenderObjectSVGText); } |
| 468 virtual bool isSVGTextPath() const { return false; } | 470 bool isSVGTextPath() const { return isOfType(RenderObjectSVGTextPath); } |
| 469 virtual bool isSVGInline() const { return false; } | 471 bool isSVGInline() const { return isOfType(RenderObjectSVGInline); } |
| 470 virtual bool isSVGInlineText() const { return false; } | 472 bool isSVGInlineText() const { return isOfType(RenderObjectSVGInlineText); } |
| 471 virtual bool isSVGImage() const { return false; } | 473 bool isSVGImage() const { return isOfType(RenderObjectSVGImage); } |
| 472 virtual bool isSVGForeignObject() const { return false; } | 474 bool isSVGForeignObject() const { return isOfType(RenderObjectSVGForeignObje ct); } |
| 473 virtual bool isSVGResourceContainer() const { return false; } | 475 bool isSVGResourceContainer() const { return isOfType(RenderObjectSVGResourc eContainer); } |
| 474 virtual bool isSVGResourceFilter() const { return false; } | 476 bool isSVGResourceFilter() const { return isOfType(RenderObjectSVGResourceFi lter); } |
| 475 virtual bool isSVGResourceFilterPrimitive() const { return false; } | 477 bool isSVGResourceFilterPrimitive() const { return isOfType(RenderObjectSVGR esourceFilterPrimitive); } |
| 476 | 478 |
| 477 // FIXME: Those belong into a SVG specific base-class for all renderers (see above) | 479 // FIXME: Those belong into a SVG specific base-class for all renderers (see above) |
| 478 // Unfortunately we don't have such a class yet, because it's not possible f or all renderers | 480 // Unfortunately we don't have such a class yet, because it's not possible f or all renderers |
| 479 // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock in heritance for instance) | 481 // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock in heritance for instance) |
| 480 virtual void setNeedsTransformUpdate() { } | 482 virtual void setNeedsTransformUpdate() { } |
| 481 virtual void setNeedsBoundariesUpdate(); | 483 virtual void setNeedsBoundariesUpdate(); |
| 482 | 484 |
| 483 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width. | 485 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width. |
| 484 // This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox(). | 486 // This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox(). |
| 485 // NOTE: Markers are not specifically ignored here by SVG 1.1 spec, but we i gnore them | 487 // NOTE: Markers are not specifically ignored here by SVG 1.1 spec, but we i gnore them |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 } | 1071 } |
| 1070 | 1072 |
| 1071 bool supportsPaintInvalidationStateCachedOffsets() const { return !hasColumn s() && !hasTransform() && !hasReflection() && !style()->isFlippedBlocksWritingMo de(); } | 1073 bool supportsPaintInvalidationStateCachedOffsets() const { return !hasColumn s() && !hasTransform() && !hasReflection() && !style()->isFlippedBlocksWritingMo de(); } |
| 1072 | 1074 |
| 1073 void setNeedsOverflowRecalcAfterStyleChange(); | 1075 void setNeedsOverflowRecalcAfterStyleChange(); |
| 1074 void markContainingBlocksForOverflowRecalc(); | 1076 void markContainingBlocksForOverflowRecalc(); |
| 1075 | 1077 |
| 1076 virtual LayoutRect viewRect() const; | 1078 virtual LayoutRect viewRect() const; |
| 1077 | 1079 |
| 1078 protected: | 1080 protected: |
| 1081 enum RenderObjectType { | |
| 1082 RenderObjectBr, | |
| 1083 RenderObjectCanvas, | |
| 1084 RenderObjectFieldset, | |
| 1085 RenderObjectCounter, | |
| 1086 RenderObjectDetailsMarker, | |
| 1087 RenderObjectEmbeddedObject, | |
| 1088 RenderObjectFileUploadControl, | |
| 1089 RenderObjectFrame, | |
| 1090 RenderObjectFrameSet, | |
| 1091 RenderObjectListBox, | |
| 1092 RenderObjectListItem, | |
| 1093 RenderObjectListMarker, | |
| 1094 RenderObjectMarquee, | |
| 1095 RenderObjectMedia, | |
| 1096 RenderObjectMenuList, | |
| 1097 RenderObjectMeter, | |
| 1098 RenderObjectProgress, | |
| 1099 RenderObjectQuote, | |
| 1100 RenderObjectRenderButton, | |
| 1101 RenderObjectRenderFlowThread, | |
| 1102 RenderObjectRenderFullScreen, | |
| 1103 RenderObjectRenderFullScreenPlaceholder, | |
| 1104 RenderObjectRenderGrid, | |
| 1105 RenderObjectRenderIFrame, | |
| 1106 RenderObjectRenderImage, | |
| 1107 RenderObjectRenderInline, | |
| 1108 RenderObjectRenderMultiColumnSet, | |
| 1109 RenderObjectRenderPart, | |
| 1110 RenderObjectRenderRegion, | |
| 1111 RenderObjectRenderScrollbarPart, | |
| 1112 RenderObjectRenderTableCol, | |
| 1113 RenderObjectRenderView, | |
| 1114 RenderObjectReplica, | |
| 1115 RenderObjectRuby, | |
| 1116 RenderObjectRubyBase, | |
| 1117 RenderObjectRubyRun, | |
| 1118 RenderObjectRubyText, | |
| 1119 RenderObjectSlider, | |
| 1120 RenderObjectSliderThumb, | |
| 1121 RenderObjectTable, | |
| 1122 RenderObjectTableCaption, | |
| 1123 RenderObjectTableCell, | |
| 1124 RenderObjectTableRow, | |
| 1125 RenderObjectTableSection, | |
| 1126 RenderObjectTextArea, | |
| 1127 RenderObjectTextControl, | |
| 1128 RenderObjectTextField, | |
| 1129 RenderObjectVideo, | |
| 1130 RenderObjectWidget, | |
| 1131 | |
| 1132 RenderObjectSVG, /* Keep by itself? */ | |
|
Daniel Bratell
2014/10/01 07:49:46
Comment need to go. The question was whether isSVG
| |
| 1133 RenderObjectSVGRoot, | |
| 1134 RenderObjectSVGContainer, | |
| 1135 RenderObjectSVGTransformableContainer, | |
| 1136 RenderObjectSVGViewportContainer, | |
| 1137 RenderObjectSVGHiddenContainer, | |
| 1138 RenderObjectSVGGradientStop, | |
| 1139 RenderObjectSVGShape, | |
| 1140 RenderObjectSVGText, | |
| 1141 RenderObjectSVGTextPath, | |
| 1142 RenderObjectSVGInline, | |
| 1143 RenderObjectSVGInlineText, | |
| 1144 RenderObjectSVGImage, | |
| 1145 RenderObjectSVGForeignObject, | |
| 1146 RenderObjectSVGResourceContainer, | |
| 1147 RenderObjectSVGResourceFilter, | |
| 1148 RenderObjectSVGResourceFilterPrimitive, | |
| 1149 }; | |
| 1150 virtual bool isOfType(RenderObjectType type) const { return false; } | |
| 1151 | |
| 1079 inline bool layerCreationAllowedForSubtree() const; | 1152 inline bool layerCreationAllowedForSubtree() const; |
| 1080 | 1153 |
| 1081 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time | 1154 // Overrides should call the superclass at the end. m_style will be 0 the fi rst time |
| 1082 // this function will be called. | 1155 // this function will be called. |
| 1083 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle); | 1156 virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle); |
| 1084 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first | 1157 // Overrides should call the superclass at the start. |oldStyle| will be 0 t he first |
| 1085 // time this function is called. | 1158 // time this function is called. |
| 1086 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | 1159 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); |
| 1087 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); | 1160 void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false); |
| 1088 virtual void updateAnonymousChildStyle(const RenderObject* child, RenderStyl e* style) const { } | 1161 virtual void updateAnonymousChildStyle(const RenderObject* child, RenderStyl e* style) const { } |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1555 void showTree(const blink::RenderObject*); | 1628 void showTree(const blink::RenderObject*); |
| 1556 void showLineTree(const blink::RenderObject*); | 1629 void showLineTree(const blink::RenderObject*); |
| 1557 void showRenderTree(const blink::RenderObject* object1); | 1630 void showRenderTree(const blink::RenderObject* object1); |
| 1558 // We don't make object2 an optional parameter so that showRenderTree | 1631 // We don't make object2 an optional parameter so that showRenderTree |
| 1559 // can be called from gdb easily. | 1632 // can be called from gdb easily. |
| 1560 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2); | 1633 void showRenderTree(const blink::RenderObject* object1, const blink::RenderObjec t* object2); |
| 1561 | 1634 |
| 1562 #endif | 1635 #endif |
| 1563 | 1636 |
| 1564 #endif // RenderObject_h | 1637 #endif // RenderObject_h |
| OLD | NEW |