Diff
Modified: trunk/LayoutTests/ChangeLog (91892 => 91893)
--- trunk/LayoutTests/ChangeLog 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/LayoutTests/ChangeLog 2011-07-28 03:00:54 UTC (rev 91893)
@@ -1,3 +1,13 @@
+2011-07-27 Rachel Blum <gr...@chromium.org>
+
+ Implement sizes attribute for link tag from HTML5
+ https://bugs.webkit.org/show_bug.cgi?id=37674
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/icon-size-property-expected.txt: Added.
+ * fast/dom/icon-size-property.html: Added.
+
2011-07-27 Ryosuke Niwa <rn...@webkit.org>
Fix Chromium test expectations for http://crbug.com/88911
Added: trunk/LayoutTests/fast/dom/icon-size-property-expected.txt (0 => 91893)
--- trunk/LayoutTests/fast/dom/icon-size-property-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-size-property-expected.txt 2011-07-28 03:00:54 UTC (rev 91893)
@@ -0,0 +1,17 @@
+Tests for sizes attribute of the link element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS icon.sizes.length is 2
+PASS icon.sizes.value is "23x47 19x42"
+PASS icon.sizes.length is 3
+PASS icon.sizes.value is "10x10 20x20 30x30"
+PASS icon.sizes.length is 0
+PASS icon.sizes.value is ""
+PASS icon.sizes.length is 0
+PASS icon.sizes.value is ""
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/icon-size-property.html (0 => 91893)
--- trunk/LayoutTests/fast/dom/icon-size-property.html (rev 0)
+++ trunk/LayoutTests/fast/dom/icon-size-property.html 2011-07-28 03:00:54 UTC (rev 91893)
@@ -0,0 +1,38 @@
+<html>
+<head>
+ <link id="rel-icon" rel="icon" sizes="23x47 19x42" type="image/x-icon" href=""
+ <link id="no-sizes" rel="icon" type="image/x-icon" href=""
+ <link id="empty-sizes" rel="icon" sizes="" type="image/x-icon" href=""
+ <link rel="stylesheet" href=""
+
+ <script src=""
+</head>
+<body>
+ <p id="description"></p>
+ <div id="console"></div>
+
+ <script>
+ description('Tests for sizes attribute of the link element.');
+
+ var icon=document.getElementById("rel-icon");
+
+ shouldEvaluateTo('icon.sizes.length',2);
+ shouldBeEqualToString('icon.sizes.value',"23x47 19x42");
+
+ icon.sizes="10x10 20x20 30x30";
+ shouldEvaluateTo('icon.sizes.length',3);
+ shouldBeEqualToString('icon.sizes.value',"10x10 20x20 30x30");
+
+ var icon=document.getElementById("no-sizes");
+ shouldEvaluateTo('icon.sizes.length',0);
+ shouldBeEqualToString('icon.sizes.value',"");
+
+ var icon=document.getElementById("empty-sizes");
+ shouldEvaluateTo('icon.sizes.length',0);
+ shouldBeEqualToString('icon.sizes.value',"");
+
+ var successfullyParsed = true;
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (91892 => 91893)
--- trunk/Source/WebCore/ChangeLog 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/ChangeLog 2011-07-28 03:00:54 UTC (rev 91893)
@@ -1,3 +1,29 @@
+2011-07-27 Rachel Blum <gr...@chromium.org>
+
+ Implement sizes attribute for link tag from HTML5
+ https://bugs.webkit.org/show_bug.cgi?id=37674
+
+ Reviewed by Dimitri Glazkov.
+
+ Test: fast/dom/icon-size-property.html
+
+ * WebCore.gypi:
+ * WebCore.pro:
+ * bindings/js/JSHTMLLinkElementCustom.cpp:
+ (WebCore::JSHTMLLinkElement::sizes):
+ (WebCore::JSHTMLLinkElement::setSizes):
+ * bindings/v8/custom/V8HTMLLinkElementCustom.cpp: Added.
+ (WebCore::V8HTMLLinkElement::sizesAccessorGetter):
+ (WebCore::V8HTMLLinkElement::sizesAccessorSetter):
+ * html/HTMLAttributeNames.in:
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::HTMLLinkElement):
+ (WebCore::HTMLLinkElement::parseMappedAttribute):
+ (WebCore::HTMLLinkElement::sizes):
+ (WebCore::HTMLLinkElement::setSizes):
+ * html/HTMLLinkElement.h:
+ * html/HTMLLinkElement.idl:
+
2011-07-27 Pratik Solanki <psola...@apple.com>
Incorrect arguments passed to LOG statement
Modified: trunk/Source/WebCore/WebCore.gypi (91892 => 91893)
--- trunk/Source/WebCore/WebCore.gypi 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/WebCore.gypi 2011-07-28 03:00:54 UTC (rev 91893)
@@ -2154,6 +2154,7 @@
'bindings/v8/custom/V8HTMLImageElementConstructor.cpp',
'bindings/v8/custom/V8HTMLImageElementConstructor.h',
'bindings/v8/custom/V8HTMLInputElementCustom.cpp',
+ 'bindings/v8/custom/V8HTMLLinkElementCustom.cpp',
'bindings/v8/custom/V8HTMLOptionElementConstructor.cpp',
'bindings/v8/custom/V8HTMLOptionElementConstructor.h',
'bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp',
Modified: trunk/Source/WebCore/WebCore.pro (91892 => 91893)
--- trunk/Source/WebCore/WebCore.pro 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/WebCore.pro 2011-07-28 03:00:54 UTC (rev 91893)
@@ -184,6 +184,7 @@
bindings/v8/custom/V8HTMLFrameSetElementCustom.cpp \
bindings/v8/custom/V8HTMLImageElementConstructor.cpp \
bindings/v8/custom/V8HTMLInputElementCustom.cpp \
+ bindings/v8/custom/V8HTMLLinkElementCustom.cpp \
bindings/v8/custom/V8HTMLOptionElementConstructor.cpp \
bindings/v8/custom/V8HTMLOptionsCollectionCustom.cpp \
bindings/v8/custom/V8HTMLOutputElementCustom.cpp \
Modified: trunk/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp (91892 => 91893)
--- trunk/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/bindings/js/JSHTMLLinkElementCustom.cpp 2011-07-28 03:00:54 UTC (rev 91893)
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,9 +28,25 @@
#include "JSHTMLLinkElement.h"
#include "HTMLLinkElement.h"
+#include "JSDOMBinding.h"
+#include "JSDOMSettableTokenList.h"
+#include <wtf/GetPtr.h>
using namespace JSC;
namespace WebCore {
+JSValue JSHTMLLinkElement::sizes(ExecState* exec) const
+{
+ HTMLLinkElement* output = static_cast<HTMLLinkElement*>(impl());
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(output->sizes()));
+ return result;
}
+
+void JSHTMLLinkElement::setSizes(ExecState* exec, JSValue value)
+{
+ HTMLLinkElement* output = static_cast<HTMLLinkElement*>(impl());
+ output->setSizes(valueToStringWithNullCheck(exec, value));
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp (0 => 91893)
--- trunk/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/v8/custom/V8HTMLLinkElementCustom.cpp 2011-07-28 03:00:54 UTC (rev 91893)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "V8HTMLLinkElement.h"
+
+#include "HTMLLinkElement.h"
+#include "V8Binding.h"
+#include "V8DOMSettableTokenList.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8HTMLLinkElement::sizesAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLLinkElement.sizes._get");
+ HTMLLinkElement* imp = V8HTMLLinkElement::toNative(info.Holder());
+ return toV8(imp->sizes());
+}
+
+void V8HTMLLinkElement::sizesAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
+{
+ INC_STATS("DOM.HTMLLinkElement.sizes._set");
+ HTMLLinkElement* imp = V8HTMLLinkElement::toNative(info.Holder());
+ imp->setSizes(toWebCoreString(value));
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (91892 => 91893)
--- trunk/Source/WebCore/html/HTMLAttributeNames.in 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in 2011-07-28 03:00:54 UTC (rev 91893)
@@ -272,6 +272,7 @@
selected
shape
size
+sizes
sortable
sortdirection
span
Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (91892 => 91893)
--- trunk/Source/WebCore/html/HTMLLinkElement.cpp 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp 2011-07-28 03:00:54 UTC (rev 91893)
@@ -4,6 +4,7 @@
* (C) 2001 Dirk Mueller (muel...@kde.org)
* Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2009 Rob Buis (rwlb...@gmail.com)
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -53,6 +54,7 @@
inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* document, bool createdByParser)
: HTMLElement(tagName, document)
, m_linkLoader(this)
+ , m_sizes(DOMSettableTokenList::create())
, m_loading(false)
, m_isEnabledViaScript(false)
, m_createdByParser(createdByParser)
@@ -133,6 +135,9 @@
} else if (attr->name() == typeAttr) {
m_type = attr->value();
process();
+ } else if (attr->name() == sizesAttr) {
+ setSizes(attr->value());
+ process();
} else if (attr->name() == mediaAttr) {
m_media = attr->value().string().lower();
process();
@@ -440,4 +445,14 @@
return m_sheet && m_sheet->disabled();
}
+DOMSettableTokenList* HTMLLinkElement::sizes() const
+{
+ return m_sizes.get();
}
+
+void HTMLLinkElement::setSizes(const String& value)
+{
+ m_sizes->setValue(value);
+}
+
+} // namespace WebCore
Modified: trunk/Source/WebCore/html/HTMLLinkElement.h (91892 => 91893)
--- trunk/Source/WebCore/html/HTMLLinkElement.h 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/html/HTMLLinkElement.h 2011-07-28 03:00:54 UTC (rev 91893)
@@ -2,6 +2,7 @@
* Copyright (C) 1999 Lars Knoll (kn...@kde.org)
* (C) 1999 Antti Koivisto (koivi...@kde.org)
* Copyright (C) 2003, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -26,6 +27,7 @@
#include "CSSStyleSheet.h"
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
+#include "DOMSettableTokenList.h"
#include "HTMLElement.h"
#include "IconURL.h"
#include "LinkLoader.h"
@@ -53,11 +55,13 @@
StyleSheet* sheet() const;
- // FIXME: This should be remaned isStyleSheetLoading as this is only used for stylesheets.
+ // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
bool isLoading() const;
bool isEnabledViaScript() const { return m_isEnabledViaScript; }
bool disabled() const;
void setDisabled(bool);
+ void setSizes(const String&);
+ DOMSettableTokenList* sizes() const;
private:
virtual void parseMappedAttribute(Attribute*);
@@ -99,6 +103,7 @@
KURL m_url;
String m_type;
String m_media;
+ RefPtr<DOMSettableTokenList> m_sizes;
LinkRelAttribute m_relAttribute;
bool m_loading;
bool m_isEnabledViaScript;
Modified: trunk/Source/WebCore/html/HTMLLinkElement.idl (91892 => 91893)
--- trunk/Source/WebCore/html/HTMLLinkElement.idl 2011-07-28 02:57:21 UTC (rev 91892)
+++ trunk/Source/WebCore/html/HTMLLinkElement.idl 2011-07-28 03:00:54 UTC (rev 91893)
@@ -1,6 +1,7 @@
/*
* Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
+ * Copyright (C) 2011 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -28,6 +29,9 @@
attribute [Reflect] DOMString media;
attribute [Reflect] DOMString rel;
attribute [Reflect] DOMString rev;
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+ attribute [Custom] DOMSettableTokenList sizes;
+#endif
attribute [Reflect] DOMString target;
attribute [Reflect] DOMString type;