| Differences between
and this patch
- a/Source/WebCore/ChangeLog +104 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        http://www.w3.org/TR/html5/interactive-elements.html#the-details-element
9
10
        The main <summary> element is the first <summary> element of a <details> element.
11
        All other childs of the <details> element are rendered only if the attribute 'open' is set.
12
        Click event toggles the 'open' attribute.
13
14
        * html/HTMLDetailsElement.cpp:
15
        (WebCore::HTMLDetailsElement::HTMLDetailsElement):
16
        (WebCore::HTMLDetailsElement::createRenderer):
17
        (WebCore::HTMLDetailsElement::createSummaryRenderer):
18
        (WebCore::HTMLDetailsElement::findMainSummary):
19
        (WebCore::HTMLDetailsElement::childrenChanged):
20
        (WebCore::HTMLDetailsElement::finishParsingChildren):
21
        (WebCore::HTMLDetailsElement::parseMappedAttribute):
22
        (WebCore::HTMLDetailsElement::childShouldCreateRenderer):
23
        (WebCore::HTMLDetailsElement::defaultEventHandler):
24
        * html/HTMLDetailsElement.h:
25
        (WebCore::HTMLDetailsElement::mainSummary):
26
27
        The method summaryDefaultLabel was added to LocalizationStrategy class and to
28
        platform/LocalizedStrings. It is used to provide the default label to be used by a 
29
        <details> tag that has no <summary> child.
30
31
        * platform/LocalizationStrategy.h:
32
        * platform/LocalizedStrings.cpp:
33
        (WebCore::summaryDefaultLabel):
34
        * platform/LocalizedStrings.h:
35
        * platform/android/LocalizedStringsAndroid.cpp:
36
        (WebCore::summaryDefaultLabel):
37
        * platform/brew/LocalizedStringsBrew.cpp:
38
        (WebCore::summaryDefaultLabel):
39
        * platform/efl/LocalizedStringsEfl.cpp:
40
        (WebCore::summaryDefaultLabel):
41
        * platform/gtk/LocalizedStringsGtk.cpp:
42
        (WebCore::summaryDefaultLabel):
43
        * platform/haiku/LocalizedStringsHaiku.cpp:
44
        (WebCore::summaryDefaultLabel):
45
        * platform/wx/LocalizedStringsWx.cpp:
46
        (WebCore::summaryDefaultLabel):
47
48
        The first <summary> element is positioned at the top of its <details> parent.
49
        The area occupied by this main <summary> element is the interactive area of the
50
        <details> element.
51
        If the <details> tag has no <summary> child an OwnedSummaryRenderer is created and
52
        added to the corresponding RenderDetails object.
53
54
        * rendering/RenderDetails.cpp:
55
        (WebCore::OwnedSummaryRenderer::OwnedSummaryRenderer):
56
        (WebCore::OwnedSummaryRenderer::renderName):
57
        (WebCore::OwnedSummaryRenderer::styleDidChange):
58
        (WebCore::RenderDetails::RenderDetails):
59
        (WebCore::RenderDetails::createSummaryStyle):
60
        (WebCore::RenderDetails::styleDidChange):
61
        (WebCore::RenderDetails::layoutSpecialExcludedChild):
62
        (WebCore::RenderDetails::findMainSummary):
63
        (WebCore::RenderDetails::layout):
64
        (WebCore::RenderDetails::isOpen):
65
        * rendering/RenderDetails.h:
66
        (WebCore::RenderDetails::interactiveArea):
67
        (WebCore::RenderDetails::avoidsFloats):
68
69
        A marker is added to the main <summary> element to indicate the current value of the 'open'
70
        attribute of the <details> element.
71
72
        * rendering/RenderDetailsMarker.cpp:
73
        (WebCore::RenderDetailsMarker::RenderDetailsMarker):
74
        (WebCore::RenderDetailsMarker::lineHeight):
75
        (WebCore::RenderDetailsMarker::baselinePosition):
76
        (WebCore::RenderDetailsMarker::computePreferredLogicalWidths):
77
        (WebCore::RenderDetailsMarker::layout):
78
        (WebCore::RenderDetailsMarker::getRelativeMarkerRect):
79
        (WebCore::RenderDetailsMarker::isOpen):
80
        (WebCore::getCanonicalPath):
81
        (WebCore::RenderDetailsMarker::getPath):
82
        (WebCore::RenderDetailsMarker::paint):
83
        (WebCore::ArrowPath::createPath):
84
        * rendering/RenderDetailsMarker.h:
85
86
        RenderSummary objects are created to be the renderers of <summary> elements.
87
88
        * rendering/RenderObject.cpp:
89
        (WebCore::RenderObject::createObject):
90
91
        RenderSummary objects are responsible for positioning the marker when the <summary>
92
        element is the first <summary> child of a <details> element.
93
94
        * rendering/RenderSummary.cpp:
95
        (WebCore::RenderSummary::RenderSummary):
96
        (WebCore::RenderSummary::destroy):
97
        (WebCore::RenderSummary::styleDidChange):
98
        (WebCore::RenderSummary::layout):
99
        (WebCore::RenderSummary::getParentOfFirstLineBox):
100
        (WebCore::RenderSummary::firstNonMarkerChild):
101
        (WebCore::RenderSummary::updateMarkerLocation):
102
        * rendering/RenderSummary.h:
103
        (WebCore::RenderSummary::markerIsVisible):
104
1
2011-02-08  Adam Barth  <abarth@webkit.org>
105
2011-02-08  Adam Barth  <abarth@webkit.org>
2
106
3
        Reviewed by Eric Seidel.
107
        Reviewed by Eric Seidel.
- a/Source/WebCore/html/HTMLDetailsElement.cpp -1 / +85 lines
Lines 21-28 a/Source/WebCore/html/HTMLDetailsElement.cpp_sec1
21
#include "config.h"
21
#include "config.h"
22
#include "HTMLDetailsElement.h"
22
#include "HTMLDetailsElement.h"
23
23
24
#include "ContainerNode.h"
25
#include "Event.h"
26
#include "Frame.h"
24
#include "HTMLNames.h"
27
#include "HTMLNames.h"
28
#include "MouseEvent.h"
29
#include "Node.h"
30
#include "PlatformMouseEvent.h"
25
#include "RenderDetails.h"
31
#include "RenderDetails.h"
32
#include "RenderSummary.h"
26
33
27
namespace WebCore {
34
namespace WebCore {
28
35
Lines 35-47 PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& t a/Source/WebCore/html/HTMLDetailsElement.cpp_sec2
35
42
36
HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document* document)
43
HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document* document)
37
    : HTMLElement(tagName, document)
44
    : HTMLElement(tagName, document)
45
    , m_mainSummary(0)
46
    , m_isOpen(false)
