| OLD | NEW |
| 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 else | 339 else |
| 340 renderImageResource->setImageResource(imageLoader().image()); | 340 renderImageResource->setImageResource(imageLoader().image()); |
| 341 | 341 |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) | 345 Node::InsertionNotificationRequest HTMLImageElement::insertedInto(ContainerNode*
insertionPoint) |
| 346 { | 346 { |
| 347 if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertion
Point) != NodeTraversal::highestAncestorOrSelf(*m_form.get())) | 347 if (!m_formWasSetByParser || NodeTraversal::highestAncestorOrSelf(*insertion
Point) != NodeTraversal::highestAncestorOrSelf(*m_form.get())) |
| 348 resetFormOwner(); | 348 resetFormOwner(); |
| 349 if (m_listener) |
| 350 document().mediaQueryMatcher().addViewportListener(m_listener.get()); |
| 349 | 351 |
| 350 bool imageWasModified = false; | 352 bool imageWasModified = false; |
| 351 if (RuntimeEnabledFeatures::pictureEnabled()) { | 353 if (RuntimeEnabledFeatures::pictureEnabled()) { |
| 352 ImageCandidate candidate = findBestFitImageFromPictureParent(); | 354 ImageCandidate candidate = findBestFitImageFromPictureParent(); |
| 353 if (!candidate.isEmpty()) { | 355 if (!candidate.isEmpty()) { |
| 354 setBestFitURLAndDPRFromImageCandidate(candidate); | 356 setBestFitURLAndDPRFromImageCandidate(candidate); |
| 355 imageWasModified = true; | 357 imageWasModified = true; |
| 356 } | 358 } |
| 357 } | 359 } |
| 358 | 360 |
| 359 // If we have been inserted from a renderer-less document, | 361 // If we have been inserted from a renderer-less document, |
| 360 // our loader may have not fetched the image, so do it now. | 362 // our loader may have not fetched the image, so do it now. |
| 361 if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModi
fied) | 363 if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModi
fied) |
| 362 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_elementCrea
tedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally); | 364 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_elementCrea
tedByParser ? ImageLoader::ForceLoadImmediately : ImageLoader::LoadNormally); |
| 363 | 365 |
| 364 return HTMLElement::insertedInto(insertionPoint); | 366 return HTMLElement::insertedInto(insertionPoint); |
| 365 } | 367 } |
| 366 | 368 |
| 367 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) | 369 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) |
| 368 { | 370 { |
| 369 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) | 371 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) |
| 370 resetFormOwner(); | 372 resetFormOwner(); |
| 373 if (m_listener) |
| 374 document().mediaQueryMatcher().removeViewportListener(m_listener.get()); |
| 371 HTMLElement::removedFrom(insertionPoint); | 375 HTMLElement::removedFrom(insertionPoint); |
| 372 } | 376 } |
| 373 | 377 |
| 374 int HTMLImageElement::width(bool ignorePendingStylesheets) | 378 int HTMLImageElement::width(bool ignorePendingStylesheets) |
| 375 { | 379 { |
| 376 if (!renderer()) { | 380 if (!renderer()) { |
| 377 // check the attribute first for an explicit pixel value | 381 // check the attribute first for an explicit pixel value |
| 378 bool ok; | 382 bool ok; |
| 379 int width = getAttribute(widthAttr).toInt(&ok); | 383 int width = getAttribute(widthAttr).toInt(&ok); |
| 380 if (ok) | 384 if (ok) |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 } | 636 } |
| 633 imageLoader().updateFromElement(behavior); | 637 imageLoader().updateFromElement(behavior); |
| 634 } | 638 } |
| 635 | 639 |
| 636 const KURL& HTMLImageElement::sourceURL() const | 640 const KURL& HTMLImageElement::sourceURL() const |
| 637 { | 641 { |
| 638 return cachedImage()->response().url(); | 642 return cachedImage()->response().url(); |
| 639 } | 643 } |
| 640 | 644 |
| 641 } | 645 } |
| OLD | NEW |