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

Unified Diff: Source/core/layout/LayoutImage.cpp

Issue 1334703002: NOT FOR LANDING Pass URL to Image::draw (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/ImageQualityControllerTest.cpp ('k') | Source/core/layout/LayoutImageResource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutImage.cpp
diff --git a/Source/core/layout/LayoutImage.cpp b/Source/core/layout/LayoutImage.cpp
index 53fa66bdae50ef55887434f8153c654b47680a81..d668d917ea09b972795df1558bfacf445e8cdae5 100644
--- a/Source/core/layout/LayoutImage.cpp
+++ b/Source/core/layout/LayoutImage.cpp
@@ -38,6 +38,7 @@
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLMapElement.h"
+#include "core/html/parser/HTMLParserIdioms.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutView.h"
#include "core/layout/TextRunConstructor.h"
@@ -214,12 +215,27 @@ void LayoutImage::notifyFinished(Resource* newImage)
void LayoutImage::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ImagePainter(*this).paintReplaced(paintInfo, paintOffset);
+ KURL url;
+ if (node() && node()->isHTMLElement()) {
+ AtomicString urlString = toHTMLElement(node())->imageSourceURL();
+ if (!urlString.isEmpty())
+ url = node()->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
+ }
+
+ ImagePainter(*this, url).paintReplaced(paintInfo, paintOffset);
}
void LayoutImage::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- ImagePainter(*this).paint(paintInfo, paintOffset);
+ // TODO(davve): code duplication v ^
+ KURL url;
+ if (node() && node()->isHTMLElement()) {
+ AtomicString urlString = toHTMLElement(node())->imageSourceURL();
+ if (!urlString.isEmpty())
+ url = node()->document().completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
+ }
+
+ ImagePainter(*this, url).paint(paintInfo, paintOffset);
}
void LayoutImage::areaElementFocusChanged(HTMLAreaElement* areaElement)
« no previous file with comments | « Source/core/layout/ImageQualityControllerTest.cpp ('k') | Source/core/layout/LayoutImageResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698