38
{
47
{
39
    ASSERT(hasTagName(detailsTag));
48
    ASSERT(hasTagName(detailsTag));
40
}
49
}
41
50
42
RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle*)
51
RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle*)
43
{
52
{
44
    return new (arena) RenderDetails(this);
53
    return new (arena) RenderDetails(this, !m_mainSummary);
54
}
55
56
RenderObject* HTMLDetailsElement::createSummaryRenderer(RenderArena* arena, Node* node)
57
{
58
    bool isMainSummary = false;
59
    if (node && node->hasTagName(summaryTag) && node->parentNode() && node->parentNode()->hasTagName(detailsTag))
60
        isMainSummary = node == static_cast<HTMLDetailsElement*>(node->parentNode())->m_mainSummary;
61
    return new (arena) RenderSummary(node, isMainSummary);
62
}
63
64
void HTMLDetailsElement::findMainSummary()
65
{
66
    Node* oldSummary = m_mainSummary;
67
    m_mainSummary = 0;
68
69
    for (Node* child = firstChild(); !m_mainSummary && child; child = child->nextSibling()) {
70
        if (child->hasTagName(summaryTag))
71
            m_mainSummary = child;
72
    }
73
74
    if (oldSummary != m_mainSummary && attached()) {
75
        detach();
76
        attach();
77
    }
78
}
79
80
void HTMLDetailsElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
81
{
82
    HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
83
    if (!changedByParser)
84
        findMainSummary();
85
}
86
87
void HTMLDetailsElement::finishParsingChildren()
88
{
89
    HTMLElement::finishParsingChildren();
90
    findMainSummary();
91
}
92
93
void HTMLDetailsElement::parseMappedAttribute(Attribute* attr)
94
{
95
    if (attr->name() == openAttr) {
96
        bool oldValue = m_isOpen;
97
        m_isOpen =  !attr->value().isNull();
98
        if (attached() && oldValue != m_isOpen) {
99
            detach();
100
            attach();
101
        }
102
    } else
103
        HTMLElement::parseMappedAttribute(attr);
104
}
105
106
bool HTMLDetailsElement::childShouldCreateRenderer(Node* child) const
107
{
108
    return m_isOpen || child == m_mainSummary;
109
}
110
111
void HTMLDetailsElement::defaultEventHandler(Event* event)
112
{
113
    HTMLElement::defaultEventHandler(event);
114
115
    if (!renderer() || !renderer()->isDetails() || !event->isMouseEvent() || event->type() != eventNames().clickEvent || event->defaultHandled())
116
        return;
117
118
    MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
119
    if (mouseEvent->button() != LeftButton)
120
        return;
121
122
    RenderDetails* renderDetails = static_cast<RenderDetails*>(renderer());
123
124
    float factor = document() && document()->frame() ? document()->frame()->pageZoomFactor() : 1.0;
125
    FloatPoint absolutePosition = renderDetails->absoluteToLocal(FloatPoint(mouseEvent->pageX() * factor, mouseEvent->pageY() * factor));
126
127
    if (renderDetails->interactiveArea().contains(absolutePosition.x(), absolutePosition.y()))
128
        setAttribute(openAttr, m_isOpen ? String() : String(""));
45
}
129
}
46
130
47
}
131
}
- a/Source/WebCore/html/HTMLDetailsElement.h +13 lines
Lines 29-38 class HTMLDetailsElement : public HTMLElement { a/Source/WebCore/html/HTMLDetailsElement.h_sec1
29
public:
29
public:
30
    static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document* document);
30
    static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document* document);
31
31
32
    static RenderObject* createSummaryRenderer(RenderArena*, Node*);
33
    Node* mainSummary() { return m_mainSummary; }
34
32
private:
35
private:
33
    HTMLDetailsElement(const QualifiedName&, Document*);
36
    HTMLDetailsElement(const QualifiedName&, Document*);
34
37
35
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
38
    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
39
    virtual void parseMappedAttribute(Attribute*);
40
    virtual bool childShouldCreateRenderer(Node*) const;
41
    virtual void childrenChanged(bool = false, Node* = 0, Node* = 0, int = 0);
42
    virtual void finishParsingChildren();
43
    virtual void defaultEventHandler(Event*);
44
45
    void findMainSummary();
46
47
    Node* m_mainSummary;
48
    bool m_isOpen;
36
49
37
};
50
};
38
51
- a/Source/WebCore/platform/LocalizationStrategy.h +1 lines
Lines 43-48 public: a/Source/WebCore/platform/LocalizationStrategy.h_sec1
43
    virtual String submitButtonDefaultLabel() = 0;
43
    virtual String submitButtonDefaultLabel() = 0;
44
    virtual String fileButtonChooseFileLabel() = 0;
44
    virtual String fileButtonChooseFileLabel() = 0;
45
    virtual String fileButtonNoFileSelectedLabel() = 0;
45
    virtual String fileButtonNoFileSelectedLabel() = 0;
46
    virtual String summaryDefaultLabel() = 0;
46
47
47
#if PLATFORM(MAC)
48
#if PLATFORM(MAC)
48
    virtual String copyImageUnknownFileLabel() = 0;
49
    virtual String copyImageUnknownFileLabel() = 0;
- a/Source/WebCore/platform/LocalizedStrings.cpp +5 lines
Lines 66-71 String fileButtonNoFileSelectedLabel() a/Source/WebCore/platform/LocalizedStrings.cpp_sec1
66
    return platformStrategies()->localizationStrategy()->fileButtonNoFileSelectedLabel();
66
    return platformStrategies()->localizationStrategy()->fileButtonNoFileSelectedLabel();
