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

Side by Side Diff: Source/core/rendering/RenderImage.cpp

Issue 19697011: Change rendering code to use RenderObject::resolveColor (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
« no previous file with comments | « Source/core/rendering/RenderFrameSet.cpp ('k') | Source/core/rendering/RenderInline.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2006 Allan Sandfeld Jensen (kde@carewolf.com)
6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 6 * (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 9 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
10 * 10 *
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 LayoutPoint textRectOrigin = paintOffset; 339 LayoutPoint textRectOrigin = paintOffset;
340 textRectOrigin.move(leftBorder + leftPad + (paddingWidth / 2) - borderWidth, topBorder + topPad + (paddingHeight / 2) - borderWidth); 340 textRectOrigin.move(leftBorder + leftPad + (paddingWidth / 2) - borderWidth, topBorder + topPad + (paddingHeight / 2) - borderWidth);
341 LayoutPoint textOrigin(textRectOrigin.x(), textRectOrigin.y() + ascent); 341 LayoutPoint textOrigin(textRectOrigin.x(), textRectOrigin.y() + ascent);
342 342
343 // Only draw the alt text if it'll fit within the content box, 343 // Only draw the alt text if it'll fit within the content box,
344 // and only if it fits above the error image. 344 // and only if it fits above the error image.
345 TextRun textRun = RenderBlock::constructTextRun(this, font, text , style()); 345 TextRun textRun = RenderBlock::constructTextRun(this, font, text , style());
346 LayoutUnit textWidth = font.width(textRun); 346 LayoutUnit textWidth = font.width(textRun);
347 TextRunPaintInfo textRunPaintInfo(textRun); 347 TextRunPaintInfo textRunPaintInfo(textRun);
348 textRunPaintInfo.bounds = FloatRect(textRectOrigin, FloatSize(te xtWidth, fontMetrics.height())); 348 textRunPaintInfo.bounds = FloatRect(textRectOrigin, FloatSize(te xtWidth, fontMetrics.height()));
349 context->setFillColor(style()->visitedDependentColor(CSSProperty Color)); 349 context->setFillColor(resolveColor(CSSPropertyColor));
350 if (errorPictureDrawn) { 350 if (errorPictureDrawn) {
351 if (usableWidth >= textWidth && fontMetrics.height() <= imag eOffset.height()) 351 if (usableWidth >= textWidth && fontMetrics.height() <= imag eOffset.height())
352 context->drawText(font, textRunPaintInfo, textOrigin); 352 context->drawText(font, textRunPaintInfo, textOrigin);
353 } else if (usableWidth >= textWidth && usableHeight >= fontMetri cs.height()) 353 } else if (usableWidth >= textWidth && usableHeight >= fontMetri cs.height())
354 context->drawText(font, textRunPaintInfo, textOrigin); 354 context->drawText(font, textRunPaintInfo, textOrigin);
355 } 355 }
356 } 356 }
357 } else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) { 357 } else if (m_imageResource->hasImage() && cWidth > 0 && cHeight > 0) {
358 RefPtr<Image> img = m_imageResource->image(cWidth, cHeight); 358 RefPtr<Image> img = m_imageResource->image(cWidth, cHeight);
359 if (!img || img->isNull()) { 359 if (!img || img->isNull()) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 RenderStyle* areaElementStyle = areaElement->computedStyle(); 414 RenderStyle* areaElementStyle = areaElement->computedStyle();
415 unsigned short outlineWidth = areaElementStyle->outlineWidth(); 415 unsigned short outlineWidth = areaElementStyle->outlineWidth();
416 if (!outlineWidth) 416 if (!outlineWidth)
417 return; 417 return;
418 418
419 // FIXME: Clip path instead of context when Skia pathops is ready. 419 // FIXME: Clip path instead of context when Skia pathops is ready.
420 // https://crbug.com/251206 420 // https://crbug.com/251206
421 paintInfo.context->clip(absoluteContentBox()); 421 paintInfo.context->clip(absoluteContentBox());
422 paintInfo.context->drawFocusRing(path, outlineWidth, 422 paintInfo.context->drawFocusRing(path, outlineWidth,
423 areaElementStyle->outlineOffset(), 423 areaElementStyle->outlineOffset(),
424 areaElementStyle->visitedDependentColor(CSSPropertyOutlineColor)); 424 resolveColor(areaElementStyle, CSSPropertyOutlineColor));
425 } 425 }
426 426
427 void RenderImage::areaElementFocusChanged(HTMLAreaElement* areaElement) 427 void RenderImage::areaElementFocusChanged(HTMLAreaElement* areaElement)
428 { 428 {
429 ASSERT(areaElement->imageElement() == node()); 429 ASSERT(areaElement->imageElement() == node());
430 430
431 Path path = areaElement->computePath(this); 431 Path path = areaElement->computePath(this);
432 if (path.isEmpty()) 432 if (path.isEmpty())
433 return; 433 return;
434 434
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 return 0; 584 return 0;
585 585
586 CachedImage* cachedImage = m_imageResource->cachedImage(); 586 CachedImage* cachedImage = m_imageResource->cachedImage();
587 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( )) 587 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( ))
588 return static_cast<SVGImage*>(cachedImage->image())->embeddedContentBox( ); 588 return static_cast<SVGImage*>(cachedImage->image())->embeddedContentBox( );
589 589
590 return 0; 590 return 0;
591 } 591 }
592 592
593 } // namespace WebCore 593 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderFrameSet.cpp ('k') | Source/core/rendering/RenderInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698