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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 placeHolder->setInlineStyleProperty( | 110 placeHolder->setInlineStyleProperty( |
111 CSSPropertyWidth, 100, CSSPrimitiveValue::UnitType::Percentage); | 111 CSSPropertyWidth, 100, CSSPrimitiveValue::UnitType::Percentage); |
112 placeHolder->setInlineStyleProperty( | 112 placeHolder->setInlineStyleProperty( |
113 CSSPropertyHeight, 100, CSSPrimitiveValue::UnitType::Percentage); | 113 CSSPropertyHeight, 100, CSSPrimitiveValue::UnitType::Percentage); |
114 } | 114 } |
115 | 115 |
116 // Make sure the broken image icon appears on the appropriate side of the | 116 // Make sure the broken image icon appears on the appropriate side of the |
117 // image for the element's writing direction. | 117 // image for the element's writing direction. |
118 brokenImage->setInlineStyleProperty( | 118 brokenImage->setInlineStyleProperty( |
119 CSSPropertyFloat, | 119 CSSPropertyFloat, |
120 AtomicString(newStyle->direction() == LTR ? "left" : "right")); | 120 AtomicString(newStyle->direction() == TextDirection::Ltr ? "left" |
| 121 : "right")); |
121 | 122 |
122 // This is an <img> with no attributes, so don't display anything. | 123 // This is an <img> with no attributes, so don't display anything. |
123 if (noImageSourceSpecified(element) && | 124 if (noImageSourceSpecified(element) && |
124 !newStyle->width().isSpecifiedOrIntrinsic() && | 125 !newStyle->width().isSpecifiedOrIntrinsic() && |
125 !newStyle->height().isSpecifiedOrIntrinsic() && | 126 !newStyle->height().isSpecifiedOrIntrinsic() && |
126 toHTMLElement(element).altText().isEmpty()) | 127 toHTMLElement(element).altText().isEmpty()) |
127 newStyle->setDisplay(EDisplay::None); | 128 newStyle->setDisplay(EDisplay::None); |
128 | 129 |
129 // This preserves legacy behaviour originally defined when alt-text was | 130 // This preserves legacy behaviour originally defined when alt-text was |
130 // managed by LayoutImage. | 131 // managed by LayoutImage. |
131 if (noImageSourceSpecified(element)) | 132 if (noImageSourceSpecified(element)) |
132 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | 133 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
133 else | 134 else |
134 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline); | 135 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline); |
135 | 136 |
136 return newStyle; | 137 return newStyle; |
137 } | 138 } |
138 | 139 |
139 } // namespace blink | 140 } // namespace blink |
OLD | NEW |