Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/core/rendering/RenderObject.h

Issue 112633004: Use a bitmask for SVG render object types (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor cleanups Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGContainer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 NotInsideFlowThread = 0, 420 NotInsideFlowThread = 0,
421 InsideOutOfFlowThread = 1, 421 InsideOutOfFlowThread = 1,
422 InsideInFlowThread = 2, 422 InsideInFlowThread = 2,
423 }; 423 };
424 424
425 void setFlowThreadStateIncludingDescendants(FlowThreadState); 425 void setFlowThreadStateIncludingDescendants(FlowThreadState);
426 426
427 FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState (); } 427 FlowThreadState flowThreadState() const { return m_bitfields.flowThreadState (); }
428 void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadSt ate(state); } 428 void setFlowThreadState(FlowThreadState state) { m_bitfields.setFlowThreadSt ate(state); }
429 429
430 // FIXME: Until all SVG renders can be subclasses of RenderSVGModelObject we have 430 // FIXME: Until all SVG renderers are subclasses of RenderSVGModelObject, we have to
431 // to add SVG renderer methods to RenderObject with an ASSERT_NOT_REACHED() default implementation. 431 // maintain this parallel type system in RenderObject.
432 virtual bool isSVGRoot() const { return false; } 432 // Note: All updates to the SVG renderer hierarchy must update the enum belo w.
433 virtual bool isSVGContainer() const { return false; } 433 enum SVGType {
434 virtual bool isSVGTransformableContainer() const { return false; } 434 IsNotSVG = 0,
435 virtual bool isSVGViewportContainer() const { return false; } 435 IsSVGRoot = 1,
436 virtual bool isSVGGradientStop() const { return false; } 436 IsSVGContainer = 1 << 1,
437 virtual bool isSVGHiddenContainer() const { return false; } 437 IsSVGTransformableContainer = 1 << 2 | IsSVGContainer,
438 virtual bool isSVGPath() const { return false; } 438 IsSVGViewportContainer = 1 << 3 | IsSVGContainer,
439 virtual bool isSVGShape() const { return false; } 439 IsSVGGradientStop = 1 << 4,
440 virtual bool isSVGText() const { return false; } 440 IsSVGHiddenContainer = 1 << 5 | IsSVGContainer,
441 virtual bool isSVGTextPath() const { return false; } 441 IsSVGShape = 1 << 6,
442 virtual bool isSVGInline() const { return false; } 442 IsSVGPath = 1 << 7 | IsSVGShape,
443 virtual bool isSVGInlineText() const { return false; } 443 IsSVGText = 1 << 8,
444 virtual bool isSVGImage() const { return false; } 444 IsSVGInline = 1 << 9,
445 virtual bool isSVGForeignObject() const { return false; } 445 IsSVGTextPath = 1 << 10 | IsSVGInline,
446 virtual bool isSVGResourceContainer() const { return false; } 446 IsSVGInlineText = 1 << 11,
447 virtual bool isSVGResourceFilter() const { return false; } 447 IsSVGImage = 1 << 12,
448 virtual bool isSVGResourceFilterPrimitive() const { return false; } 448 IsSVGForeignObject = 1 << 13,
449 IsSVGResourceContainer = 1 << 14 | IsSVGHiddenContainer,
450 IsSVGResourceFilter = 1 << 15 | IsSVGResourceContainer,
451 IsSVGResourceFilterPrimitive = 1 << 16 | IsSVGHiddenContainer
452 };
453 bool hasSVGType(SVGType mask) const { return mask == (mask & getSVGType()); }
454 bool isSVG() const { return getSVGType(); }
455 bool isSVGRoot() const { return hasSVGType(IsSVGRoot); }
456 bool isSVGContainer() const { return hasSVGType(IsSVGContainer); }
457 bool isSVGTransformableContainer() const { return hasSVGType(IsSVGTransforma bleContainer); }
458 bool isSVGViewportContainer() const { return hasSVGType(IsSVGViewportContain er); }
459 bool isSVGGradientStop() const { return hasSVGType(IsSVGGradientStop); }
460 bool isSVGHiddenContainer() const { return hasSVGType(IsSVGHiddenContainer); }
461 bool isSVGPath() const { return hasSVGType(IsSVGPath); }
462 bool isSVGShape() const { return hasSVGType(IsSVGShape); }
463 bool isSVGText() const { return hasSVGType(IsSVGText); }
464 bool isSVGTextPath() const { return hasSVGType(IsSVGTextPath); }
465 bool isSVGInline() const { return hasSVGType(IsSVGInline); }
466 bool isSVGInlineText() const { return hasSVGType(IsSVGInlineText); }
467 bool isSVGImage() const { return hasSVGType(IsSVGImage); }
468 bool isSVGForeignObject() const { return hasSVGType(IsSVGForeignObject); }
469 bool isSVGResourceContainer() const { return hasSVGType(IsSVGResourceContain er); }
470 bool isSVGResourceFilter() const { return hasSVGType(IsSVGResourceFilter); }
471 bool isSVGResourceFilterPrimitive() const { return hasSVGType(IsSVGResourceF ilterPrimitive); }
449 472
450 // FIXME: Those belong into a SVG specific base-class for all renderers (see above) 473 // FIXME: Those belong into a SVG specific base-class for all renderers (see above)
451 // Unfortunately we don't have such a class yet, because it's not possible f or all renderers 474 // Unfortunately we don't have such a class yet, because it's not possible f or all renderers
452 // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock in heritance for instance) 475 // to inherit from RenderSVGObject -> RenderObject (some need RenderBlock in heritance for instance)
453 virtual void setNeedsTransformUpdate() { } 476 virtual void setNeedsTransformUpdate() { }
454 virtual void setNeedsBoundariesUpdate(); 477 virtual void setNeedsBoundariesUpdate();
455 virtual bool needsBoundariesUpdate() { return false; } 478 virtual bool needsBoundariesUpdate() { return false; }
456 479
457 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width. 480 // Per SVG 1.1 objectBoundingBox ignores clipping, masking, filter effects, opacity and stroke-width.
458 // This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox(). 481 // This is used for all computation of objectBoundingBox relative units and by SVGLocatable::getBBox().
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 // container, so callers should provide only the offset of the container wit hin it's layer. 1072 // container, so callers should provide only the offset of the container wit hin it's layer.
1050 // containerRect is a rect that has already been added for the currentLayer which is likely to 1073 // containerRect is a rect that has already been added for the currentLayer which is likely to
1051 // be a container for child elements. Any rect wholly contained by container Rect can be 1074 // be a container for child elements. Any rect wholly contained by container Rect can be
1052 // skipped. 1075 // skipped.
1053 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons t; 1076 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur rentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) cons t;
1054 1077
1055 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset 1078 // Add hit-test rects for this renderer only to the provided list. layerOffs et is the offset
1056 // of this renderer within the current layer that should be used for each re sult. 1079 // of this renderer within the current layer that should be used for each re sult.
1057 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { }; 1080 virtual void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const { };
1058 1081
1082 virtual SVGType getSVGType() const { return IsNotSVG; }
1083
1059 private: 1084 private:
1060 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* repaint Container = 0, bool* repaintContainerSkipped = 0) const; 1085 RenderBlock* containerForFixedPosition(const RenderLayerModelObject* repaint Container = 0, bool* repaintContainerSkipped = 0) const;
1061 1086
1062 RenderFlowThread* locateFlowThreadContainingBlock() const; 1087 RenderFlowThread* locateFlowThreadContainingBlock() const;
1063 void removeFromRenderFlowThread(); 1088 void removeFromRenderFlowThread();
1064 void removeFromRenderFlowThreadRecursive(RenderFlowThread*); 1089 void removeFromRenderFlowThreadRecursive(RenderFlowThread*);
1065 1090
1066 bool shouldRepaintForStyleDifference(StyleDifference) const; 1091 bool shouldRepaintForStyleDifference(StyleDifference) const;
1067 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const; 1092 bool hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const;
1068 1093
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 void showTree(const WebCore::RenderObject*); 1447 void showTree(const WebCore::RenderObject*);
1423 void showLineTree(const WebCore::RenderObject*); 1448 void showLineTree(const WebCore::RenderObject*);
1424 void showRenderTree(const WebCore::RenderObject* object1); 1449 void showRenderTree(const WebCore::RenderObject* object1);
1425 // We don't make object2 an optional parameter so that showRenderTree 1450 // We don't make object2 an optional parameter so that showRenderTree
1426 // can be called from gdb easily. 1451 // can be called from gdb easily.
1427 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2); 1452 void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderO bject* object2);
1428 1453
1429 #endif 1454 #endif
1430 1455
1431 #endif // RenderObject_h 1456 #endif // RenderObject_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/svg/RenderSVGContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698