blob: b21d15ba52288be82e4feebf8e5f3b9cc560f825 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#include "core/layout/LayoutDetailsMarker.h"
#include "core/HTMLNames.h"
#include "core/dom/Element.h"
#include "core/html/HTMLElement.h"
#include "core/paint/DetailsMarkerPainter.h"
namespace blink {
using namespace HTMLNames;
LayoutDetailsMarker::LayoutDetailsMarker(Element* element)
: LayoutBlockFlow(element)
{
}
LayoutDetailsMarker::Orientation LayoutDetailsMarker::getOrientation() const
{
switch (style()->getWritingMode()) {
case TopToBottomWritingMode:
if (style()->isLeftToRightDirection())
return isOpen() ? Down : Right;
return isOpen() ? Down : Left;
case RightToLeftWritingMode:
if (style()->isLeftToRightDirection())
return isOpen() ? Left : Down;
return isOpen() ? Left : Up;
case LeftToRightWritingMode:
if (style()->isLeftToRightDirection())
return isOpen() ? Right : Down;
return isOpen() ? Right : Up;
}
ASSERT_NOT_REACHED();
return Right;
}
void LayoutDetailsMarker::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
{
DetailsMarkerPainter(*this).paint(paintInfo, paintOffset);
}
bool LayoutDetailsMarker::isOpen() const
{
for (LayoutObject* layoutObject = parent(); layoutObject; layoutObject = layoutObject->parent()) {
if (!layoutObject->node())
continue;
if (isHTMLDetailsElement(*layoutObject->node()))
return !toElement(layoutObject->node())->getAttribute(openAttr).isNull();
if (isHTMLInputElement(*layoutObject->node()))
return true;
}
return false;
}
} // namespace blink
|