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

Side by Side Diff: third_party/WebKit/Source/core/html/ImageDocument.cpp

Issue 2646663002: [Blink] Don't center images in Android WebViews (Closed)
Patch Set: [Blink] Don't center images in Android WebViews Created 3 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) 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
41 #include "core/html/HTMLDivElement.h" 41 #include "core/html/HTMLDivElement.h"
42 #include "core/html/HTMLHeadElement.h" 42 #include "core/html/HTMLHeadElement.h"
43 #include "core/html/HTMLHtmlElement.h" 43 #include "core/html/HTMLHtmlElement.h"
44 #include "core/html/HTMLImageElement.h" 44 #include "core/html/HTMLImageElement.h"
45 #include "core/html/HTMLMetaElement.h" 45 #include "core/html/HTMLMetaElement.h"
46 #include "core/layout/LayoutObject.h" 46 #include "core/layout/LayoutObject.h"
47 #include "core/loader/DocumentLoader.h" 47 #include "core/loader/DocumentLoader.h"
48 #include "core/loader/FrameLoader.h" 48 #include "core/loader/FrameLoader.h"
49 #include "core/loader/FrameLoaderClient.h" 49 #include "core/loader/FrameLoaderClient.h"
50 #include "core/loader/resource/ImageResource.h" 50 #include "core/loader/resource/ImageResource.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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 if (isStopped()) { 588 if (isStopped()) {
588 m_imageElement = nullptr; 589 m_imageElement = nullptr;
589 return nullptr; 590 return nullptr;
590 } 591 }
591 } 592 }
592 593
593 return m_imageElement->cachedImageResourceForImageDocument(); 594 return m_imageElement->cachedImageResourceForImageDocument();
594 } 595 }
595 596
596 bool ImageDocument::shouldShrinkToFit() const { 597 bool ImageDocument::shouldShrinkToFit() const {
597 return frame()->isMainFrame(); 598 bool isWrapContentWebView =
599 page() ? page()->settings().getForceZeroLayoutHeight() : false;
pdr. 2017/01/19 03:17:32 Is getForceZeroLayoutHeight causing the height to
aelias_OOO_until_Jul13 2017/01/19 03:53:07 It's used as isWebView (_in_WRAP_CONTENT_mode). T
pdr. 2017/01/19 05:04:27 Could we just add an isWebView() function instead
600 return frame()->isMainFrame() && !isWrapContentWebView;
598 } 601 }
599 602
600 DEFINE_TRACE(ImageDocument) { 603 DEFINE_TRACE(ImageDocument) {
601 visitor->trace(m_divElement); 604 visitor->trace(m_divElement);
602 visitor->trace(m_imageElement); 605 visitor->trace(m_imageElement);
603 HTMLDocument::trace(visitor); 606 HTMLDocument::trace(visitor);
604 } 607 }
605 608
606 // -------- 609 // --------
607 610
(...skipping 11 matching lines...) Expand all
619 } 622 }
620 623
621 bool ImageEventListener::operator==(const EventListener& listener) const { 624 bool ImageEventListener::operator==(const EventListener& listener) const {
622 if (const ImageEventListener* imageEventListener = 625 if (const ImageEventListener* imageEventListener =
623 ImageEventListener::cast(&listener)) 626 ImageEventListener::cast(&listener))
624 return m_doc == imageEventListener->m_doc; 627 return m_doc == imageEventListener->m_doc;
625 return false; 628 return false;
626 } 629 }
627 630
628 } // namespace blink 631 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698