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

Side by Side Diff: Source/web/WebElement.cpp

Issue 19856004: Adds WebElement::imageContents() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move imageContents() call down to WebElement Created 7 years, 4 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 WebDocument WebElement::document() const 145 WebDocument WebElement::document() const
146 { 146 {
147 return WebDocument(constUnwrap<Element>()->document()); 147 return WebDocument(constUnwrap<Element>()->document());
148 } 148 }
149 149
150 WebRect WebElement::boundsInViewportSpace() 150 WebRect WebElement::boundsInViewportSpace()
151 { 151 {
152 return unwrap<Element>()->boundsInRootViewSpace(); 152 return unwrap<Element>()->boundsInRootViewSpace();
153 } 153 }
154 154
155 WebImage WebElement::imageContents()
156 {
157 if (isNull())
158 return WebImage();
159
160 WebCore::Image* image = unwrap<Element>()->imageContents();
161 if (!image)
162 return WebImage();
163
164 RefPtr<NativeImageSkia> bitmap = image->nativeImageForCurrentFrame();
165 if (!bitmap)
166 return WebImage();
167
168 return bitmap->bitmap();
169 }
170
155 WebElement::WebElement(const PassRefPtr<Element>& elem) 171 WebElement::WebElement(const PassRefPtr<Element>& elem)
156 : WebNode(elem) 172 : WebNode(elem)
157 { 173 {
158 } 174 }
159 175
160 WebElement& WebElement::operator=(const PassRefPtr<Element>& elem) 176 WebElement& WebElement::operator=(const PassRefPtr<Element>& elem)
161 { 177 {
162 m_private = elem; 178 m_private = elem;
163 return *this; 179 return *this;
164 } 180 }
165 181
166 WebElement::operator PassRefPtr<Element>() const 182 WebElement::operator PassRefPtr<Element>() const
167 { 183 {
168 return toElement(m_private.get()); 184 return toElement(m_private.get());
169 } 185 }
170 186
171 } // namespace WebKit 187 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698