67
}
67
}
68
68
69
String summaryDefaultLabel()
70
{
71
    return platformStrategies()->localizationStrategy()->summaryDefaultLabel();
72
}
73
69
#if PLATFORM(MAC)
74
#if PLATFORM(MAC)
70
String copyImageUnknownFileLabel()
75
String copyImageUnknownFileLabel()
71
{
76
{
- a/Source/WebCore/platform/LocalizedStrings.h +1 lines
Lines 39-44 namespace WebCore { a/Source/WebCore/platform/LocalizedStrings.h_sec1
39
    String submitButtonDefaultLabel();
39
    String submitButtonDefaultLabel();
40
    String fileButtonChooseFileLabel();
40
    String fileButtonChooseFileLabel();
41
    String fileButtonNoFileSelectedLabel();
41
    String fileButtonNoFileSelectedLabel();
42
    String summaryDefaultLabel();
42
43
43
#if PLATFORM(MAC)
44
#if PLATFORM(MAC)
44
    String copyImageUnknownFileLabel();
45
    String copyImageUnknownFileLabel();
- a/Source/WebCore/platform/android/LocalizedStringsAndroid.cpp +5 lines
Lines 368-373 String resetButtonDefaultLabel() a/Source/WebCore/platform/android/LocalizedStringsAndroid.cpp_sec1
368
    return String("Reset");
368
    return String("Reset");
369
}
369
}
370
370
371
String summaryDefaultLabel()
372
{
373
    return String("Details");
374
}
375
371
String submitButtonDefaultLabel()
376
String submitButtonDefaultLabel()
372
{
377
{
373
    return String("Submit");
378
    return String("Submit");
- a/Source/WebCore/platform/brew/LocalizedStringsBrew.cpp +5 lines
Lines 46-51 String resetButtonDefaultLabel() a/Source/WebCore/platform/brew/LocalizedStringsBrew.cpp_sec1
46
    return "Reset";
46
    return "Reset";
47
}
47
}
48
48
49
String summaryDefaultLabel()
50
{
51
    return "Details";
52
}
53
49
String searchableIndexIntroduction()
54
String searchableIndexIntroduction()
50
{
55
{
51
    return "Searchable Index";
56
    return "Searchable Index";
- a/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp +5 lines
Lines 53-58 String resetButtonDefaultLabel() a/Source/WebCore/platform/efl/LocalizedStringsEfl.cpp_sec1
53
    return String::fromUTF8("Reset");
53
    return String::fromUTF8("Reset");
54
}
54
}
55
55
56
String summaryDefaultLabel()
57
{
58
    return String::fromUTF8("Details");
59
}
60
56
String searchableIndexIntroduction()
61
String searchableIndexIntroduction()
57
{
62
{
58
    return String::fromUTF8("_Searchable Index");
63
    return String::fromUTF8("_Searchable Index");
- a/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp +5 lines
Lines 66-71 String resetButtonDefaultLabel() a/Source/WebCore/platform/gtk/LocalizedStringsGtk.cpp_sec1
66
    return String::fromUTF8(_("Reset"));
66
    return String::fromUTF8(_("Reset"));
67
}
67
}
68
68
69
String summaryDefaultLabel()
70
{
71
    return String::fromUTF8(_("Details"));
72
}
73
69
String searchableIndexIntroduction()
74
String searchableIndexIntroduction()
70
{
75
{
71
    return String::fromUTF8(_("This is a searchable index. Enter search keywords: "));
76
    return String::fromUTF8(_("This is a searchable index. Enter search keywords: "));
- a/Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp +5 lines
Lines 48-53 String resetButtonDefaultLabel() a/Source/WebCore/platform/haiku/LocalizedStringsHaiku.cpp_sec1
48
    return "Reset";
48
    return "Reset";
49
}
49
}
50
50
51
String summaryDefaultLabel()
52
{
53
    return "Details";
54
}
55
51
String defaultLanguage()
56
String defaultLanguage()
52
{
57
{
53
    return "en";
58
    return "en";
- a/Source/WebCore/platform/wx/LocalizedStringsWx.cpp +5 lines
Lines 47-52 String resetButtonDefaultLabel() a/Source/WebCore/platform/wx/LocalizedStringsWx.cpp_sec1
47
    return String("Reset"); 
47
    return String("Reset"); 
48
}
48
}
49
49
50
String summaryDefaultLabel()
51
{
52
    return String("Details");
53
}
54
50
String platformDefaultLanguage() 
55
String platformDefaultLanguage() 
51
{ 
56
{ 
52
    return String("en"); 
57
    return String("en"); 
- a/Source/WebCore/rendering/RenderDetails.cpp -1 / +149 lines
Lines 21-40 a/Source/WebCore/rendering/RenderDetails.cpp_sec1
21
#include "config.h"
21
#include "config.h"
22
#include "RenderDetails.h"
22
#include "RenderDetails.h"
23
23
24
#include "CSSStyleSelector.h"
25
#include "HTMLDetailsElement.h"
26
#include "HTMLNames.h"
27
#include "LocalizedStrings.h"
28
#include "PaintInfo.h"
29
#include "RenderSummary.h"
30
#include "RenderText.h"
31
24
namespace WebCore {
32
namespace WebCore {
25
33
26
RenderDetails::RenderDetails(Node* element)
34
using namespace HTMLNames;
35
36
class OwnedSummaryRenderer : public RenderSummary {
37
public:
38
    OwnedSummaryRenderer(Node* node) : RenderSummary(node, true), m_text(0) {}
39
    virtual const char* renderName() const { return "OwnedSummaryRenderer"; }
40
41
private:
42
    virtual void styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
43
    {
44
        RenderSummary::styleDidChange(diff, oldStyle);
45
46
        if (!m_text) {
47
            RenderObject* child = firstChild();
48
49
            static String text = summaryDefaultLabel();
50
            m_text = new (renderArena()) RenderText(document(), text.impl());
51
            m_text->setStyle(style());
52
            addChild(m_text, child);
53
54
        } else
55
            m_text->setStyle(style());
56
    }
57
58
    RenderText* m_text;
59
};
60
61
RenderDetails::RenderDetails(Node* element, bool createOwnedSummary)
27
    : RenderBlock(element)
62
    : RenderBlock(element)
63
    , m_ownedSummary(0)
64
    , m_createOwnedSummary(createOwnedSummary)
28
{
65
{
29
}
66
}
30
67
68
PassRefPtr<RenderStyle> RenderDetails::createSummaryStyle()
69
{
70
    RefPtr<HTMLElement> summary(HTMLElement::create(summaryTag, document()));
71
    return document()->styleSelector()->styleForElement(summary.get(), style(), true);
72
}
73
31
void RenderDetails::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
74
void RenderDetails::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
32
{
75
{
33
    RenderBlock::styleDidChange(diff, oldStyle);
76
    RenderBlock::styleDidChange(diff, oldStyle);
34
77
78
    if (m_createOwnedSummary) {
79
        if (!m_ownedSummary) {
80
            m_ownedSummary = new (renderArena()) OwnedSummaryRenderer(document());
81
            m_ownedSummary->setStyle(createSummaryStyle());
82
            addChild(m_ownedSummary);
83
            addChild(createAnonymousBlock());
84
85
        } else
86
            m_ownedSummary->setStyle(createSummaryStyle());
87
    }
88
35
    // Ensure that if we ended up being inline that we set our replaced flag
89
    // Ensure that if we ended up being inline that we set our replaced flag
36
    // so that we're treated like an inline-block.
90
    // so that we're treated like an inline-block.
37
    setReplaced(isInline());
91
    setReplaced(isInline());
38
}
92
}
39
93
94
RenderObject* RenderDetails::layoutSpecialExcludedChild(bool relayoutChildren)
95
{
96
    RenderSummary* mainSummary = findMainSummary();
97
    if (!mainSummary) {
98
        m_interactiveArea = IntRect(0, 0, 0, 0);
99
        return 0;
100
    }
101
102
    if (relayoutChildren)
103
        mainSummary->setNeedsLayout(true);
104
    mainSummary->layoutIfNeeded();
105
106
    const int childWidth = logicalWidthForChild(mainSummary);
107
    const int start = borderStart() + paddingStart() + mainSummary->marginStart();
108
    const int end = borderEnd() + paddingEnd() + mainSummary->marginEnd();
109
    const int width = logicalWidth();
110
    const int contentWidth = width - (start + end);
111
    const bool ltr = style()->isLeftToRightDirection();
112
113
    ETextAlign align = mainSummary->style()->textAlign();
114
115
    if (align != LEFT && align != CENTER && align != RIGHT)
116
        align = ltr ? LEFT : RIGHT;
117
118
    if (align != CENTER && !ltr)
119
        align = align == LEFT ? RIGHT : LEFT;
120
121
    int left = 0;
122
    switch (align) {
123
    case LEFT:
124
        left = start;
125
        break;
126
    case CENTER:
127
        left = start + (contentWidth - childWidth) / 2;
128
        break;
129
    case RIGHT:
130
        left = width - end - childWidth;
131
        break;
132
    default:
133
        ASSERT_NOT_REACHED();
134
    }
135
136
    setLogicalLeftForChild(mainSummary, ltr ? left : width - (left + childWidth));
137
    setLogicalTopForChild(mainSummary, borderBefore() + paddingBefore() + mainSummary->marginBefore());
138
    setLogicalHeight(borderBefore() + paddingBefore() + mainSummary->marginBefore() + logicalHeightForChild(mainSummary) + mainSummary->marginAfter());
139
140
    m_interactiveArea = mainSummary->frameRect();
141
    return mainSummary;
142
}
143
144
RenderSummary* RenderDetails::findMainSummary()
145
{
146
    if (m_ownedSummary)
147
        return m_ownedSummary;
148
149
    if (!node() || !node()->hasTagName(detailsTag))
150
        return 0;
151
152
    HTMLDetailsElement* details = static_cast<HTMLDetailsElement*>(node());
153
154
    if (!details->mainSummary() || !details->mainSummary()->renderer() || !details->mainSummary()->renderer()->isSummary())
155
        return 0;
156
157
    return static_cast<RenderSummary*>(details->mainSummary()->renderer());
158
}
159
160
void RenderDetails::layout()
161
{
162
    RenderBlock::layout();
163
164
    switch (style()->writingMode()) {
165
    case TopToBottomWritingMode:
166
    case LeftToRightWritingMode:
167
        break;
168
    case RightToLeftWritingMode: {
169
        IntPoint pos = m_interactiveArea.location();
170
        pos.setX(width() - m_interactiveArea.x() - m_interactiveArea.width());
171
        m_interactiveArea.setLocation(pos);
172
        break;
173
    }
174
    case BottomToTopWritingMode: {
175
        IntPoint pos = m_interactiveArea.location();
176
        pos.setY(height() - m_interactiveArea.y() - m_interactiveArea.height());
177
        m_interactiveArea.setLocation(pos);
178
        break;
179
    }
180
    }
181
}
182
183
bool RenderDetails::isOpen() const
184
{
185
    return node() && node()->isElementNode() ? !static_cast<Element*>(node())->getAttribute(openAttr).isNull() : false;
186
}
187
40
}
188
}
- a/Source/WebCore/rendering/RenderDetails.h -1 / +17 lines
Lines 25-38 a/Source/WebCore/rendering/RenderDetails.h_sec1
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
class RenderSummary;
29
28
class RenderDetails : public RenderBlock {
30
class RenderDetails : public RenderBlock {
29
public:
31
public:
30
    explicit RenderDetails(Node*);
32
    explicit RenderDetails(Node*, bool createOwnedSummary);
33
34
    bool isOpen() const;
35
    IntRect interactiveArea() const { return m_interactiveArea; }
31
36
32
private:
37
private:
33
    virtual const char* renderName() const { return "RenderDetails"; }
38
    virtual const char* renderName() const { return "RenderDetails"; }
34
    virtual bool isDetails() const { return true; }
39
    virtual bool isDetails() const { return true; }
35
    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
40
    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
41
    virtual void layout();
42
43
    virtual bool avoidsFloats() const { return true; }
44
    virtual RenderObject* layoutSpecialExcludedChild(bool relayoutChildren);
45
46
    RenderSummary* findMainSummary();
47
    PassRefPtr<RenderStyle> createSummaryStyle();
48
49
    RenderSummary* m_ownedSummary;
50
    IntRect m_interactiveArea;
51
    bool m_createOwnedSummary;
36
};
52
};
37
53
38
inline RenderDetails* toRenderDetails(RenderObject* object)
54
inline RenderDetails* toRenderDetails(RenderObject* object)
- a/Source/WebCore/rendering/RenderDetailsMarker.cpp -2 / +171 lines
Lines 21-31 a/Source/WebCore/rendering/RenderDetailsMarker.cpp_sec1
21
#include "config.h"
21
#include "config.h"
22
#include "RenderDetailsMarker.h"
22
#include "RenderDetailsMarker.h"
23
23
24
#include "GraphicsContext.h"
25
#include "HTMLNames.h"
26
#include "PaintInfo.h"
27
#include "RenderDetails.h"
28
#include "RenderSummary.h"
29
24
namespace WebCore {
30
namespace WebCore {
25
31
26
RenderDetailsMarker::RenderDetailsMarker(Node* element)
32
using namespace HTMLNames;
27
    : RenderBlock(element)
33
34
RenderDetailsMarker::RenderDetailsMarker(RenderSummary* item)
35
    : RenderBox(item->document())
36
    , m_summary(item)
28
{
37
{
38
    setInline(true);
39
    setReplaced(true);
40
}
41
42
int RenderDetailsMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode) const
43
{
44
    return m_summary->lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);
45
}
46
47
int RenderDetailsMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode) const
48
{
49
    return m_summary->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
50
}
51
52
void RenderDetailsMarker::computePreferredLogicalWidths()
53
{
54
    ASSERT(preferredLogicalWidthsDirty());
55
56
    m_minPreferredLogicalWidth = 2 * style()->fontMetrics().ascent() / 3;
57
    m_maxPreferredLogicalWidth = m_minPreferredLogicalWidth;
58
59
    setPreferredLogicalWidthsDirty(false);
60
}
61
62
void RenderDetailsMarker::layout()
63
{
64
    ASSERT(needsLayout());
65
66
    setLogicalWidth(minPreferredLogicalWidth());
67
    setLogicalHeight(style()->fontMetrics().height());
68
69
    setMarginStart(0);
70
    setMarginEnd(style()->fontMetrics().ascent() - minPreferredLogicalWidth() + 1);
71
72
    setNeedsLayout(false);
73
}
74
75
IntRect RenderDetailsMarker::getRelativeMarkerRect() const
76
{
77
    IntRect relativeRect;
78
79
    int bulletWidth = minPreferredLogicalWidth();
80
    relativeRect = IntRect((logicalWidth() - bulletWidth) / 2, (logicalHeight() - bulletWidth) / 2, bulletWidth, bulletWidth);
81
82
    if (!style()->isHorizontalWritingMode()) {
83
        relativeRect = relativeRect.transposedRect();
84
        relativeRect.setX(width() - relativeRect.x() - relativeRect.width());
85
    }
86
87
    return relativeRect;
88
}
89
90
bool RenderDetailsMarker::isOpen() const
91
{
92
    if (!parent() || !parent()->isSummary() || !parent()->containingBlock() || !parent()->containingBlock()->isDetails())
93
        return false;
94
95
    return static_cast<RenderDetails*>(parent()->containingBlock())->isOpen();
96
}
97
98
namespace ArrowPath {
99
100
    enum Direction { right, left, up, down };
101
102
    static Path createPath(const FloatPoint* path)
103
    {
104
        Path result;
105
        result.moveTo(FloatPoint(path[0].x(), path[0].y()));
106
        for (int i = 1; i < 4; ++i)
107
            result.addLineTo(FloatPoint(path[i].x(), path[i].y()));
108
        return result;
109
    }
110
111
    static Path createPath(Direction direction)
112
    {
113
        switch (direction) {
114
        case right: {
115
            FloatPoint points[4] = { FloatPoint(0.0, 0.0), FloatPoint(0.86, 0.5), FloatPoint(0.0, 1.0), FloatPoint(0.0, 0.0) };
116
            return createPath(points);
117
        }
118
        case left: {
119
            FloatPoint points[4] = { FloatPoint(1.0, 0.0), FloatPoint(0.14, 0.5), FloatPoint(1.0, 1.0), FloatPoint(1.0, 0.0) };
120
            return createPath(points);
121
        }
122
        case up: {
123
            FloatPoint points[4] = { FloatPoint(0.0, 0.93), FloatPoint(0.5, 0.07), FloatPoint(1.0, 0.93), FloatPoint(0.0, 0.93) };
124
            return createPath(points);
125
        }
126
        case down: {
127
            FloatPoint points[4] = { FloatPoint(0.0, 0.07), FloatPoint(0.5, 0.93), FloatPoint(1.0, 0.07), FloatPoint(0.0, 0.07) };
128
            return createPath(points);
129
        }
130
        }
131
132
        return Path();
133
    }
134
};
135
136
static Path getCanonicalPath(bool isOpen, WritingMode writingMode, TextDirection textDirection)
137
{
138
    static Path down = ArrowPath::createPath(ArrowPath::down);
139
    static Path up = ArrowPath::createPath(ArrowPath::up);
140
    static Path left = ArrowPath::createPath(ArrowPath::left);
141
    static Path right = ArrowPath::createPath(ArrowPath::right);
142
143
    switch (writingMode) {
144
    case TopToBottomWritingMode:
145
        switch (textDirection) {
146
        case LTR: return isOpen ? down : right;
147
        case RTL: return isOpen ? down : left;
148
        }
149
    case RightToLeftWritingMode:
150
        switch (textDirection) {
151
        case LTR: return isOpen ? left : down;
152
        case RTL: return isOpen ? left : up;
153
        }
154
    case LeftToRightWritingMode:
155
        switch (textDirection) {
156
        case LTR: return isOpen ? right : down;
157
        case RTL: return isOpen ? right : up;
158
        }
159
    case BottomToTopWritingMode:
160
        switch (textDirection) {
161
        case LTR: return isOpen ? up : right;
162
        case RTL: return isOpen ? up : left;
163
        }
164
    }
165
166
    return Path();
167
}
168
169
Path RenderDetailsMarker::getPath(const IntPoint& origin) const
170
{
171
    IntRect rect = getRelativeMarkerRect();
172
    Path result = getCanonicalPath(isOpen(), style()->writingMode(), style()->direction());
173
    result.transform(AffineTransform().scale(rect.width()));
174
    result.translate(FloatSize(origin.x() + rect.x(), origin.y() + rect.y()));
175
    return result;
176
}
177
178
void RenderDetailsMarker::paint(PaintInfo& paintInfo, int tx, int ty)
179
{
180
    if (paintInfo.phase != PaintPhaseForeground || style()->visibility() != VISIBLE)
181
        return;
182
183
    IntPoint boxOrigin(tx + x(), ty + y());
184
    IntRect overflowRect(visualOverflowRect());
185
    overflowRect.move(boxOrigin.x(), boxOrigin.y());
186
    overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
187
188
    if (!paintInfo.rect.intersects(overflowRect))
189
        return;
190
191
    const Color color(style()->visitedDependentColor(CSSPropertyColor));
192
    paintInfo.context->setStrokeColor(color, style()->colorSpace());
193
    paintInfo.context->setStrokeStyle(SolidStroke);
194
    paintInfo.context->setStrokeThickness(1.0f);
195
    paintInfo.context->setFillColor(color, style()->colorSpace());
196
197
    paintInfo.context->fillPath(getPath(boxOrigin));
29
}
198
}
30
199
31
}
200
}
- a/Source/WebCore/rendering/RenderDetailsMarker.h -3 / +18 lines
Lines 21-37 a/Source/WebCore/rendering/RenderDetailsMarker.h_sec1
21
#ifndef RenderDetailsMarker_h
21
#ifndef RenderDetailsMarker_h
22
#define RenderDetailsMarker_h
22
#define RenderDetailsMarker_h
23
23
24
#include "RenderBlock.h"
24
#include "RenderBox.h"
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
class RenderDetailsMarker : public RenderBlock {
28
class RenderSummary;
29
30
class RenderDetailsMarker : public RenderBox {
29
public:
31
public:
30
    explicit RenderDetailsMarker(Node*);
32
    RenderDetailsMarker(RenderSummary*);
33
34
    virtual void computePreferredLogicalWidths();
31
35
32
private:
36
private:
33
    virtual const char* renderName() const { return "RenderDetailsMarker"; }
37
    virtual const char* renderName() const { return "RenderDetailsMarker"; }
34
    virtual bool isDetailsMarker() const { return true; }
38
    virtual bool isDetailsMarker() const { return true; }
39
    virtual void paint(PaintInfo&, int tx, int ty);
40
    virtual void layout();
41
    virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
42
    virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
43
44
    IntRect getRelativeMarkerRect() const;
45
46
    bool isOpen() const;
47
    Path getPath(const IntPoint& origin) const;
48
49
    RenderSummary* m_summary;
35
};
50
};
36
51
37
inline RenderDetailsMarker* toRenderDetailsMarker(RenderObject* object)
52
inline RenderDetailsMarker* toRenderDetailsMarker(RenderObject* object)
- a/Source/WebCore/rendering/RenderObject.cpp +4 lines
Lines 38-43 a/Source/WebCore/rendering/RenderObject.cpp_sec1
38
#include "Frame.h"
38
#include "Frame.h"
39
#include "FrameView.h"
39
#include "FrameView.h"
40
#include "GraphicsContext.h"
40
#include "GraphicsContext.h"
41
#include "HTMLDetailsElement.h"
41
#include "HTMLNames.h"
42
#include "HTMLNames.h"
42
#include "HitTestResult.h"
43
#include "HitTestResult.h"
43
#include "Page.h"
44
#include "Page.h"
Lines 130-135 RenderObject* RenderObject::createObject(Node* node, RenderStyle* style) a/Source/WebCore/rendering/RenderObject.cpp_sec2
130
    if (node->hasTagName(rtTag) && style->display() == BLOCK)
