Changeset 66647 in webkit
- Timestamp:
- Sep 2, 2010 12:52:42 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r66646 r66647 1 2010-09-02 Ilya Sherman <isherman@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Decompose computing an element's inherited language, expose this 6 capability to clients (in particular, for Chromium). 7 https://bugs.webkit.org/show_bug.cgi?id=44803 8 9 No new tests -- just refactoring + exposing code. 10 11 * css/CSSStyleSelector.cpp: 12 (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): 13 * dom/Element.cpp: 14 (WebCore::Element::computeInheritedLang): 15 * dom/Element.h: 16 1 17 2010-08-31 Philippe Normand <pnormand@igalia.com> 2 18 -
trunk/WebCore/css/CSSStyleSelector.cpp
r66615 r66647 2602 2602 break; 2603 2603 case CSSSelector::PseudoLang: { 2604 Node* n = e; 2605 AtomicString value; 2606 // The language property is inherited, so we iterate over the parents 2607 // to find the first language. 2608 while (n && value.isNull()) { 2609 if (n->isElementNode()) { 2610 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7 2611 value = static_cast<Element*>(n)->fastGetAttribute(XMLNames::langAttr); 2612 if (value.isNull()) 2613 value = static_cast<Element*>(n)->fastGetAttribute(langAttr); 2614 } else if (n->isDocumentNode()) 2615 // checking the MIME content-language 2616 value = static_cast<Document*>(n)->contentLanguage(); 2617 2618 n = n->parent(); 2619 } 2604 AtomicString value = e->computeInheritedLanguage(); 2620 2605 const AtomicString& argument = sel->argument(); 2621 2606 if (value.isEmpty() || !value.startsWith(argument, false)) -
trunk/WebCore/dom/Element.cpp
r66284 r66647 1424 1424 } 1425 1425 1426 AtomicString Element::computeInheritedLanguage() const 1427 { 1428 const Node* n = this; 1429 AtomicString value; 1430 // The language property is inherited, so we iterate over the parents to find the first language. 1431 while (n && value.isNull()) { 1432 if (n->isElementNode()) { 1433 // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7 1434 value = static_cast<const Element*>(n)->fastGetAttribute(XMLNames::langAttr); 1435 if (value.isNull()) 1436 value = static_cast<const Element*>(n)->fastGetAttribute(HTMLNames::langAttr); 1437 } else if (n->isDocumentNode()) { 1438 // checking the MIME content-language 1439 value = static_cast<const Document*>(n)->contentLanguage(); 1440 } 1441 1442 n = n->parent(); 1443 } 1444 1445 return value; 1446 } 1447 1426 1448 void Element::cancelFocusAppearanceUpdate() 1427 1449 { -
trunk/WebCore/dom/Element.h
r66251 r66647 219 219 RenderStyle* computedStyle(PseudoId = NOPSEUDO); 220 220 221 AtomicString computeInheritedLanguage() const; 222 221 223 void dispatchAttrRemovalEvent(Attribute*); 222 224 void dispatchAttrAdditionEvent(Attribute*); -
trunk/WebKit/chromium/ChangeLog
r66637 r66647 1 2010-09-02 Ilya Sherman <isherman@google.com> 2 3 Reviewed by Eric Seidel. 4 5 Exposing computing an element's inherited language, per the DOM, in the 6 Chromium API -- primarily for use with autofill i18n. 7 https://bugs.webkit.org/show_bug.cgi?id=44803 8 9 * public/WebElement.h: 10 * src/WebElement.cpp: 11 (WebKit::WebElement::computeInheritedLanguage): 12 1 13 2010-09-01 Mikhail Naganov <mnaganov@chromium.org> 2 14 -
trunk/WebKit/chromium/public/WebElement.h
r64112 r66647 59 59 WEBKIT_API WebString innerText() const; 60 60 61 // Returns the language code specified for this element. This attribute 62 // is inherited, so the returned value is drawn from the closest parent 63 // element that has the lang attribute set, or from the HTTP 64 // "Content-Language" header as a fallback. 65 WEBKIT_API WebString computeInheritedLanguage() const; 66 61 67 #if WEBKIT_IMPLEMENTATION 62 68 WebElement(const WTF::PassRefPtr<WebCore::Element>&); -
trunk/WebKit/chromium/src/WebElement.cpp
r64112 r66647 86 86 } 87 87 88 WebString WebElement::computeInheritedLanguage() const 89 { 90 return WebString(constUnwrap<Element>()->computeInheritedLanguage()); 91 } 92 88 93 WebElement::WebElement(const PassRefPtr<Element>& elem) 89 94 : WebNode(elem)
Note: See TracChangeset
for help on using the changeset viewer.