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

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

Issue 1858163002: Rename inDocument() to inShadowIncludingDocument() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 8 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) 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 , m_imageLoader(HTMLImageLoader::create(this)) 91 , m_imageLoader(HTMLImageLoader::create(this))
92 , m_imageDevicePixelRatio(1.0f) 92 , m_imageDevicePixelRatio(1.0f)
93 , m_source(nullptr) 93 , m_source(nullptr)
94 , m_formWasSetByParser(false) 94 , m_formWasSetByParser(false)
95 , m_elementCreatedByParser(createdByParser) 95 , m_elementCreatedByParser(createdByParser)
96 , m_useFallbackContent(false) 96 , m_useFallbackContent(false)
97 , m_isFallbackImage(false) 97 , m_isFallbackImage(false)
98 , m_referrerPolicy(ReferrerPolicyDefault) 98 , m_referrerPolicy(ReferrerPolicyDefault)
99 { 99 {
100 setHasCustomStyleCallbacks(); 100 setHasCustomStyleCallbacks();
101 if (form && form->inDocument()) { 101 if (form && form->inShadowIncludingDocument()) {
102 #if ENABLE(OILPAN) 102 #if ENABLE(OILPAN)
103 m_form = form; 103 m_form = form;
104 #else 104 #else
105 m_form = form->createWeakPtr(); 105 m_form = form->createWeakPtr();
106 #endif 106 #endif
107 m_formWasSetByParser = true; 107 m_formWasSetByParser = true;
108 m_form->associate(*this); 108 m_form->associate(*this);
109 m_form->didAssociateByParser(); 109 m_form->didAssociateByParser();
110 } 110 }
111 } 111 }
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (document().isActive()) { 404 if (document().isActive()) {
405 ImageCandidate candidate = findBestFitImageFromPictureParent(); 405 ImageCandidate candidate = findBestFitImageFromPictureParent();
406 if (!candidate.isEmpty()) { 406 if (!candidate.isEmpty()) {
407 setBestFitURLAndDPRFromImageCandidate(candidate); 407 setBestFitURLAndDPRFromImageCandidate(candidate);
408 imageWasModified = true; 408 imageWasModified = true;
409 } 409 }
410 } 410 }
411 411
412 // If we have been inserted from a layoutObject-less document, 412 // If we have been inserted from a layoutObject-less document,
413 // our loader may have not fetched the image, so do it now. 413 // our loader may have not fetched the image, so do it now.
414 if ((insertionPoint->inDocument() && !imageLoader().image()) || imageWasModi fied) 414 if ((insertionPoint->inShadowIncludingDocument() && !imageLoader().image()) || imageWasModified)
415 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPol icy); 415 imageLoader().updateFromElement(ImageLoader::UpdateNormal, m_referrerPol icy);
416 416
417 return HTMLElement::insertedInto(insertionPoint); 417 return HTMLElement::insertedInto(insertionPoint);
418 } 418 }
419 419
420 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint) 420 void HTMLImageElement::removedFrom(ContainerNode* insertionPoint)
421 { 421 {
422 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr aversal::highestAncestorOrSelf(*this)) 422 if (!m_form || NodeTraversal::highestAncestorOrSelf(*m_form.get()) != NodeTr aversal::highestAncestorOrSelf(*this))
423 resetFormOwner(); 423 resetFormOwner();
424 if (m_listener) 424 if (m_listener)
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 { 836 {
837 ImageResource* image = cachedImage(); 837 ImageResource* image = cachedImage();
838 if (!image) 838 if (!image)
839 return IntSize(); 839 return IntSize();
840 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); 840 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f);
841 ASSERT(lSize.fraction().isZero()); 841 ASSERT(lSize.fraction().isZero());
842 return IntSize(lSize.width(), lSize.height()); 842 return IntSize(lSize.width(), lSize.height());
843 } 843 }
844 844
845 } // namespace blink 845 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp ('k') | third_party/WebKit/Source/core/html/HTMLInputElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698