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

Side by Side Diff: Source/core/rendering/svg/SVGInlineTextBox.cpp

Issue 356123002: Consolidate some text shadow code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rendererToUse -> renderer() Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/style/ShadowList.cpp ('k') | no next file » | 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) 2007 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 23 matching lines...) Expand all
34 #include "core/rendering/RenderInline.h" 34 #include "core/rendering/RenderInline.h"
35 #include "core/rendering/RenderTheme.h" 35 #include "core/rendering/RenderTheme.h"
36 #include "core/rendering/style/ShadowList.h" 36 #include "core/rendering/style/ShadowList.h"
37 #include "core/rendering/svg/RenderSVGInlineText.h" 37 #include "core/rendering/svg/RenderSVGInlineText.h"
38 #include "core/rendering/svg/RenderSVGResource.h" 38 #include "core/rendering/svg/RenderSVGResource.h"
39 #include "core/rendering/svg/RenderSVGResourceSolidColor.h" 39 #include "core/rendering/svg/RenderSVGResourceSolidColor.h"
40 #include "core/rendering/svg/SVGResourcesCache.h" 40 #include "core/rendering/svg/SVGResourcesCache.h"
41 #include "core/rendering/svg/SVGTextRunRenderingContext.h" 41 #include "core/rendering/svg/SVGTextRunRenderingContext.h"
42 #include "platform/FloatConversion.h" 42 #include "platform/FloatConversion.h"
43 #include "platform/fonts/FontCache.h" 43 #include "platform/fonts/FontCache.h"
44 #include "platform/graphics/DrawLooperBuilder.h"
45 #include "platform/graphics/GraphicsContextStateSaver.h" 44 #include "platform/graphics/GraphicsContextStateSaver.h"
46 45
47 namespace WebCore { 46 namespace WebCore {
48 47
49 struct ExpectedSVGInlineTextBoxSize : public InlineTextBox { 48 struct ExpectedSVGInlineTextBoxSize : public InlineTextBox {
50 float float1; 49 float float1;
51 uint32_t bitfields : 1; 50 uint32_t bitfields : 1;
52 void* pointer; 51 void* pointer;
53 Vector<SVGTextFragment> vector; 52 Vector<SVGTextFragment> vector;
54 }; 53 };
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 FloatPoint textOrigin(fragment.x, fragment.y); 625 FloatPoint textOrigin(fragment.x, fragment.y);
627 FloatSize textSize(fragment.width, fragment.height); 626 FloatSize textSize(fragment.width, fragment.height);
628 627
629 if (scalingFactor != 1) { 628 if (scalingFactor != 1) {
630 textOrigin.scale(scalingFactor, scalingFactor); 629 textOrigin.scale(scalingFactor, scalingFactor);
631 textSize.scale(scalingFactor); 630 textSize.scale(scalingFactor);
632 context->save(); 631 context->save();
633 context->scale(1 / scalingFactor, 1 / scalingFactor); 632 context->scale(1 / scalingFactor, 1 / scalingFactor);
634 } 633 }
635 634
636 if (hasShadow) { 635 if (hasShadow)
637 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create( ); 636 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S hadowRespectsAlpha));
638 for (size_t i = shadowList->shadows().size(); i--; ) {
639 const ShadowData& shadow = shadowList->shadows()[i];
640 FloatSize offset(shadow.x(), shadow.y());
641 drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(),
642 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder:: ShadowRespectsAlpha);
643 }
644 drawLooperBuilder->addUnmodifiedContent();
645 context->setDrawLooper(drawLooperBuilder.release());
646 }
647 637
648 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle, resourceMode)) { 638 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle, resourceMode)) {
649 TextRunPaintInfo textRunPaintInfo(textRun); 639 TextRunPaintInfo textRunPaintInfo(textRun);
650 textRunPaintInfo.from = startPosition; 640 textRunPaintInfo.from = startPosition;
651 textRunPaintInfo.to = endPosition; 641 textRunPaintInfo.to = endPosition;
652 textRunPaintInfo.bounds = FloatRect(textOrigin, textSize); 642 textRunPaintInfo.bounds = FloatRect(textOrigin, textSize);
653 scaledFont.drawText(context, textRunPaintInfo, textOrigin); 643 scaledFont.drawText(context, textRunPaintInfo, textOrigin);
654 restoreGraphicsContextAfterTextPainting(context, textRun, resourceMode); 644 restoreGraphicsContextAfterTextPainting(context, textRun, resourceMode);
655 } 645 }
656 646
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset)); 798 renderer().updateHitTestResult(result, locationInContainer.point () - toLayoutSize(accumulatedOffset));
809 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect)) 799 if (!result.addNodeToRectBasedTestResult(renderer().node(), requ est, locationInContainer, rect))
810 return true; 800 return true;
811 } 801 }
812 } 802 }
813 } 803 }
814 return false; 804 return false;
815 } 805 }
816 806
817 } // namespace WebCore 807 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/style/ShadowList.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698