| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "core/html/HTMLContentElement.h" | 41 #include "core/html/HTMLContentElement.h" |
| 42 #include "core/html/HTMLDivElement.h" | 42 #include "core/html/HTMLDivElement.h" |
| 43 #include "core/html/HTMLHeadElement.h" | 43 #include "core/html/HTMLHeadElement.h" |
| 44 #include "core/html/HTMLHtmlElement.h" | 44 #include "core/html/HTMLHtmlElement.h" |
| 45 #include "core/html/HTMLImageElement.h" | 45 #include "core/html/HTMLImageElement.h" |
| 46 #include "core/html/HTMLMetaElement.h" | 46 #include "core/html/HTMLMetaElement.h" |
| 47 #include "core/layout/LayoutObject.h" | 47 #include "core/layout/LayoutObject.h" |
| 48 #include "core/loader/DocumentLoader.h" | 48 #include "core/loader/DocumentLoader.h" |
| 49 #include "core/loader/FrameLoader.h" | 49 #include "core/loader/FrameLoader.h" |
| 50 #include "core/loader/FrameLoaderClient.h" | 50 #include "core/loader/FrameLoaderClient.h" |
| 51 #include "core/page/Page.h" |
| 51 #include "platform/HostWindow.h" | 52 #include "platform/HostWindow.h" |
| 52 #include "wtf/text/StringBuilder.h" | 53 #include "wtf/text/StringBuilder.h" |
| 53 #include <limits> | 54 #include <limits> |
| 54 | 55 |
| 55 using namespace std; | 56 using namespace std; |
| 56 | 57 |
| 57 namespace { | 58 namespace { |
| 58 | 59 |
| 59 // The base square size is set to 10 because it rounds nicely for both the | 60 // The base square size is set to 10 because it rounds nicely for both the |
| 60 // minimum scale (0.1) and maximum scale (5.0). | 61 // minimum scale (0.1) and maximum scale (5.0). |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 if (isStopped()) { | 569 if (isStopped()) { |
| 569 m_imageElement = nullptr; | 570 m_imageElement = nullptr; |
| 570 return nullptr; | 571 return nullptr; |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 | 574 |
| 574 return m_imageElement->cachedImage(); | 575 return m_imageElement->cachedImage(); |
| 575 } | 576 } |
| 576 | 577 |
| 577 bool ImageDocument::shouldShrinkToFit() const { | 578 bool ImageDocument::shouldShrinkToFit() const { |
| 578 return frame()->isMainFrame(); | 579 // WebView automatically resizes to match the contents, causing an infinite |
| 580 // loop as the contents then resize to match the window. To prevent this, |
| 581 // disallow images from shrinking to fit for WebViews. |
| 582 bool isWrapContentWebView = |
| 583 page() ? page()->settings().getForceZeroLayoutHeight() : false; |
| 584 return frame()->isMainFrame() && !isWrapContentWebView; |
| 579 } | 585 } |
| 580 | 586 |
| 581 DEFINE_TRACE(ImageDocument) { | 587 DEFINE_TRACE(ImageDocument) { |
| 582 visitor->trace(m_divElement); | 588 visitor->trace(m_divElement); |
| 583 visitor->trace(m_imageElement); | 589 visitor->trace(m_imageElement); |
| 584 HTMLDocument::trace(visitor); | 590 HTMLDocument::trace(visitor); |
| 585 } | 591 } |
| 586 | 592 |
| 587 // -------- | 593 // -------- |
| 588 | 594 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 600 } | 606 } |
| 601 | 607 |
| 602 bool ImageEventListener::operator==(const EventListener& listener) const { | 608 bool ImageEventListener::operator==(const EventListener& listener) const { |
| 603 if (const ImageEventListener* imageEventListener = | 609 if (const ImageEventListener* imageEventListener = |
| 604 ImageEventListener::cast(&listener)) | 610 ImageEventListener::cast(&listener)) |
| 605 return m_doc == imageEventListener->m_doc; | 611 return m_doc == imageEventListener->m_doc; |
| 606 return false; | 612 return false; |
| 607 } | 613 } |
| 608 | 614 |
| 609 } // namespace blink | 615 } // namespace blink |
| OLD | NEW |