| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | |
| 3 * | |
| 4 * This library is free software; you can redistribute it and/or | |
| 5 * modify it under the terms of the GNU Library General Public | |
| 6 * License as published by the Free Software Foundation; either | |
| 7 * version 2 of the License, or (at your option) any later version. | |
| 8 * | |
| 9 * This library is distributed in the hope that it will be useful, | |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 12 * Library General Public License for more details. | |
| 13 * | |
| 14 * You should have received a copy of the GNU Library General Public License | |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | |
| 17 * Boston, MA 02110-1301, USA. | |
| 18 * | |
| 19 */ | |
| 20 | |
| 21 #include "core/layout/LayoutMeter.h" | |
| 22 | |
| 23 #include "core/html/HTMLMeterElement.h" | |
| 24 #include "core/layout/LayoutTheme.h" | |
| 25 | |
| 26 namespace blink { | |
| 27 | |
| 28 using namespace HTMLNames; | |
| 29 | |
| 30 LayoutMeter::LayoutMeter(HTMLElement* element) | |
| 31 : LayoutBlockFlow(element) | |
| 32 { | |
| 33 } | |
| 34 | |
| 35 LayoutMeter::~LayoutMeter() | |
| 36 { | |
| 37 } | |
| 38 | |
| 39 HTMLMeterElement* LayoutMeter::meterElement() const | |
| 40 { | |
| 41 ASSERT(node()); | |
| 42 | |
| 43 if (isHTMLMeterElement(*node())) | |
| 44 return toHTMLMeterElement(node()); | |
| 45 | |
| 46 ASSERT(node()->shadowHost()); | |
| 47 return toHTMLMeterElement(node()->shadowHost()); | |
| 48 } | |
| 49 | |
| 50 void LayoutMeter::updateLogicalWidth() | |
| 51 { | |
| 52 LayoutBox::updateLogicalWidth(); | |
| 53 | |
| 54 IntSize frameSize = LayoutTheme::theme().meterSizeForBounds(*this, pixelSnap
pedIntRect(frameRect())); | |
| 55 setLogicalWidth(LayoutUnit(isHorizontalWritingMode() ? frameSize.width() : f
rameSize.height())); | |
| 56 } | |
| 57 | |
| 58 void LayoutMeter::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logi
calTop, LogicalExtentComputedValues& computedValues) const | |
| 59 { | |
| 60 LayoutBox::computeLogicalHeight(logicalHeight, logicalTop, computedValues); | |
| 61 | |
| 62 LayoutRect frame = frameRect(); | |
| 63 if (isHorizontalWritingMode()) | |
| 64 frame.setHeight(computedValues.m_extent); | |
| 65 else | |
| 66 frame.setWidth(computedValues.m_extent); | |
| 67 IntSize frameSize = LayoutTheme::theme().meterSizeForBounds(*this, pixelSnap
pedIntRect(frame)); | |
| 68 computedValues.m_extent = LayoutUnit(isHorizontalWritingMode() ? frameSize.h
eight() : frameSize.width()); | |
| 69 } | |
| 70 | |
| 71 void LayoutMeter::updateFromElement() | |
| 72 { | |
| 73 setShouldDoFullPaintInvalidation(); | |
| 74 } | |
| 75 | |
| 76 } // namespace blink | |
| OLD | NEW |