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

Side by Side Diff: Source/core/html/HTMLImageFallbackHelper.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLImageFallbackHelper.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "core/html/HTMLImageFallbackHelper.h" 6 #include "core/html/HTMLImageFallbackHelper.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/InputTypeNames.h" 9 #include "core/InputTypeNames.h"
10 #include "core/dom/ElementRareData.h" 10 #include "core/dom/ElementRareData.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 RefPtrWillBeRawPtr<HTMLDivElement> altText = HTMLDivElement::create(element. document()); 59 RefPtrWillBeRawPtr<HTMLDivElement> altText = HTMLDivElement::create(element. document());
60 container->appendChild(altText); 60 container->appendChild(altText);
61 altText->setAttribute(idAttr, AtomicString("alttext", AtomicString::Construc tFromLiteral)); 61 altText->setAttribute(idAttr, AtomicString("alttext", AtomicString::Construc tFromLiteral));
62 altText->setInlineStyleProperty(CSSPropertyOverflow, CSSValueHidden); 62 altText->setInlineStyleProperty(CSSPropertyOverflow, CSSValueHidden);
63 altText->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock); 63 altText->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock);
64 64
65 RefPtrWillBeRawPtr<Text> text = Text::create(element.document(), toHTMLEleme nt(element).altText()); 65 RefPtrWillBeRawPtr<Text> text = Text::create(element.document(), toHTMLEleme nt(element).altText());
66 altText->appendChild(text); 66 altText->appendChild(text);
67 } 67 }
68 68
69 PassRefPtr<LayoutStyle> HTMLImageFallbackHelper::customStyleForAltText(Element& element, PassRefPtr<LayoutStyle> newStyle) 69 PassRefPtr<ComputedStyle> HTMLImageFallbackHelper::customStyleForAltText(Element & element, PassRefPtr<ComputedStyle> newStyle)
70 { 70 {
71 // If we have an author shadow root or have not created the UA shadow root y et, bail early. We can't 71 // If we have an author shadow root or have not created the UA shadow root y et, bail early. We can't
72 // use ensureClosedShadowRoot() here because that would alter the DOM tree d uring style recalc. 72 // use ensureClosedShadowRoot() here because that would alter the DOM tree d uring style recalc.
73 if (element.shadowRoot() || !element.closedShadowRoot()) 73 if (element.shadowRoot() || !element.closedShadowRoot())
74 return newStyle; 74 return newStyle;
75 75
76 Element* placeHolder = element.closedShadowRoot()->getElementById("alttext-c ontainer"); 76 Element* placeHolder = element.closedShadowRoot()->getElementById("alttext-c ontainer");
77 Element* brokenImage = element.closedShadowRoot()->getElementById("alttext-i mage"); 77 Element* brokenImage = element.closedShadowRoot()->getElementById("alttext-i mage");
78 // Input elements have a UA shadow root of their own. We may not have replac ed it with fallback content yet. 78 // Input elements have a UA shadow root of their own. We may not have replac ed it with fallback content yet.
79 if (!placeHolder || !brokenImage) 79 if (!placeHolder || !brokenImage)
(...skipping 27 matching lines...) Expand all
107 // This preserves legacy behaviour originally defined when alt-text was mana ged by LayoutImage. 107 // This preserves legacy behaviour originally defined when alt-text was mana ged by LayoutImage.
108 if (noImageSourceSpecified(element)) 108 if (noImageSourceSpecified(element))
109 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); 109 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone);
110 else 110 else
111 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline); 111 brokenImage->setInlineStyleProperty(CSSPropertyDisplay, CSSValueInline);
112 112
113 return newStyle; 113 return newStyle;
114 } 114 }
115 115
116 } // namespace blink 116 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLImageFallbackHelper.h ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698