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

Side by Side Diff: sky/engine/core/html/HTMLImageElement.cpp

Issue 834693007: Remove the remaining parts of ignorePendingStylesheets and placeholder styles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove comment. Created 5 years, 11 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
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 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_elementCrea tedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally); 178 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_elementCrea tedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally);
179 } 179 }
180 180
181 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) 181 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint)
182 { 182 {
183 if (m_listener) 183 if (m_listener)
184 document().mediaQueryMatcher().removeViewportListener(m_listener.get()); 184 document().mediaQueryMatcher().removeViewportListener(m_listener.get());
185 HTMLElement::removedFrom(insertionPoint); 185 HTMLElement::removedFrom(insertionPoint);
186 } 186 }
187 187
188 int HTMLImageElement::width(bool ignorePendingStylesheets) 188 int HTMLImageElement::width()
189 { 189 {
190 if (!renderer()) { 190 if (!renderer()) {
191 // check the attribute first for an explicit pixel value 191 // check the attribute first for an explicit pixel value
192 bool ok; 192 bool ok;
193 int width = getAttribute(HTMLNames::widthAttr).toInt(&ok); 193 int width = getAttribute(HTMLNames::widthAttr).toInt(&ok);
194 if (ok) 194 if (ok)
195 return width; 195 return width;
196 196
197 // if the image is available, use its width 197 // if the image is available, use its width
198 if (imageLoader().image()) 198 if (imageLoader().image())
199 return imageLoader().image()->imageSizeForRenderer(renderer()).width (); 199 return imageLoader().image()->imageSizeForRenderer(renderer()).width ();
200 } 200 }
201 201
202 if (ignorePendingStylesheets) 202 document().updateLayout();
203 document().updateLayoutIgnorePendingStylesheets();
204 else
205 document().updateLayout();
206 203
207 RenderBox* box = renderBox(); 204 RenderBox* box = renderBox();
208 return box ? box->contentBoxRect().pixelSnappedWidth() : 0; 205 return box ? box->contentBoxRect().pixelSnappedWidth() : 0;
209 } 206 }
210 207
211 int HTMLImageElement::height(bool ignorePendingStylesheets) 208 int HTMLImageElement::height()
212 { 209 {
213 if (!renderer()) { 210 if (!renderer()) {
214 // check the attribute first for an explicit pixel value 211 // check the attribute first for an explicit pixel value
215 bool ok; 212 bool ok;
216 int height = getAttribute(HTMLNames::heightAttr).toInt(&ok); 213 int height = getAttribute(HTMLNames::heightAttr).toInt(&ok);
217 if (ok) 214 if (ok)
218 return height; 215 return height;
219 216
220 // if the image is available, use its height 217 // if the image is available, use its height
221 if (imageLoader().image()) 218 if (imageLoader().image())
222 return imageLoader().image()->imageSizeForRenderer(renderer()).heigh t(); 219 return imageLoader().image()->imageSizeForRenderer(renderer()).heigh t();
223 } 220 }
224 221
225 if (ignorePendingStylesheets) 222 document().updateLayout();
226 document().updateLayoutIgnorePendingStylesheets();
227 else
228 document().updateLayout();
229 223
230 RenderBox* box = renderBox(); 224 RenderBox* box = renderBox();
231 return box ? box->contentBoxRect().pixelSnappedHeight() : 0; 225 return box ? box->contentBoxRect().pixelSnappedHeight() : 0;
232 } 226 }
233 227
234 int HTMLImageElement::naturalWidth() const 228 int HTMLImageElement::naturalWidth() const
235 { 229 {
236 if (!imageLoader().image()) 230 if (!imageLoader().image())
237 return 0; 231 return 0;
238 232
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 setAttribute(HTMLNames::srcAttr, AtomicString(value)); 274 setAttribute(HTMLNames::srcAttr, AtomicString(value));
281 } 275 }
282 276
283 void HTMLImageElement::setWidth(int value) 277 void HTMLImageElement::setWidth(int value)
284 { 278 {
285 setIntegralAttribute(HTMLNames::widthAttr, value); 279 setIntegralAttribute(HTMLNames::widthAttr, value);
286 } 280 }
287 281
288 int HTMLImageElement::x() const 282 int HTMLImageElement::x() const
289 { 283 {
290 document().updateLayoutIgnorePendingStylesheets(); 284 document().updateLayout();
291 RenderObject* r = renderer(); 285 RenderObject* r = renderer();
292 if (!r) 286 if (!r)
293 return 0; 287 return 0;
294 288
295 // FIXME: This doesn't work correctly with transforms. 289 // FIXME: This doesn't work correctly with transforms.
296 FloatPoint absPos = r->localToAbsolute(); 290 FloatPoint absPos = r->localToAbsolute();
297 return absPos.x(); 291 return absPos.x();
298 } 292 }
299 293
300 int HTMLImageElement::y() const 294 int HTMLImageElement::y() const
301 { 295 {
302 document().updateLayoutIgnorePendingStylesheets(); 296 document().updateLayout();
303 RenderObject* r = renderer(); 297 RenderObject* r = renderer();
304 if (!r) 298 if (!r)
305 return 0; 299 return 0;
306 300
307 // FIXME: This doesn't work correctly with transforms. 301 // FIXME: This doesn't work correctly with transforms.
308 FloatPoint absPos = r->localToAbsolute(); 302 FloatPoint absPos = r->localToAbsolute();
309 return absPos.y(); 303 return absPos.y();
310 } 304 }
311 305
312 bool HTMLImageElement::complete() const 306 bool HTMLImageElement::complete() const
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 } 369 }
376 imageLoader().updateFromElement(behavior); 370 imageLoader().updateFromElement(behavior);
377 } 371 }
378 372
379 const KURL& HTMLImageElement::sourceURL() const 373 const KURL& HTMLImageElement::sourceURL() const
380 { 374 {
381 return cachedImage()->response().url(); 375 return cachedImage()->response().url();
382 } 376 }
383 377
384 } 378 }
OLDNEW
« no previous file with comments | « sky/engine/core/html/HTMLImageElement.h ('k') | sky/engine/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698