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

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

Issue 23581008: Revert r154797: "Move isValid/isCurrentColor from Color to StyleColor" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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.alpha()) 209 if (!backgroundColor.isValid() || !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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ASSERT(!m_paintingResource); 361 ASSERT(!m_paintingResource);
362 } 362 }
363 363
364 bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, float scalingFactor, RenderObject* renderer, RenderStyle* style) 364 bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, float scalingFactor, RenderObject* renderer, RenderStyle* style)
365 { 365 {
366 ASSERT(scalingFactor); 366 ASSERT(scalingFactor);
367 ASSERT(renderer); 367 ASSERT(renderer);
368 ASSERT(style); 368 ASSERT(style);
369 ASSERT(m_paintingResourceMode != ApplyToDefaultMode); 369 ASSERT(m_paintingResourceMode != ApplyToDefaultMode);
370 370
371 StyleColor fallbackColor; 371 Color fallbackColor;
372 if (m_paintingResourceMode & ApplyToFillMode) 372 if (m_paintingResourceMode & ApplyToFillMode)
373 m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, s tyle, fallbackColor); 373 m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, s tyle, fallbackColor);
374 else if (m_paintingResourceMode & ApplyToStrokeMode) 374 else if (m_paintingResourceMode & ApplyToStrokeMode)
375 m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor); 375 m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style, fallbackColor);
376 else { 376 else {
377 // We're either called for stroking or filling. 377 // We're either called for stroking or filling.
378 ASSERT_NOT_REACHED(); 378 ASSERT_NOT_REACHED();
379 } 379 }
380 380
381 if (!m_paintingResource) 381 if (!m_paintingResource)
382 return false; 382 return false;
383 383
384 if (!m_paintingResource->applyResource(renderer, style, context, m_paintingR esourceMode)) { 384 if (!m_paintingResource->applyResource(renderer, style, context, m_paintingR esourceMode)) {
385 if (fallbackColor.isValid()) { 385 if (fallbackColor.isValid()) {
386 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource(); 386 RenderSVGResourceSolidColor* fallbackResource = RenderSVGResource::s haredSolidPaintingResource();
387 fallbackResource->setColor(fallbackColor.color()); 387 fallbackResource->setColor(fallbackColor);
388 388
389 m_paintingResource = fallbackResource; 389 m_paintingResource = fallbackResource;
390 m_paintingResource->applyResource(renderer, style, context, m_painti ngResourceMode); 390 m_paintingResource->applyResource(renderer, style, context, m_painti ngResourceMode);
391 } 391 }
392 } 392 }
393 393
394 if (scalingFactor != 1 && m_paintingResourceMode & ApplyToStrokeMode) 394 if (scalingFactor != 1 && m_paintingResourceMode & ApplyToStrokeMode)
395 context->setStrokeThickness(context->strokeThickness() * scalingFactor); 395 context->setStrokeThickness(context->strokeThickness() * scalingFactor);
396 396
397 return true; 397 return true;
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 textOrigin.scale(scalingFactor, scalingFactor); 634 textOrigin.scale(scalingFactor, scalingFactor);
635 textSize.scale(scalingFactor); 635 textSize.scale(scalingFactor);
636 context->save(); 636 context->save();
637 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor)); 637 context->scale(FloatSize(1 / scalingFactor, 1 / scalingFactor));
638 } 638 }
639 639
640 if (hasShadow) { 640 if (hasShadow) {
641 DrawLooper drawLooper; 641 DrawLooper drawLooper;
642 do { 642 do {
643 FloatSize offset(shadow->x(), shadow->y()); 643 FloatSize offset(shadow->x(), shadow->y());
644 drawLooper.addShadow(offset, shadow->blur(), textRenderer->resolveCo lor(shadow->color(), Color::stdShadowColor), 644 drawLooper.addShadow(offset, shadow->blur(), shadow->color(),
645 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowRespects Alpha); 645 DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowRespects Alpha);
646 } while ((shadow = shadow->next())); 646 } while ((shadow = shadow->next()));
647 drawLooper.addUnmodifiedContent(); 647 drawLooper.addUnmodifiedContent();
648 context->setDrawLooper(drawLooper); 648 context->setDrawLooper(drawLooper);
649 } 649 }
650 650
651 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle)) { 651 if (prepareGraphicsContextForTextPainting(context, scalingFactor, textRun, s tyle)) {
652 TextRunPaintInfo textRunPaintInfo(textRun); 652 TextRunPaintInfo textRunPaintInfo(textRun);
653 textRunPaintInfo.from = startPosition; 653 textRunPaintInfo.from = startPosition;
654 textRunPaintInfo.to = endPosition; 654 textRunPaintInfo.to = endPosition;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 renderer()->updateHitTestResult(result, locationInContainer.poin t() - toLayoutSize(accumulatedOffset)); 745 renderer()->updateHitTestResult(result, locationInContainer.poin t() - toLayoutSize(accumulatedOffset));
746 if (!result.addNodeToRectBasedTestResult(renderer()->node(), req uest, locationInContainer, rect)) 746 if (!result.addNodeToRectBasedTestResult(renderer()->node(), req uest, locationInContainer, rect))
747 return true; 747 return true;
748 } 748 }
749 } 749 }
750 } 750 }
751 return false; 751 return false;
752 } 752 }
753 753
754 } // namespace WebCore 754 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698