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

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

Issue 20061003: Move isValid/isCurrentColor from Color to StyleColor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 ASSERT(parentRenderer); 199 ASSERT(parentRenderer);
200 ASSERT(!parentRenderer->document()->printing()); 200 ASSERT(!parentRenderer->document()->printing());
201 201
202 // Determine whether or not we're selected. 202 // Determine whether or not we're selected.
203 bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection; 203 bool paintSelectedTextOnly = paintInfo.phase == PaintPhaseSelection;
204 bool hasSelection = selectionState() != RenderObject::SelectionNone; 204 bool hasSelection = selectionState() != RenderObject::SelectionNone;
205 if (!hasSelection || paintSelectedTextOnly) 205 if (!hasSelection || paintSelectedTextOnly)
206 return; 206 return;
207 207
208 Color backgroundColor = renderer()->selectionBackgroundColor(); 208 Color backgroundColor = renderer()->selectionBackgroundColor();
209 if (!backgroundColor.isValid() || !backgroundColor.alpha()) 209 if (!backgroundColor.alpha())
210 return; 210 return;
211 211
212 RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer ()); 212 RenderSVGInlineText* textRenderer = toRenderSVGInlineText(this->textRenderer ());
213 ASSERT(textRenderer); 213 ASSERT(textRenderer);
214 if (!textShouldBePainted(textRenderer)) 214 if (!textShouldBePainted(textRenderer))
215 return; 215 return;
216 216
217 RenderStyle* style = parentRenderer->style(); 217 RenderStyle* style = parentRenderer->style();
218 ASSERT(style); 218 ASSERT(style);
219 219
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 ASSERT(!m_paintingResource); 348 ASSERT(!m_paintingResource);
349 } 349 }
350 350
351 bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, float scalingFactor, RenderObject* renderer, RenderStyle* style) 351 bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, float scalingFactor, RenderObject* renderer, RenderStyle* style)
352 { 352 {
353 ASSERT(scalingFactor); 353 ASSERT(scalingFactor);
354 ASSERT(renderer); 354 ASSERT(renderer);
355 ASSERT(style); 355 ASSERT(style);
356 ASSERT(m_paintingResourceMode != ApplyToDefaultMode); 356 ASSERT(m_paintingResourceMode != ApplyToDefaultMode);
357 357
358 Color fallbackColor; 358 StyleColor fallbackColor;
359 if (m_paintingResourceMode & ApplyToFillMode) 359 if (m_paintingResourceMode & ApplyToFillMode)
360 m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, s tyle, fallbackColor); 360 m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, s tyle, fallbackColor);
361 else if (m_paintingResourceMode & ApplyToStrokeMode) 361 else if (m_paintingResourceMode & ApplyToStrokeMode)
362 m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor); 362 m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor);
363 else { 363 else {
364 // We're either called for stroking or filling. 364 // We're either called for stroking or filling.
365 ASSERT_NOT_REACHED(); 365 ASSERT_NOT_REACHED();
366 } 366 }
367 367
368 if (!m_paintingResource) 368 if (!m_paintingResource)
369 return false; 369 return false;
370 370
371 if (!m_paintingResource->applyResource(renderer, style, context, m_paintingR esourceMode)) { 371 if (!m_paintingResource->applyResource(renderer, style, context, m_paintingR esourceMode)) {
372 if (fallbackColor.isValid()) { 372 if (fallbackColor.isValid()) {
373 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource(); 373 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource();
374 fallbackResource->setColor(fallbackColor); 374 fallbackResource->setColor(fallbackColor.color());
375 375
376 m_paintingResource = fallbackResource; 376 m_paintingResource = fallbackResource;
377 m_paintingResource->applyResource(renderer, style, context, m_painti ngResourceMode); 377 m_paintingResource->applyResource(renderer, style, context, m_painti ngResourceMode);
378 } 378 }
379 } 379 }
380 380
381 if (scalingFactor != 1 && m_paintingResourceMode & ApplyToStrokeMode) 381 if (scalingFactor != 1 && m_paintingResourceMode & ApplyToStrokeMode)
382 context->setStrokeThickness(context->strokeThickness() * scalingFactor); 382 context->setStrokeThickness(context->strokeThickness() * scalingFactor);
383 383
384 return true; 384 return true;
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 textOrigin.scale(scalingFactor, scalingFactor); 617 textOrigin.scale(scalingFactor, scalingFactor);
618 textSize.scale(scalingFactor); 618 textSize.scale(scalingFactor);
619 context->save(); 619 context->save();
620 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor)); 620 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor));
621 } 621 }
622 622
623 if (hasShadow) { 623 if (hasShadow) {
624 DrawLooper drawLooper; 624 DrawLooper drawLooper;
625 do { 625 do {
626 FloatSize offset(shadow->x(), shadow->y()); 626 FloatSize offset(shadow->x(), shadow->y());
627 drawLooper.addShadow(offset, shadow->blur(), shadow->color(), 627 drawLooper.addShadow(offset, shadow->blur(), textRenderer->resolveCo lor(shadow->color(), Color::stdShadowColor),
628 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowRespects Alpha); 628 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowRespects Alpha);
629 } while ((shadow = shadow->next())); 629 } while ((shadow = shadow->next()));
630 drawLooper.addUnmodifiedContent(); 630 drawLooper.addUnmodifiedContent();
631 context->setDrawLooper(drawLooper); 631 context->setDrawLooper(drawLooper);
632 } 632 }
633 633
634 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle)) { 634 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle)) {
635 TextRunPaintInfo textRunPaintInfo(textRun); 635 TextRunPaintInfo textRunPaintInfo(textRun);
636 textRunPaintInfo.from = startPosition; 636 textRunPaintInfo.from = startPosition;
637 textRunPaintInfo.to = endPosition; 637 textRunPaintInfo.to = endPosition;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 renderer()->updateHitTestResult(result, locationInContainer.poin t() - toLayoutSize(accumulatedOffset)); 728 renderer()->updateHitTestResult(result, locationInContainer.poin t() - toLayoutSize(accumulatedOffset));
729 if (!result.addNodeToRectBasedTestResult(renderer()->node(), req uest, locationInContainer, rect)) 729 if (!result.addNodeToRectBasedTestResult(renderer()->node(), req uest, locationInContainer, rect))
730 return true; 730 return true;
731 } 731 }
732 } 732 }
733 } 733 }
734 return false; 734 return false;
735 } 735 }
736 736
737 } // namespace WebCore 737 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698