OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/HTMLImageFallbackHelper.h" | 5 #include "core/html/HTMLImageFallbackHelper.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/InputTypeNames.h" | 8 #include "core/InputTypeNames.h" |
9 #include "core/dom/ElementRareData.h" | 9 #include "core/dom/ElementRareData.h" |
10 #include "core/dom/Text.h" | 10 #include "core/dom/Text.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 placeHolder->setInlineStyleProperty( | 109 placeHolder->setInlineStyleProperty( |
110 CSSPropertyWidth, 100, CSSPrimitiveValue::UnitType::Percentage); | 110 CSSPropertyWidth, 100, CSSPrimitiveValue::UnitType::Percentage); |
111 placeHolder->setInlineStyleProperty( | 111 placeHolder->setInlineStyleProperty( |
112 CSSPropertyHeight, 100, CSSPrimitiveValue::UnitType::Percentage); | 112 CSSPropertyHeight, 100, CSSPrimitiveValue::UnitType::Percentage); |
113 } | 113 } |
114 | 114 |
115 // Make sure the broken image icon appears on the appropriate side of the | 115 // Make sure the broken image icon appears on the appropriate side of the |
116 // image for the element's writing direction. | 116 // image for the element's writing direction. |
117 brokenImage->setInlineStyleProperty( | 117 brokenImage->setInlineStyleProperty( |
118 CSSPropertyFloat, | 118 CSSPropertyFloat, |
119 AtomicString(newStyle->direction() == TextDirection::Ltr ? "left" | 119 AtomicString(newStyle->direction() == TextDirection::kLtr ? "left" |
120 : "right")); | 120 : "right")); |
121 | 121 |
122 // This is an <img> with no attributes, so don't display anything. | 122 // This is an <img> with no attributes, so don't display anything. |
123 if (noImageSourceSpecified(element) && | 123 if (noImageSourceSpecified(element) && |
124 !newStyle->width().isSpecifiedOrIntrinsic() && | 124 !newStyle->width().isSpecifiedOrIntrinsic() && |
125 !newStyle->height().isSpecifiedOrIntrinsic() && | 125 !newStyle->height().isSpecifiedOrIntrinsic() && |
126 toHTMLElement(element).altText().isEmpty()) | 126 toHTMLElement(element).altText().isEmpty()) |
127 newStyle->setDisplay(EDisplay::None); | 127 newStyle->setDisplay(EDisplay::None); |
128 | 128 |
129 // This preserves legacy behaviour originally defined when alt-text was | 129 // This preserves legacy behaviour originally defined when alt-text was |
130 // managed by LayoutImage. | 130 // managed by LayoutImage. |
131 if (noImageSourceSpecified(element)) | 131 if (noImageSourceSpecified(element)) |
132 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 132 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
133 else | 133 else |
134 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline); | 134 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline); |
135 | 135 |
136 return newStyle; | 136 return newStyle; |
137 } | 137 } |
138 | 138 |
139 } // namespace blink | 139 } // namespace blink |
OLD | NEW |