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

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

Issue 27030014: Remove Backslash-as-JPY hack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: TextCodec/Encoding added Created 7 years, 2 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/HitTestResult.cpp ('k') | Source/core/rendering/RenderText.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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 centerX = 0; 341 centerX = 0;
342 LayoutUnit centerY = (usableHeight - imageSize.height()) / 2; 342 LayoutUnit centerY = (usableHeight - imageSize.height()) / 2;
343 if (centerY < 0) 343 if (centerY < 0)
344 centerY = 0; 344 centerY = 0;
345 imageOffset = LayoutSize(leftBorder + leftPad + centerX + border Width, topBorder + topPad + centerY + borderWidth); 345 imageOffset = LayoutSize(leftBorder + leftPad + centerX + border Width, topBorder + topPad + centerY + borderWidth);
346 context->drawImage(image.get(), pixelSnappedIntRect(LayoutRect(p aintOffset + imageOffset, imageSize)), CompositeSourceOver, shouldRespectImageOr ientation()); 346 context->drawImage(image.get(), pixelSnappedIntRect(LayoutRect(p aintOffset + imageOffset, imageSize)), CompositeSourceOver, shouldRespectImageOr ientation());
347 errorPictureDrawn = true; 347 errorPictureDrawn = true;
348 } 348 }
349 349
350 if (!m_altText.isEmpty()) { 350 if (!m_altText.isEmpty()) {
351 String text = document().displayStringModifiedByEncoding(m_altTe xt);
352 const Font& font = style()->font(); 351 const Font& font = style()->font();
353 const FontMetrics& fontMetrics = font.fontMetrics(); 352 const FontMetrics& fontMetrics = font.fontMetrics();
354 LayoutUnit ascent = fontMetrics.ascent(); 353 LayoutUnit ascent = fontMetrics.ascent();
355 LayoutPoint textRectOrigin = paintOffset; 354 LayoutPoint textRectOrigin = paintOffset;
356 textRectOrigin.move(leftBorder + leftPad + (paddingWidth / 2) - borderWidth, topBorder + topPad + (paddingHeight / 2) - borderWidth); 355 textRectOrigin.move(leftBorder + leftPad + (paddingWidth / 2) - borderWidth, topBorder + topPad + (paddingHeight / 2) - borderWidth);
357 LayoutPoint textOrigin(textRectOrigin.x(), textRectOrigin.y() + ascent); 356 LayoutPoint textOrigin(textRectOrigin.x(), textRectOrigin.y() + ascent);
358 357
359 // Only draw the alt text if it'll fit within the content box, 358 // Only draw the alt text if it'll fit within the content box,
360 // and only if it fits above the error image. 359 // and only if it fits above the error image.
361 TextRun textRun = RenderBlock::constructTextRun(this, font, text , style()); 360 TextRun textRun = RenderBlock::constructTextRun(this, font, m_al tText, style());
362 LayoutUnit textWidth = font.width(textRun); 361 LayoutUnit textWidth = font.width(textRun);
363 TextRunPaintInfo textRunPaintInfo(textRun); 362 TextRunPaintInfo textRunPaintInfo(textRun);
364 textRunPaintInfo.bounds = FloatRect(textRectOrigin, FloatSize(te xtWidth, fontMetrics.height())); 363 textRunPaintInfo.bounds = FloatRect(textRectOrigin, FloatSize(te xtWidth, fontMetrics.height()));
365 context->setFillColor(resolveColor(CSSPropertyColor)); 364 context->setFillColor(resolveColor(CSSPropertyColor));
366 if (errorPictureDrawn) { 365 if (errorPictureDrawn) {
367 if (usableWidth >= textWidth && fontMetrics.height() <= imag eOffset.height()) 366 if (usableWidth >= textWidth && fontMetrics.height() <= imag eOffset.height())
368 context->drawText(font, textRunPaintInfo, textOrigin); 367 context->drawText(font, textRunPaintInfo, textOrigin);
369 } else if (usableWidth >= textWidth && usableHeight >= fontMetri cs.height()) 368 } else if (usableWidth >= textWidth && usableHeight >= fontMetri cs.height())
370 context->drawText(font, textRunPaintInfo, textOrigin); 369 context->drawText(font, textRunPaintInfo, textOrigin);
371 } 370 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return 0; 603 return 0;
605 604
606 ImageResource* cachedImage = m_imageResource->cachedImage(); 605 ImageResource* cachedImage = m_imageResource->cachedImage();
607 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( )) 606 if (cachedImage && cachedImage->image() && cachedImage->image()->isSVGImage( ))
608 return toSVGImage(cachedImage->image())->embeddedContentBox(); 607 return toSVGImage(cachedImage->image())->embeddedContentBox();
609 608
610 return 0; 609 return 0;
611 } 610 }
612 611
613 } // namespace WebCore 612 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/HitTestResult.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698