131
    if (node->hasTagName(rtTag) && style->display() == BLOCK)
131
        return new (arena) RenderRubyText(node);
132
        return new (arena) RenderRubyText(node);
132
133
134
    if (node->hasTagName(summaryTag))
135
        return HTMLDetailsElement::createSummaryRenderer(arena, node);
136
133
    switch (style->display()) {
137
    switch (style->display()) {
134
        case NONE:
138
        case NONE:
135
            return 0;
139
            return 0;
- a/Source/WebCore/rendering/RenderSummary.cpp -2 / +124 lines
Lines 21-31 a/Source/WebCore/rendering/RenderSummary.cpp_sec1
21
#include "config.h"
21
#include "config.h"
22
#include "RenderSummary.h"
22
#include "RenderSummary.h"
23
23
24
#include "HTMLNames.h"
25
#include "RenderDetailsMarker.h"
26
#include "RenderView.h"
27
24
namespace WebCore {
28
namespace WebCore {
25
29
26
RenderSummary::RenderSummary(Node* element)
30
using namespace HTMLNames;
27
    : RenderBlock(element)
31
32
RenderSummary::RenderSummary(Node* node, bool markerIsVisible)
33
    : RenderBlock(node)
34
    , m_marker(0)
35
    , m_markerIsVisible(markerIsVisible)
36
{
37
}
38
39
void RenderSummary::destroy()
40
{
41
    if (m_marker) {
42
        m_marker->destroy();
43
        m_marker = 0;
44
    }
45
    RenderBlock::destroy();
46
}
47
48
void RenderSummary::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
49
{
50
    RenderBlock::styleDidChange(diff, oldStyle);
51
52
    if (m_markerIsVisible && !m_marker) {
53
        m_marker = new (renderArena()) RenderDetailsMarker(this);
54
        setNeedsLayout(true);
55
    }
56
57
    if (!m_markerIsVisible && m_marker) {
58
        m_marker->destroy();
59
        m_marker = 0;
60
        setNeedsLayout(true);
61
    }
62
63
    if (m_marker) {
64
        RefPtr<RenderStyle> markerStyle = RenderStyle::create();
65
        markerStyle->inheritFrom(style());
66
        m_marker->setStyle(markerStyle.release());
67
    }
68
69
    // Ensure that if we ended up being inline that we set our replaced flag
70
    // so that we're treated like an inline-block.
71
    setReplaced(isInline());
72
}
73
74
void RenderSummary::layout()
75
{
76
    ASSERT(needsLayout());
77
78
    updateMarkerLocation();
79
    RenderBlock::layout();
80
}
81
82
RenderObject* RenderSummary::getParentOfFirstLineBox(RenderBlock* curr)
28
{
83
{
84
    RenderObject* firstChild = curr->firstChild();
85
    if (!firstChild)
86
        return 0;
87
88
    for (RenderObject* currChild = firstChild; currChild; currChild = currChild->nextSibling()) {
89
        if (currChild == m_marker)
90
            continue;
91
92
        if (currChild->isInline() && (!currChild->isRenderInline() || curr->generatesLineBoxesForInlineChild(currChild)))
93
            return curr;
94
95
        if (currChild->isFloating() || currChild->isPositioned())
96
            continue;
97
98
        if (currChild->isTable() || !currChild->isRenderBlock() || (currChild->isBox() && toRenderBox(currChild)->isWritingModeRoot()))
99
            break;
100
101
        RenderObject* lineBox = getParentOfFirstLineBox(toRenderBlock(currChild));
102
        if (lineBox)
103
            return lineBox;
104
    }
105
106
    return 0;
107
}
108
109
RenderObject* RenderSummary::firstNonMarkerChild(RenderObject* parent)
110
{
111
    RenderObject* result = parent->firstChild();
112
    while (result && result->isListMarker())
113
        result = result->nextSibling();
114
    return result;
115
}
116
117
void RenderSummary::updateMarkerLocation()
118
{
119
    // Sanity check the location of our marker.
120
    if (m_marker) {
121
        RenderObject* markerPar = m_marker->parent();
122
        RenderObject* lineBoxParent = getParentOfFirstLineBox(this);
123
        if (!lineBoxParent) {
124
            // If the marker is currently contained inside an anonymous box,
125
            // then we are the only item in that anonymous box (since no line box
126
            // parent was found).  It's ok to just leave the marker where it is
127
            // in this case.
128
            if (markerPar && markerPar->isAnonymousBlock())
129
                lineBoxParent = markerPar;
130
            else
131
                lineBoxParent = this;
132
        }
133
134
        if (markerPar != lineBoxParent || m_marker->preferredLogicalWidthsDirty()) {
135
            // Removing and adding the marker can trigger repainting in
136
            // containers other than ourselves, so we need to disable LayoutState.
137
            view()->disableLayoutState();
138
            updateFirstLetter();
139
            m_marker->remove();
140
            if (!lineBoxParent)
141
                lineBoxParent = this;
142
            lineBoxParent->addChild(m_marker, firstNonMarkerChild(lineBoxParent));
143
144
            if (m_marker->preferredLogicalWidthsDirty())
145
                m_marker->computePreferredLogicalWidths();
146
147
//            m_marker->adjustLogicalWidths();
148
            view()->enableLayoutState();
149
        }
150
    }
29
}
151
}
30
152
31
}
153
}
- a/Source/WebCore/rendering/RenderSummary.h -2 / +18 lines
Lines 25-37 a/Source/WebCore/rendering/RenderSummary.h_sec1
25
25
26
namespace WebCore {
26
namespace WebCore {
27
27
28
class RenderDetailsMarker;
29
28
class RenderSummary : public RenderBlock {
30
class RenderSummary : public RenderBlock {
29
public:
31
public:
30
    explicit RenderSummary(Node*);
32
    explicit RenderSummary(Node*, bool markerIsVisible);
31
33
32
private:
34
    bool markerIsVisible() const { return m_markerIsVisible; }
35
    bool isOpen() const;
36
37
protected:
33
    virtual const char* renderName() const { return "RenderSummary"; }
38
    virtual const char* renderName() const { return "RenderSummary"; }
34
    virtual bool isSummary() const { return true; }
39
    virtual bool isSummary() const { return true; }
40
    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
41
    virtual void destroy();
42
    virtual void layout();
43
44
private:
45
    void updateMarkerLocation();
46
    RenderObject* getParentOfFirstLineBox(RenderBlock*);
47
    RenderObject* firstNonMarkerChild(RenderObject* parent);
48
49
    RenderDetailsMarker* m_marker;
50
    bool m_markerIsVisible;
35
};
51
};
36
52
37
inline RenderSummary* toRenderSummary(RenderObject* object)
53
inline RenderSummary* toRenderSummary(RenderObject* object)
- a/Source/WebKit/chromium/ChangeLog +13 lines
Lines 1-3 a/Source/WebKit/chromium/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizedStrings. It is used to provide
9
        the default label to be used by a <details> tag that has no <summary> child.
10
11
        * src/LocalizedStrings.cpp:
12
        (WebCore::summaryDefaultLabel):
13
1
2011-02-08  Adam Barth  <abarth@webkit.org>
14
2011-02-08  Adam Barth  <abarth@webkit.org>
2
15
3
        Reviewed by Eric Seidel.
16
        Reviewed by Eric Seidel.
- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +6 lines
Lines 87-92 String fileButtonChooseFileLabel() a/Source/WebKit/chromium/src/LocalizedStrings.cpp_sec1
87
    return query(WebLocalizedString::FileButtonChooseFileLabel);
87
    return query(WebLocalizedString::FileButtonChooseFileLabel);
88
}
88
}
89
89
90
String summaryDefaultLabel()
91
{
92
    notImplemented();
93
    return String("Details");
94
}
95
90
String fileButtonNoFileSelectedLabel()
96
String fileButtonNoFileSelectedLabel()
91
{
97
{
92
    return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
98
    return query(WebLocalizedString::FileButtonNoFileSelectedLabel);
- a/Source/WebKit/mac/ChangeLog +14 lines
Lines 1-3 a/Source/WebKit/mac/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizationStrategy class. It is used to
9
        provide the default label to be used by a <details> tag that has no <summary> child.
10
11
        * WebCoreSupport/WebPlatformStrategies.h:
12
        * WebCoreSupport/WebPlatformStrategies.mm:
13
        (WebPlatformStrategies::summaryDefaultLabel):
14
1
2011-02-08  Adam Barth  <abarth@webkit.org>
15
2011-02-08  Adam Barth  <abarth@webkit.org>
2
16
3
        Reviewed by Eric Seidel.
17
        Reviewed by Eric Seidel.
- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h +1 lines
Lines 55-60 private: a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h_sec1
55
    virtual WTF::String fileButtonChooseFileLabel();
55
    virtual WTF::String fileButtonChooseFileLabel();
56
    virtual WTF::String fileButtonNoFileSelectedLabel();
56
    virtual WTF::String fileButtonNoFileSelectedLabel();
57
    virtual WTF::String copyImageUnknownFileLabel();
57
    virtual WTF::String copyImageUnknownFileLabel();
58
    virtual WTF::String summaryDefaultLabel();
58
#if ENABLE(CONTEXT_MENUS)
59
#if ENABLE(CONTEXT_MENUS)
59
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
60
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
60
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
61
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
- a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm +5 lines
Lines 109-114 String WebPlatformStrategies::submitButtonDefaultLabel() a/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm_sec1
109
    return UI_STRING("Submit", "default label for Submit buttons in forms on web pages");
109
    return UI_STRING("Submit", "default label for Submit buttons in forms on web pages");
110
}
110
}
111
111
112
String WebPlatformStrategies::summaryDefaultLabel()
113
{
114
    return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
115
}
116
112
String WebPlatformStrategies::fileButtonChooseFileLabel()
117
String WebPlatformStrategies::fileButtonChooseFileLabel()
113
{
118
{
114
    return UI_STRING("Choose File", "title for file button used in HTML forms");
119
    return UI_STRING("Choose File", "title for file button used in HTML forms");
- a/Source/WebKit/qt/ChangeLog +14 lines
Lines 1-3 a/Source/WebKit/qt/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizationStrategy class. It is used to
9
        provide the default label to be used by a <details> tag that has no <summary> child.
10
11
        * WebCoreSupport/WebPlatformStrategies.cpp:
12
        (WebPlatformStrategies::summaryDefaultLabel):
13
        * WebCoreSupport/WebPlatformStrategies.h:
14
1
2011-02-08  Adam Barth  <abarth@webkit.org>
15
2011-02-08  Adam Barth  <abarth@webkit.org>
2
16
3
        Reviewed by Eric Seidel.
17
        Reviewed by Eric Seidel.
- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp +5 lines
Lines 170-175 String WebPlatformStrategies::fileButtonNoFileSelectedLabel() a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.cpp_sec1
170
    return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
170
    return QCoreApplication::translate("QWebPage", "No file selected", "text to display in file button used in HTML forms when no file is selected");
171
}
171
}
172
172
173
String WebPlatformStrategies::summaryDefaultLabel()
174
{
175
    return QCoreApplication::translate("QWebPage", "Details", "text to display in <details> tag when it has no <summary> child");
176
}
177
173
String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow()
178
String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow()
174
{
179
{
175
    return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
180
    return QCoreApplication::translate("QWebPage", "Open in New Window", "Open in New Window context menu item");
- a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h +1 lines
Lines 60-65 private: a/Source/WebKit/qt/WebCoreSupport/WebPlatformStrategies.h_sec1
60
    virtual WTF::String submitButtonDefaultLabel();
60
    virtual WTF::String submitButtonDefaultLabel();
61
    virtual WTF::String fileButtonChooseFileLabel();
61
    virtual WTF::String fileButtonChooseFileLabel();
62
    virtual WTF::String fileButtonNoFileSelectedLabel();
62
    virtual WTF::String fileButtonNoFileSelectedLabel();
63
    virtual WTF::String summaryDefaultLabel();
63
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
64
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
64
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
65
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
65
    virtual WTF::String contextMenuItemTagCopyLinkToClipboard();
66
    virtual WTF::String contextMenuItemTagCopyLinkToClipboard();
- a/Source/WebKit/win/ChangeLog +14 lines
Lines 1-3 a/Source/WebKit/win/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizationStrategy class. It is used to
9
        provide the default label to be used by a <details> tag that has no <summary> child.
10
11
        * WebCoreSupport/WebPlatformStrategies.cpp:
12
        (WebPlatformStrategies::summaryDefaultLabel):
13
        * WebCoreSupport/WebPlatformStrategies.h:
14
1
2011-02-08  Adam Barth  <abarth@webkit.org>
15
2011-02-08  Adam Barth  <abarth@webkit.org>
2
16
3
        Reviewed by Eric Seidel.
17
        Reviewed by Eric Seidel.
- a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp +5 lines
Lines 133-138 String WebPlatformStrategies::fileButtonNoFileSelectedLabel() a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.cpp_sec1
133
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
133
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
134
}
134
}
135
135
136
String WebPlatformStrategies::summaryDefaultLabel()
137
{
138
    return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
139
}
140
136
String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow()
141
String WebPlatformStrategies::contextMenuItemTagOpenLinkInNewWindow()
137
{
142
{
138
    return UI_STRING("Open Link in New Window", "Open in New Window context menu item");
143
    return UI_STRING("Open Link in New Window", "Open in New Window context menu item");
- a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h +1 lines
Lines 54-59 private: a/Source/WebKit/win/WebCoreSupport/WebPlatformStrategies.h_sec1
54
    virtual WTF::String submitButtonDefaultLabel();
54
    virtual WTF::String submitButtonDefaultLabel();
55
    virtual WTF::String fileButtonChooseFileLabel();
55
    virtual WTF::String fileButtonChooseFileLabel();
56
    virtual WTF::String fileButtonNoFileSelectedLabel();
56
    virtual WTF::String fileButtonNoFileSelectedLabel();
57
    virtual WTF::String summaryDefaultLabel();
57
#if ENABLE(CONTEXT_MENUS)
58
#if ENABLE(CONTEXT_MENUS)
58
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
59
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
59
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
60
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
- a/Source/WebKit/wince/ChangeLog +14 lines
Lines 1-3 a/Source/WebKit/wince/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizationStrategy class. It is used to
9
        provide the default label to be used by a <details> tag that has no <summary> child.
10
11
        * WebCoreSupport/PlatformStrategiesWinCE.cpp:
12
        (PlatformStrategiesWinCE::summaryDefaultLabel):
13
        * WebCoreSupport/PlatformStrategiesWinCE.h:
14
1
2011-02-08  Adam Barth  <abarth@webkit.org>
15
2011-02-08  Adam Barth  <abarth@webkit.org>
2
16
3
        Reviewed by Eric Seidel.
17
        Reviewed by Eric Seidel.
- a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp +5 lines
Lines 137-142 String PlatformStrategiesWinCE::fileButtonNoFileSelectedLabel() a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.cpp_sec1
137
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
137
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
138
}
138
}
139
139
140
String PlatformStrategiesWinCE::summaryDefaultLabel()
141
{
142
    return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
143
}
144
140
String PlatformStrategiesWinCE::contextMenuItemTagOpenLinkInNewWindow()
145
String PlatformStrategiesWinCE::contextMenuItemTagOpenLinkInNewWindow()
141
{
146
{
142
    return UI_STRING("Open Link in New Window", "Open in New Window context menu item");
147
    return UI_STRING("Open Link in New Window", "Open in New Window context menu item");
- a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h +1 lines
Lines 53-58 private: a/Source/WebKit/wince/WebCoreSupport/PlatformStrategiesWinCE.h_sec1
53
    virtual WTF::String submitButtonDefaultLabel();
53
    virtual WTF::String submitButtonDefaultLabel();
54
    virtual WTF::String fileButtonChooseFileLabel();
54
    virtual WTF::String fileButtonChooseFileLabel();
55
    virtual WTF::String fileButtonNoFileSelectedLabel();
55
    virtual WTF::String fileButtonNoFileSelectedLabel();
56
    virtual WTF::String summaryDefaultLabel();
56
#if ENABLE(CONTEXT_MENUS)
57
#if ENABLE(CONTEXT_MENUS)
57
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
58
    virtual WTF::String contextMenuItemTagOpenLinkInNewWindow();
58
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
59
    virtual WTF::String contextMenuItemTagDownloadLinkToDisk();
- a/Source/WebKit2/ChangeLog +14 lines
Lines 1-3 a/Source/WebKit2/ChangeLog_sec1
1
2011-02-08  Luiz Agostini  <luiz.agostini@openbossa.org>
2
3
        Reviewed by NOBODY (OOPS!).
4
5
        RenderDetails: layout the first <summary> element child of a <details> element
6
        https://bugs.webkit.org/show_bug.cgi?id=51071
7
8
        The method summaryDefaultLabel was added to LocalizationStrategy class. It is used to
9
        provide the default label to be used by a <details> tag that has no <summary> child.
10
11
        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
12
        (WebKit::WebPlatformStrategies::summaryDefaultLabel):
13
        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
14
1
2011-02-08  Adam Barth  <abarth@webkit.org>
15
2011-02-08  Adam Barth  <abarth@webkit.org>
2
16
3
        Reviewed by Eric Seidel.
17
        Reviewed by Eric Seidel.
- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp +5 lines
Lines 175-180 String WebPlatformStrategies::fileButtonNoFileSelectedLabel() a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp_sec1
175
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
175
    return UI_STRING("no file selected", "text to display in file button used in HTML forms when no file is selected");
176
}
176
}
177
177
178
String WebPlatformStrategies::summaryDefaultLabel()
179
{
180
    return UI_STRING("Details", "text to display in <details> tag when it has no <summary> child");
181
}
182
178
#if PLATFORM(MAC)
183
#if PLATFORM(MAC)
179
String WebPlatformStrategies::copyImageUnknownFileLabel()
184
String WebPlatformStrategies::copyImageUnknownFileLabel()
180
{
185
{
- a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h -1 / +1 lines
Lines 58-63 private: a/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h_sec1
58
    virtual String submitButtonDefaultLabel();
58
    virtual String submitButtonDefaultLabel();
59
    virtual String fileButtonChooseFileLabel();
59
    virtual String fileButtonChooseFileLabel();
60
    virtual String fileButtonNoFileSelectedLabel();
60
    virtual String fileButtonNoFileSelectedLabel();
61
    virtual WTF::String summaryDefaultLabel();
61
#if PLATFORM(MAC)
62
#if PLATFORM(MAC)
62
    virtual String copyImageUnknownFileLabel();
63
    virtual String copyImageUnknownFileLabel();
63
#endif
64
#endif
64
- 

Return to Bug 51071