| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/html/shadow/ProgressShadowElement.h" | 31 #include "core/html/shadow/ProgressShadowElement.h" |
| 32 | 32 |
| 33 #include "core/HTMLNames.h" | 33 #include "core/HTMLNames.h" |
| 34 #include "core/html/HTMLProgressElement.h" | 34 #include "core/html/HTMLProgressElement.h" |
| 35 #include "core/layout/LayoutProgress.h" | 35 #include "core/layout/LayoutObject.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 40 | 40 |
| 41 ProgressShadowElement::ProgressShadowElement(Document& document) | 41 ProgressShadowElement::ProgressShadowElement(Document& document) |
| 42 : HTMLDivElement(document) | 42 : HTMLDivElement(document) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 HTMLProgressElement* ProgressShadowElement::progressElement() const | 46 HTMLProgressElement* ProgressShadowElement::progressElement() const |
| 47 { | 47 { |
| 48 return toHTMLProgressElement(shadowHost()); | 48 return toHTMLProgressElement(shadowHost()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool ProgressShadowElement::layoutObjectIsNeeded(const ComputedStyle& style) | 51 bool ProgressShadowElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 52 { | 52 { |
| 53 LayoutObject* progressLayoutObject = progressElement()->layoutObject(); | 53 LayoutObject* progressLayoutObject = progressElement()->layoutObject(); |
| 54 return progressLayoutObject && !progressLayoutObject->style()->hasAppearance
() && HTMLDivElement::layoutObjectIsNeeded(style); | 54 return progressLayoutObject && !progressLayoutObject->style()->hasAppearance
() && HTMLDivElement::layoutObjectIsNeeded(style); |
| 55 } | 55 } |
| 56 | 56 |
| 57 inline ProgressInnerElement::ProgressInnerElement(Document& document) | 57 inline ProgressInnerElement::ProgressInnerElement(Document& document) |
| 58 : ProgressShadowElement(document) | 58 : ProgressShadowElement(document) |
| 59 { | 59 { |
| 60 } | 60 } |
| 61 | 61 |
| 62 DEFINE_NODE_FACTORY(ProgressInnerElement) | 62 DEFINE_NODE_FACTORY(ProgressInnerElement) |
| 63 | 63 |
| 64 LayoutObject* ProgressInnerElement::createLayoutObject(const ComputedStyle&) | |
| 65 { | |
| 66 return new LayoutProgress(this); | |
| 67 } | |
| 68 | |
| 69 bool ProgressInnerElement::layoutObjectIsNeeded(const ComputedStyle& style) | 64 bool ProgressInnerElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 70 { | 65 { |
| 71 if (progressElement()->openShadowRoot()) | 66 if (progressElement()->openShadowRoot()) |
| 72 return HTMLDivElement::layoutObjectIsNeeded(style); | 67 return HTMLDivElement::layoutObjectIsNeeded(style); |
| 73 | 68 |
| 74 LayoutObject* progressLayoutObject = progressElement()->layoutObject(); | 69 LayoutObject* progressLayoutObject = progressElement()->layoutObject(); |
| 75 return progressLayoutObject && !progressLayoutObject->style()->hasAppearance
() && HTMLDivElement::layoutObjectIsNeeded(style); | 70 return progressLayoutObject && !progressLayoutObject->style()->hasAppearance
() && HTMLDivElement::layoutObjectIsNeeded(style); |
| 76 } | 71 } |
| 77 | 72 |
| 78 inline ProgressBarElement::ProgressBarElement(Document& document) | 73 inline ProgressBarElement::ProgressBarElement(Document& document) |
| 79 : ProgressShadowElement(document) | 74 : ProgressShadowElement(document) |
| 80 { | 75 { |
| 81 } | 76 } |
| 82 | 77 |
| 83 DEFINE_NODE_FACTORY(ProgressBarElement) | 78 DEFINE_NODE_FACTORY(ProgressBarElement) |
| 84 | 79 |
| 85 ProgressValueElement::ProgressValueElement(Document& document) | 80 ProgressValueElement::ProgressValueElement(Document& document) |
| 86 : ProgressShadowElement(document) | 81 : ProgressShadowElement(document) |
| 87 { | 82 { |
| 88 } | 83 } |
| 89 | 84 |
| 90 void ProgressValueElement::setWidthPercentage(double width) | 85 void ProgressValueElement::setWidthPercentage(double width) |
| 91 { | 86 { |
| 92 setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::UnitType:
:Percentage); | 87 setInlineStyleProperty(CSSPropertyWidth, width, CSSPrimitiveValue::UnitType:
:Percentage); |
| 93 } | 88 } |
| 94 | 89 |
| 95 DEFINE_NODE_FACTORY(ProgressValueElement) | 90 DEFINE_NODE_FACTORY(ProgressValueElement) |
| 96 | 91 |
| 97 } // namespace blink | 92 } // namespace blink |
| OLD | NEW |