2023-02-27 19:52:38 +01:00
|
|
|
diff --git third_party/blink/public/web/web_element.h third_party/blink/public/web/web_element.h
|
2024-06-14 19:01:45 +02:00
|
|
|
index 023ce7091b061..f175b3683f48f 100644
|
2023-02-27 19:52:38 +01:00
|
|
|
--- third_party/blink/public/web/web_element.h
|
|
|
|
+++ third_party/blink/public/web/web_element.h
|
2024-01-26 03:12:43 +01:00
|
|
|
@@ -82,6 +82,9 @@ class BLINK_EXPORT WebElement : public WebNode {
|
2023-02-27 19:52:38 +01:00
|
|
|
WebString TextContent() const;
|
2024-01-26 03:12:43 +01:00
|
|
|
WebString TextContentAbridged(unsigned int max_length) const;
|
2023-02-27 19:52:38 +01:00
|
|
|
WebString InnerHTML() const;
|
|
|
|
+ WebString AttributeLocalName(unsigned index) const;
|
|
|
|
+ WebString AttributeValue(unsigned index) const;
|
|
|
|
+ unsigned AttributeCount() const;
|
|
|
|
|
2024-06-14 19:01:45 +02:00
|
|
|
// Returns true if the element's computed writing suggestions value is true.
|
|
|
|
// https://html.spec.whatwg.org/#writing-suggestions:computed-writing-suggestions-value
|
2023-02-27 19:52:38 +01:00
|
|
|
diff --git third_party/blink/renderer/core/exported/web_element.cc third_party/blink/renderer/core/exported/web_element.cc
|
2024-09-27 16:15:44 +02:00
|
|
|
index def4b446fcbbb..d48998241f604 100644
|
2023-02-27 19:52:38 +01:00
|
|
|
--- third_party/blink/renderer/core/exported/web_element.cc
|
|
|
|
+++ third_party/blink/renderer/core/exported/web_element.cc
|
2024-06-14 19:01:45 +02:00
|
|
|
@@ -119,6 +119,24 @@ void WebElement::SetAttribute(const WebString& attr_name,
|
2023-02-27 19:52:38 +01:00
|
|
|
IGNORE_EXCEPTION_FOR_TESTING);
|
|
|
|
}
|
|
|
|
|
|
|
|
+unsigned WebElement::AttributeCount() const {
|
|
|
|
+ if (!ConstUnwrap<Element>()->hasAttributes())
|
|
|
|
+ return 0;
|
|
|
|
+ return ConstUnwrap<Element>()->Attributes().size();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+WebString WebElement::AttributeLocalName(unsigned index) const {
|
|
|
|
+ if (index >= AttributeCount())
|
|
|
|
+ return WebString();
|
|
|
|
+ return ConstUnwrap<Element>()->Attributes().at(index).LocalName();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+WebString WebElement::AttributeValue(unsigned index) const {
|
|
|
|
+ if (index >= AttributeCount())
|
|
|
|
+ return WebString();
|
|
|
|
+ return ConstUnwrap<Element>()->Attributes().at(index).Value();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
WebString WebElement::TextContent() const {
|
|
|
|
return ConstUnwrap<Element>()->textContent();
|
|
|
|
}
|