| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 DECLARE_VIRTUAL_TRACE(); | 57 DECLARE_VIRTUAL_TRACE(); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 explicit ImageDocument(const DocumentInit&); | 60 explicit ImageDocument(const DocumentInit&); |
| 61 | 61 |
| 62 DocumentParser* createParser() override; | 62 DocumentParser* createParser() override; |
| 63 | 63 |
| 64 void createDocumentStructure(); | 64 void createDocumentStructure(); |
| 65 | 65 |
| 66 // Determines whether the image should be centered in the layout. |
| 67 bool shouldCenterImage() const; |
| 68 |
| 66 // Calculates how large the div needs to be to properly center the image. | 69 // Calculates how large the div needs to be to properly center the image. |
| 67 int calculateDivWidth(); | 70 int calculateDivWidth(); |
| 68 | 71 |
| 69 // These methods are for m_shrinkToFitMode == Desktop. | 72 // These methods are for m_shrinkToFitMode == Desktop. |
| 70 void resizeImageToFit(); | 73 void resizeImageToFit(); |
| 71 void restoreImageSize(); | 74 void restoreImageSize(); |
| 72 bool imageFitsInWindow() const; | 75 bool imageFitsInWindow() const; |
| 73 bool shouldShrinkToFit() const; | 76 bool shouldShrinkToFit() const; |
| 74 // Calculates the image size multiplier that's needed to fit the image to | 77 // Calculates the image size multiplier that's needed to fit the image to |
| 75 // the window, taking into account page zoom and device scale. | 78 // the window, taking into account page zoom and device scale. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 | 102 |
| 100 enum ShrinkToFitMode { Viewport, Desktop }; | 103 enum ShrinkToFitMode { Viewport, Desktop }; |
| 101 ShrinkToFitMode m_shrinkToFitMode; | 104 ShrinkToFitMode m_shrinkToFitMode; |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); | 107 DEFINE_DOCUMENT_TYPE_CASTS(ImageDocument); |
| 105 | 108 |
| 106 } // namespace blink | 109 } // namespace blink |
| 107 | 110 |
| 108 #endif // ImageDocument_h | 111 #endif // ImageDocument_h |
| OLD | NEW |