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

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

Issue 2557583003: Move Form Association Code to FormAssociated::associateWith (Closed)
Patch Set: Check for m_inputType before accessing it Created 4 years 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 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * Copyright (C) 2010 Google Inc. All rights reserved. 6 * Copyright (C) 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 ActiveScriptWrappable(this), 93 ActiveScriptWrappable(this),
94 m_imageLoader(HTMLImageLoader::create(this)), 94 m_imageLoader(HTMLImageLoader::create(this)),
95 m_imageDevicePixelRatio(1.0f), 95 m_imageDevicePixelRatio(1.0f),
96 m_source(nullptr), 96 m_source(nullptr),
97 m_formWasSetByParser(false), 97 m_formWasSetByParser(false),
98 m_elementCreatedByParser(createdByParser), 98 m_elementCreatedByParser(createdByParser),
99 m_useFallbackContent(false), 99 m_useFallbackContent(false),
100 m_isFallbackImage(false), 100 m_isFallbackImage(false),
101 m_referrerPolicy(ReferrerPolicyDefault) { 101 m_referrerPolicy(ReferrerPolicyDefault) {
102 setHasCustomStyleCallbacks(); 102 setHasCustomStyleCallbacks();
103 if (form && form->isConnected()) {
104 m_form = form;
105 m_formWasSetByParser = true;
106 m_form->associate(*this);
107 m_form->didAssociateByParser();
108 }
109 } 103 }
110 104
111 HTMLImageElement* HTMLImageElement::create(Document& document) { 105 HTMLImageElement* HTMLImageElement::create(Document& document) {
112 return new HTMLImageElement(document); 106 return new HTMLImageElement(document);
113 } 107 }
114 108
115 HTMLImageElement* HTMLImageElement::create(Document& document, 109 HTMLImageElement* HTMLImageElement::create(Document& document,
116 HTMLFormElement* form, 110 HTMLFormElement* form,
117 bool createdByParser) { 111 bool createdByParser) {
118 return new HTMLImageElement(document, form, createdByParser); 112 return new HTMLImageElement(document, form, createdByParser);
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 IntSize HTMLImageElement::bitmapSourceSize() const { 879 IntSize HTMLImageElement::bitmapSourceSize() const {
886 ImageResource* image = cachedImage(); 880 ImageResource* image = cachedImage();
887 if (!image) 881 if (!image)
888 return IntSize(); 882 return IntSize();
889 LayoutSize lSize = image->imageSize( 883 LayoutSize lSize = image->imageSize(
890 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f); 884 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f);
891 DCHECK(lSize.fraction().isZero()); 885 DCHECK(lSize.fraction().isZero());
892 return IntSize(lSize.width().toInt(), lSize.height().toInt()); 886 return IntSize(lSize.width().toInt(), lSize.height().toInt());
893 } 887 }
894 888
895 void HTMLImageElement::associateWith(HTMLFormElement*){}; 889 void HTMLImageElement::associateWith(HTMLFormElement* form) {
890 if (form && form->isConnected()) {
891 m_form = form;
892 m_formWasSetByParser = true;
893 m_form->associate(*this);
894 m_form->didAssociateByParser();
895 }
896 };
896 897
897 } // namespace blink 898 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698