[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 12:56:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 90a7267779a034bcaf931e6b79c932c5b4c3da2a
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 2 07:52:42 2010 +0000
2010-09-02 Ilya Sherman <isherman at google.com>
Reviewed by Eric Seidel.
Decompose computing an element's inherited language, expose this
capability to clients (in particular, for Chromium).
https://bugs.webkit.org/show_bug.cgi?id=44803
No new tests -- just refactoring + exposing code.
* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
* dom/Element.cpp:
(WebCore::Element::computeInheritedLang):
* dom/Element.h:
2010-09-02 Ilya Sherman <isherman at google.com>
Reviewed by Eric Seidel.
Exposing computing an element's inherited language, per the DOM, in the
Chromium API -- primarily for use with autofill i18n.
https://bugs.webkit.org/show_bug.cgi?id=44803
* public/WebElement.h:
* src/WebElement.cpp:
(WebKit::WebElement::computeInheritedLanguage):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66647 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 34d72b1..a874b0f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-09-02 Ilya Sherman <isherman at google.com>
+
+ Reviewed by Eric Seidel.
+
+ Decompose computing an element's inherited language, expose this
+ capability to clients (in particular, for Chromium).
+ https://bugs.webkit.org/show_bug.cgi?id=44803
+
+ No new tests -- just refactoring + exposing code.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
+ * dom/Element.cpp:
+ (WebCore::Element::computeInheritedLang):
+ * dom/Element.h:
+
2010-08-31 Philippe Normand <pnormand at igalia.com>
Reviewed by Eric Carlson.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index fe59a35..d6f04aa 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -2601,22 +2601,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
return true;
break;
case CSSSelector::PseudoLang: {
- Node* n = e;
- AtomicString value;
- // The language property is inherited, so we iterate over the parents
- // to find the first language.
- while (n && value.isNull()) {
- if (n->isElementNode()) {
- // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
- value = static_cast<Element*>(n)->fastGetAttribute(XMLNames::langAttr);
- if (value.isNull())
- value = static_cast<Element*>(n)->fastGetAttribute(langAttr);
- } else if (n->isDocumentNode())
- // checking the MIME content-language
- value = static_cast<Document*>(n)->contentLanguage();
-
- n = n->parent();
- }
+ AtomicString value = e->computeInheritedLanguage();
const AtomicString& argument = sel->argument();
if (value.isEmpty() || !value.startsWith(argument, false))
break;
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 39bf393..1855101 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -1423,6 +1423,28 @@ RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier)
return pseudoElementSpecifier ? data->m_computedStyle->getCachedPseudoStyle(pseudoElementSpecifier) : data->m_computedStyle.get();
}
+AtomicString Element::computeInheritedLanguage() const
+{
+ const Node* n = this;
+ AtomicString value;
+ // The language property is inherited, so we iterate over the parents to find the first language.
+ while (n && value.isNull()) {
+ if (n->isElementNode()) {
+ // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
+ value = static_cast<const Element*>(n)->fastGetAttribute(XMLNames::langAttr);
+ if (value.isNull())
+ value = static_cast<const Element*>(n)->fastGetAttribute(HTMLNames::langAttr);
+ } else if (n->isDocumentNode()) {
+ // checking the MIME content-language
+ value = static_cast<const Document*>(n)->contentLanguage();
+ }
+
+ n = n->parent();
+ }
+
+ return value;
+}
+
void Element::cancelFocusAppearanceUpdate()
{
if (hasRareData())
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 570ee0a..5bbddc2 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -218,6 +218,8 @@ public:
RenderStyle* computedStyle(PseudoId = NOPSEUDO);
+ AtomicString computeInheritedLanguage() const;
+
void dispatchAttrRemovalEvent(Attribute*);
void dispatchAttrAdditionEvent(Attribute*);
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index fc5fcc6..527e8ef 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-02 Ilya Sherman <isherman at google.com>
+
+ Reviewed by Eric Seidel.
+
+ Exposing computing an element's inherited language, per the DOM, in the
+ Chromium API -- primarily for use with autofill i18n.
+ https://bugs.webkit.org/show_bug.cgi?id=44803
+
+ * public/WebElement.h:
+ * src/WebElement.cpp:
+ (WebKit::WebElement::computeInheritedLanguage):
+
2010-09-01 Mikhail Naganov <mnaganov at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebKit/chromium/public/WebElement.h b/WebKit/chromium/public/WebElement.h
index 16a82d8..5b6fd6a 100644
--- a/WebKit/chromium/public/WebElement.h
+++ b/WebKit/chromium/public/WebElement.h
@@ -58,6 +58,12 @@ class WebNamedNodeMap;
WEBKIT_API WebNamedNodeMap attributes() const;
WEBKIT_API WebString innerText() const;
+ // Returns the language code specified for this element. This attribute
+ // is inherited, so the returned value is drawn from the closest parent
+ // element that has the lang attribute set, or from the HTTP
+ // "Content-Language" header as a fallback.
+ WEBKIT_API WebString computeInheritedLanguage() const;
+
#if WEBKIT_IMPLEMENTATION
WebElement(const WTF::PassRefPtr<WebCore::Element>&);
WebElement& operator=(const WTF::PassRefPtr<WebCore::Element>&);
diff --git a/WebKit/chromium/src/WebElement.cpp b/WebKit/chromium/src/WebElement.cpp
index f45cba9..91f310d 100644
--- a/WebKit/chromium/src/WebElement.cpp
+++ b/WebKit/chromium/src/WebElement.cpp
@@ -85,6 +85,11 @@ WebString WebElement::innerText() const
return constUnwrap<Element>()->innerText();
}
+WebString WebElement::computeInheritedLanguage() const
+{
+ return WebString(constUnwrap<Element>()->computeInheritedLanguage());
+}
+
WebElement::WebElement(const PassRefPtr<Element>& elem)
: WebNode(elem)
{
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list