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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) | 399 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr
aversal::highestAncestorOrSelf(*this)) |
400 resetFormOwner(); | 400 resetFormOwner(); |
401 if (m_listener) | 401 if (m_listener) |
402 document().mediaQueryMatcher().removeViewportListener(m_listener); | 402 document().mediaQueryMatcher().removeViewportListener(m_listener); |
403 HTMLElement::removedFrom(insertionPoint); | 403 HTMLElement::removedFrom(insertionPoint); |
404 } | 404 } |
405 | 405 |
406 int HTMLImageElement::width() | 406 int HTMLImageElement::width() |
407 { | 407 { |
408 if (inActiveDocument()) | 408 if (inActiveDocument()) |
409 document().updateLayoutIgnorePendingStylesheets(); | 409 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
410 | 410 |
411 if (!layoutObject()) { | 411 if (!layoutObject()) { |
412 // check the attribute first for an explicit pixel value | 412 // check the attribute first for an explicit pixel value |
413 bool ok; | 413 bool ok; |
414 int width = getAttribute(widthAttr).toInt(&ok); | 414 int width = getAttribute(widthAttr).toInt(&ok); |
415 if (ok) | 415 if (ok) |
416 return width; | 416 return width; |
417 | 417 |
418 // if the image is available, use its width | 418 // if the image is available, use its width |
419 if (imageLoader().image()) | 419 if (imageLoader().image()) |
420 return imageLoader().image()->imageSize(LayoutObject::shouldRespectI
mageOrientation(nullptr), 1.0f).width(); | 420 return imageLoader().image()->imageSize(LayoutObject::shouldRespectI
mageOrientation(nullptr), 1.0f).width(); |
421 } | 421 } |
422 | 422 |
423 LayoutBox* box = layoutBox(); | 423 LayoutBox* box = layoutBox(); |
424 return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth()
, box) : 0; | 424 return box ? adjustForAbsoluteZoom(box->contentBoxRect().pixelSnappedWidth()
, box) : 0; |
425 } | 425 } |
426 | 426 |
427 int HTMLImageElement::height() | 427 int HTMLImageElement::height() |
428 { | 428 { |
429 if (inActiveDocument()) | 429 if (inActiveDocument()) |
430 document().updateLayoutIgnorePendingStylesheets(); | 430 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
431 | 431 |
432 if (!layoutObject()) { | 432 if (!layoutObject()) { |
433 // check the attribute first for an explicit pixel value | 433 // check the attribute first for an explicit pixel value |
434 bool ok; | 434 bool ok; |
435 int height = getAttribute(heightAttr).toInt(&ok); | 435 int height = getAttribute(heightAttr).toInt(&ok); |
436 if (ok) | 436 if (ok) |
437 return height; | 437 return height; |
438 | 438 |
439 // if the image is available, use its height | 439 // if the image is available, use its height |
440 if (imageLoader().image()) | 440 if (imageLoader().image()) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 setAttribute(srcAttr, AtomicString(value)); | 513 setAttribute(srcAttr, AtomicString(value)); |
514 } | 514 } |
515 | 515 |
516 void HTMLImageElement::setWidth(int value) | 516 void HTMLImageElement::setWidth(int value) |
517 { | 517 { |
518 setIntegralAttribute(widthAttr, value); | 518 setIntegralAttribute(widthAttr, value); |
519 } | 519 } |
520 | 520 |
521 int HTMLImageElement::x() const | 521 int HTMLImageElement::x() const |
522 { | 522 { |
523 document().updateLayoutIgnorePendingStylesheets(); | 523 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
524 LayoutObject* r = layoutObject(); | 524 LayoutObject* r = layoutObject(); |
525 if (!r) | 525 if (!r) |
526 return 0; | 526 return 0; |
527 | 527 |
528 // FIXME: This doesn't work correctly with transforms. | 528 // FIXME: This doesn't work correctly with transforms. |
529 FloatPoint absPos = r->localToAbsolute(); | 529 FloatPoint absPos = r->localToAbsolute(); |
530 return absPos.x(); | 530 return absPos.x(); |
531 } | 531 } |
532 | 532 |
533 int HTMLImageElement::y() const | 533 int HTMLImageElement::y() const |
534 { | 534 { |
535 document().updateLayoutIgnorePendingStylesheets(); | 535 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
536 LayoutObject* r = layoutObject(); | 536 LayoutObject* r = layoutObject(); |
537 if (!r) | 537 if (!r) |
538 return 0; | 538 return 0; |
539 | 539 |
540 // FIXME: This doesn't work correctly with transforms. | 540 // FIXME: This doesn't work correctly with transforms. |
541 FloatPoint absPos = r->localToAbsolute(); | 541 FloatPoint absPos = r->localToAbsolute(); |
542 return absPos.y(); | 542 return absPos.y(); |
543 } | 543 } |
544 | 544 |
545 bool HTMLImageElement::complete() const | 545 bool HTMLImageElement::complete() const |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 { | 805 { |
806 ImageResource* image = cachedImage(); | 806 ImageResource* image = cachedImage(); |
807 if (!image) | 807 if (!image) |
808 return IntSize(); | 808 return IntSize(); |
809 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); | 809 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat
ion(layoutObject()), 1.0f); |
810 ASSERT(lSize.fraction().isZero()); | 810 ASSERT(lSize.fraction().isZero()); |
811 return IntSize(lSize.width(), lSize.height()); | 811 return IntSize(lSize.width(), lSize.height()); |
812 } | 812 } |
813 | 813 |
814 } // namespace blink | 814 } // namespace blink |
OLD | NEW |