OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "CSSPropertyNames.h" | 35 #include "CSSPropertyNames.h" |
36 #include "HTMLNames.h" | 36 #include "HTMLNames.h" |
37 #include "core/html/HTMLMeterElement.h" | 37 #include "core/html/HTMLMeterElement.h" |
38 #include "core/rendering/RenderMeter.h" | 38 #include "core/rendering/RenderMeter.h" |
39 #include "core/rendering/RenderTheme.h" | 39 #include "core/rendering/RenderTheme.h" |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 using namespace HTMLNames; | 43 using namespace HTMLNames; |
44 | 44 |
45 inline MeterShadowElement::MeterShadowElement(Document* document) | 45 inline MeterShadowElement::MeterShadowElement(Document& document) |
46 : HTMLDivElement(HTMLNames::divTag, document) | 46 : HTMLDivElement(HTMLNames::divTag, document) |
47 { | 47 { |
48 } | 48 } |
49 | 49 |
50 HTMLMeterElement* MeterShadowElement::meterElement() const | 50 HTMLMeterElement* MeterShadowElement::meterElement() const |
51 { | 51 { |
52 return toHTMLMeterElement(shadowHost()); | 52 return toHTMLMeterElement(shadowHost()); |
53 } | 53 } |
54 | 54 |
55 bool MeterShadowElement::rendererIsNeeded(const NodeRenderingContext& context) | 55 bool MeterShadowElement::rendererIsNeeded(const NodeRenderingContext& context) |
56 { | 56 { |
57 RenderObject* render = meterElement()->renderer(); | 57 RenderObject* render = meterElement()->renderer(); |
58 return render && !RenderTheme::theme().supportsMeter(render->style()->appear
ance()) && HTMLDivElement::rendererIsNeeded(context); | 58 return render && !RenderTheme::theme().supportsMeter(render->style()->appear
ance()) && HTMLDivElement::rendererIsNeeded(context); |
59 } | 59 } |
60 | 60 |
61 inline MeterInnerElement::MeterInnerElement(Document* document) | 61 inline MeterInnerElement::MeterInnerElement(Document& document) |
62 : MeterShadowElement(document) | 62 : MeterShadowElement(document) |
63 { | 63 { |
64 } | 64 } |
65 | 65 |
66 PassRefPtr<MeterInnerElement> MeterInnerElement::create(Document* document) | 66 PassRefPtr<MeterInnerElement> MeterInnerElement::create(Document& document) |
67 { | 67 { |
68 RefPtr<MeterInnerElement> element = adoptRef(new MeterInnerElement(document)
); | 68 RefPtr<MeterInnerElement> element = adoptRef(new MeterInnerElement(document)
); |
69 element->setPart(AtomicString("-webkit-meter-inner-element", AtomicString::C
onstructFromLiteral)); | 69 element->setPart(AtomicString("-webkit-meter-inner-element", AtomicString::C
onstructFromLiteral)); |
70 return element.release(); | 70 return element.release(); |
71 } | 71 } |
72 | 72 |
73 bool MeterInnerElement::rendererIsNeeded(const NodeRenderingContext& context) | 73 bool MeterInnerElement::rendererIsNeeded(const NodeRenderingContext& context) |
74 { | 74 { |
75 if (meterElement()->hasAuthorShadowRoot()) | 75 if (meterElement()->hasAuthorShadowRoot()) |
76 return HTMLDivElement::rendererIsNeeded(context); | 76 return HTMLDivElement::rendererIsNeeded(context); |
77 | 77 |
78 RenderObject* render = meterElement()->renderer(); | 78 RenderObject* render = meterElement()->renderer(); |
79 return render && !RenderTheme::theme().supportsMeter(render->style()->appear
ance()) && HTMLDivElement::rendererIsNeeded(context); | 79 return render && !RenderTheme::theme().supportsMeter(render->style()->appear
ance()) && HTMLDivElement::rendererIsNeeded(context); |
80 } | 80 } |
81 | 81 |
82 RenderObject* MeterInnerElement::createRenderer(RenderStyle*) | 82 RenderObject* MeterInnerElement::createRenderer(RenderStyle*) |
83 { | 83 { |
84 return new RenderMeter(this); | 84 return new RenderMeter(this); |
85 } | 85 } |
86 | 86 |
87 inline MeterBarElement::MeterBarElement(Document* document) | 87 inline MeterBarElement::MeterBarElement(Document& document) |
88 : MeterShadowElement(document) | 88 : MeterShadowElement(document) |
89 { | 89 { |
90 } | 90 } |
91 | 91 |
92 PassRefPtr<MeterBarElement> MeterBarElement::create(Document* document) | 92 PassRefPtr<MeterBarElement> MeterBarElement::create(Document& document) |
93 { | 93 { |
94 RefPtr<MeterBarElement> element = adoptRef(new MeterBarElement(document)); | 94 RefPtr<MeterBarElement> element = adoptRef(new MeterBarElement(document)); |
95 element->setPart(AtomicString("-webkit-meter-bar", AtomicString::ConstructFr
omLiteral)); | 95 element->setPart(AtomicString("-webkit-meter-bar", AtomicString::ConstructFr
omLiteral)); |
96 return element.release(); | 96 return element.release(); |
97 } | 97 } |
98 | 98 |
99 inline MeterValueElement::MeterValueElement(Document* document) | 99 inline MeterValueElement::MeterValueElement(Document& document) |
100 : MeterShadowElement(document) | 100 : MeterShadowElement(document) |
101 { | 101 { |
102 } | 102 } |
103 | 103 |
104 PassRefPtr<MeterValueElement> MeterValueElement::create(Document* document) | 104 PassRefPtr<MeterValueElement> MeterValueElement::create(Document& document) |
105 { | 105 { |
106 RefPtr<MeterValueElement> element = adoptRef(new MeterValueElement(document)
); | 106 RefPtr<MeterValueElement> element = adoptRef(new MeterValueElement(document)
); |
107 element->updatePseudo(); | 107 element->updatePseudo(); |
108 return element.release(); | 108 return element.release(); |
109 } | 109 } |
110 | 110 |
111 const AtomicString& MeterValueElement::valuePseudoId() const | 111 const AtomicString& MeterValueElement::valuePseudoId() const |
112 { | 112 { |
113 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue", AtomicString::ConstructFromLiteral)); | 113 DEFINE_STATIC_LOCAL(AtomicString, optimumPseudoId, ("-webkit-meter-optimum-v
alue", AtomicString::ConstructFromLiteral)); |
114 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value", AtomicString::ConstructFromLiteral)); | 114 DEFINE_STATIC_LOCAL(AtomicString, suboptimumPseudoId, ("-webkit-meter-subopt
imum-value", AtomicString::ConstructFromLiteral)); |
(...skipping 15 matching lines...) Expand all Loading... |
130 return optimumPseudoId; | 130 return optimumPseudoId; |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 void MeterValueElement::setWidthPercentage(double width) | 134 void MeterValueElement::setWidthPercentage(double width) |
135 { | 135 { |
136 setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::CSS_PERCE
NTAGE); | 136 setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::CSS_PERCE
NTAGE); |
137 } | 137 } |
138 | 138 |
139 } | 139 } |
OLD | NEW |