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

Side by Side Diff: Source/core/rendering/style/SVGRenderStyle.h

Issue 22482004: Add support for the object-fit CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase for landing Created 7 years, 4 months 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
« no previous file with comments | « Source/core/page/UseCounter.cpp ('k') | Source/core/rendering/style/SVGRenderStyle.cpp » ('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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 2004, 2005 Rob Buis <buis@kde.org> 3 2004, 2005 Rob Buis <buis@kde.org>
4 Copyright (C) 2005, 2006 Apple Computer, Inc. 4 Copyright (C) 2005, 2006 Apple Computer, Inc.
5 Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 Copyright (C) Research In Motion Limited 2010. 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static float initialFloodOpacity() { return 1; } 86 static float initialFloodOpacity() { return 1; }
87 static Color initialFloodColor() { return Color(0, 0, 0); } 87 static Color initialFloodColor() { return Color(0, 0, 0); }
88 static Color initialLightingColor() { return Color(255, 255, 255); } 88 static Color initialLightingColor() { return Color(255, 255, 255); }
89 static String initialClipperResource() { return String(); } 89 static String initialClipperResource() { return String(); }
90 static String initialFilterResource() { return String(); } 90 static String initialFilterResource() { return String(); }
91 static String initialMaskerResource() { return String(); } 91 static String initialMaskerResource() { return String(); }
92 static String initialMarkerStartResource() { return String(); } 92 static String initialMarkerStartResource() { return String(); }
93 static String initialMarkerMidResource() { return String(); } 93 static String initialMarkerMidResource() { return String(); }
94 static String initialMarkerEndResource() { return String(); } 94 static String initialMarkerEndResource() { return String(); }
95 static EMaskType initialMaskType() { return MT_LUMINANCE; } 95 static EMaskType initialMaskType() { return MT_LUMINANCE; }
96 static EPaintOrder initialPaintOrder() { return PO_NORMAL; }
96 97
97 static SVGLength initialBaselineShiftValue() 98 static SVGLength initialBaselineShiftValue()
98 { 99 {
99 SVGLength length; 100 SVGLength length;
100 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION); 101 length.newValueSpecifiedUnits(LengthTypeNumber, 0, ASSERT_NO_EXCEPTION);
101 return length; 102 return length;
102 } 103 }
103 104
104 static SVGLength initialKerning() 105 static SVGLength initialKerning()
105 { 106 {
(...skipping 28 matching lines...) Expand all
134 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; } 135 void setColorInterpolationFilters(EColorInterpolation val) { svg_inherited_f lags._colorInterpolationFilters = val; }
135 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; } 136 void setColorRendering(EColorRendering val) { svg_inherited_flags._colorRend ering = val; }
136 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; } 137 void setFillRule(WindRule val) { svg_inherited_flags._fillRule = val; }
137 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; } 138 void setJoinStyle(LineJoin val) { svg_inherited_flags._joinStyle = val; }
138 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; } 139 void setShapeRendering(EShapeRendering val) { svg_inherited_flags._shapeRend ering = val; }
139 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; } 140 void setTextAnchor(ETextAnchor val) { svg_inherited_flags._textAnchor = val; }
140 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; } 141 void setWritingMode(SVGWritingMode val) { svg_inherited_flags._writingMode = val; }
141 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; } 142 void setGlyphOrientationHorizontal(EGlyphOrientation val) { svg_inherited_fl ags._glyphOrientationHorizontal = val; }
142 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; } 143 void setGlyphOrientationVertical(EGlyphOrientation val) { svg_inherited_flag s._glyphOrientationVertical = val; }
143 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; } 144 void setMaskType(EMaskType val) { svg_noninherited_flags.f.maskType = val; }
145 void setPaintOrder(EPaintOrder val) { svg_inherited_flags._paintOrder = (int )val; }
144 146
145 void setFillOpacity(float obj) 147 void setFillOpacity(float obj)
146 { 148 {
147 if (!(fill->opacity == obj)) 149 if (!(fill->opacity == obj))
148 fill.access()->opacity = obj; 150 fill.access()->opacity = obj;
149 } 151 }
150 152
151 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str ing& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false) 153 void setFillPaint(SVGPaint::SVGPaintType type, const Color& color, const Str ing& uri, bool applyToRegularStyle = true, bool applyToVisitedLinkStyle = false)
152 { 154 {
153 if (applyToRegularStyle) { 155 if (applyToRegularStyle) {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 const Color& floodColor() const { return misc->floodColor; } 337 const Color& floodColor() const { return misc->floodColor; }
336 const Color& lightingColor() const { return misc->lightingColor; } 338 const Color& lightingColor() const { return misc->lightingColor; }
337 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } 339 SVGLength baselineShiftValue() const { return misc->baselineShiftValue; }
338 String clipperResource() const { return resources->clipper; } 340 String clipperResource() const { return resources->clipper; }
339 String filterResource() const { return resources->filter; } 341 String filterResource() const { return resources->filter; }
340 String maskerResource() const { return resources->masker; } 342 String maskerResource() const { return resources->masker; }
341 String markerStartResource() const { return inheritedResources->markerStart; } 343 String markerStartResource() const { return inheritedResources->markerStart; }
342 String markerMidResource() const { return inheritedResources->markerMid; } 344 String markerMidResource() const { return inheritedResources->markerMid; }
343 String markerEndResource() const { return inheritedResources->markerEnd; } 345 String markerEndResource() const { return inheritedResources->markerEnd; }
344 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; } 346 EMaskType maskType() const { return (EMaskType) svg_noninherited_flags.f.mas kType; }
347 EPaintOrder paintOrder() const { return (EPaintOrder) svg_inherited_flags._p aintOrder; }
348 EPaintOrderType paintOrderType(unsigned index) const;
345 349
346 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill ->visitedLinkPaintType; } 350 const SVGPaint::SVGPaintType& visitedLinkFillPaintType() const { return fill ->visitedLinkPaintType; }
347 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; } 351 const Color& visitedLinkFillPaintColor() const { return fill->visitedLinkPai ntColor; }
348 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; } 352 const String& visitedLinkFillPaintUri() const { return fill->visitedLinkPain tUri; }
349 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st roke->visitedLinkPaintType; } 353 const SVGPaint::SVGPaintType& visitedLinkStrokePaintType() const { return st roke->visitedLinkPaintType; }
350 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; } 354 const Color& visitedLinkStrokePaintColor() const { return stroke->visitedLin kPaintColor; }
351 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; } 355 const String& visitedLinkStrokePaintUri() const { return stroke->visitedLink PaintUri; }
352 356
353 // convenience 357 // convenience
354 bool hasClipper() const { return !clipperResource().isEmpty(); } 358 bool hasClipper() const { return !clipperResource().isEmpty(); }
(...skipping 14 matching lines...) Expand all
369 && (_shapeRendering == other._shapeRendering) 373 && (_shapeRendering == other._shapeRendering)
370 && (_clipRule == other._clipRule) 374 && (_clipRule == other._clipRule)
371 && (_fillRule == other._fillRule) 375 && (_fillRule == other._fillRule)
372 && (_capStyle == other._capStyle) 376 && (_capStyle == other._capStyle)
373 && (_joinStyle == other._joinStyle) 377 && (_joinStyle == other._joinStyle)
374 && (_textAnchor == other._textAnchor) 378 && (_textAnchor == other._textAnchor)
375 && (_colorInterpolation == other._colorInterpolation) 379 && (_colorInterpolation == other._colorInterpolation)
376 && (_colorInterpolationFilters == other._colorInterpolationFilte rs) 380 && (_colorInterpolationFilters == other._colorInterpolationFilte rs)
377 && (_writingMode == other._writingMode) 381 && (_writingMode == other._writingMode)
378 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal) 382 && (_glyphOrientationHorizontal == other._glyphOrientationHorizo ntal)
379 && (_glyphOrientationVertical == other._glyphOrientationVertical ); 383 && (_glyphOrientationVertical == other._glyphOrientationVertical )
384 && (_paintOrder == other._paintOrder);
380 } 385 }
381 386
382 bool operator!=(const InheritedFlags& other) const 387 bool operator!=(const InheritedFlags& other) const
383 { 388 {
384 return !(*this == other); 389 return !(*this == other);
385 } 390 }
386 391
387 unsigned _colorRendering : 2; // EColorRendering 392 unsigned _colorRendering : 2; // EColorRendering
388 unsigned _shapeRendering : 2; // EShapeRendering 393 unsigned _shapeRendering : 2; // EShapeRendering
389 unsigned _clipRule : 1; // WindRule 394 unsigned _clipRule : 1; // WindRule
390 unsigned _fillRule : 1; // WindRule 395 unsigned _fillRule : 1; // WindRule
391 unsigned _capStyle : 2; // LineCap 396 unsigned _capStyle : 2; // LineCap
392 unsigned _joinStyle : 2; // LineJoin 397 unsigned _joinStyle : 2; // LineJoin
393 unsigned _textAnchor : 2; // ETextAnchor 398 unsigned _textAnchor : 2; // ETextAnchor
394 unsigned _colorInterpolation : 2; // EColorInterpolation 399 unsigned _colorInterpolation : 2; // EColorInterpolation
395 unsigned _colorInterpolationFilters : 2; // EColorInterpolation 400 unsigned _colorInterpolationFilters : 2; // EColorInterpolation
396 unsigned _writingMode : 3; // SVGWritingMode 401 unsigned _writingMode : 3; // SVGWritingMode
397 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation 402 unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation
398 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation 403 unsigned _glyphOrientationVertical : 3; // EGlyphOrientation
404 unsigned _paintOrder : 6; // EPaintOrder
399 } svg_inherited_flags; 405 } svg_inherited_flags;
400 406
401 // don't inherit 407 // don't inherit
402 struct NonInheritedFlags { 408 struct NonInheritedFlags {
403 // 32 bit non-inherited, don't add to the struct, or the operator will b reak. 409 // 32 bit non-inherited, don't add to the struct, or the operator will b reak.
404 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; } 410 bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; }
405 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; } 411 bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; }
406 412
407 union { 413 union {
408 struct { 414 struct {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 svg_inherited_flags._fillRule = initialFillRule(); 449 svg_inherited_flags._fillRule = initialFillRule();
444 svg_inherited_flags._shapeRendering = initialShapeRendering(); 450 svg_inherited_flags._shapeRendering = initialShapeRendering();
445 svg_inherited_flags._textAnchor = initialTextAnchor(); 451 svg_inherited_flags._textAnchor = initialTextAnchor();
446 svg_inherited_flags._capStyle = initialCapStyle(); 452 svg_inherited_flags._capStyle = initialCapStyle();
447 svg_inherited_flags._joinStyle = initialJoinStyle(); 453 svg_inherited_flags._joinStyle = initialJoinStyle();
448 svg_inherited_flags._colorInterpolation = initialColorInterpolation(); 454 svg_inherited_flags._colorInterpolation = initialColorInterpolation();
449 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters(); 455 svg_inherited_flags._colorInterpolationFilters = initialColorInterpolati onFilters();
450 svg_inherited_flags._writingMode = initialWritingMode(); 456 svg_inherited_flags._writingMode = initialWritingMode();
451 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal(); 457 svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientatio nHorizontal();
452 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical(); 458 svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationV ertical();
459 svg_inherited_flags._paintOrder = initialPaintOrder();
453 460
454 svg_noninherited_flags._niflags = 0; 461 svg_noninherited_flags._niflags = 0;
455 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ; 462 svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline() ;
456 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); 463 svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline();
457 svg_noninherited_flags.f._baselineShift = initialBaselineShift(); 464 svg_noninherited_flags.f._baselineShift = initialBaselineShift();
458 svg_noninherited_flags.f._vectorEffect = initialVectorEffect(); 465 svg_noninherited_flags.f._vectorEffect = initialVectorEffect();
459 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering(); 466 svg_noninherited_flags.f.bufferedRendering = initialBufferedRendering();
460 svg_noninherited_flags.f.maskType = initialMaskType(); 467 svg_noninherited_flags.f.maskType = initialMaskType();
461 } 468 }
462 }; 469 };
463 470
464 } // namespace WebCore 471 } // namespace WebCore
465 472
466 #endif // SVGRenderStyle_h 473 #endif // SVGRenderStyle_h
OLDNEW
« no previous file with comments | « Source/core/page/UseCounter.cpp ('k') | Source/core/rendering/style/SVGRenderStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698