Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(529)

Unified Diff: Source/core/html/HTMLElement.cpp

Issue 148223004: Improve support for :read-only and :read-write pseudoclasses. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove html, head and body tags from test. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/rendering/RenderTheme.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLElement.cpp
diff --git a/Source/core/html/HTMLElement.cpp b/Source/core/html/HTMLElement.cpp
index 79c7fa1955ea9e3cc27646c6989a28a0f7526df3..a4be1d4b9476077ceb7694ee0f42e4aa93d18c5f 100644
--- a/Source/core/html/HTMLElement.cpp
+++ b/Source/core/html/HTMLElement.cpp
@@ -929,6 +929,26 @@ void HTMLElement::defaultEventHandler(Event* event)
Element::defaultEventHandler(event);
}
+bool HTMLElement::matchesReadOnlyPseudoClass() const
+{
+ return !matchesReadWritePseudoClass();
+}
+
+bool HTMLElement::matchesReadWritePseudoClass() const
+{
+ if (fastHasAttribute(contenteditableAttr)) {
+ const AtomicString& value = fastGetAttribute(contenteditableAttr);
+
+ if (value.isEmpty() || equalIgnoringCase(value, "true") || equalIgnoringCase(value, "plaintext-only"))
+ return true;
+ if (equalIgnoringCase(value, "false"))
+ return false;
+ // All other values should be treated as "inherit".
+ }
+
+ return parentElement() && parentElement()->rendererIsEditable();
+}
+
void HTMLElement::handleKeypressEvent(KeyboardEvent* event)
{
if (!document().settings() || !document().settings()->spatialNavigationEnabled() || !supportsFocus())
« no previous file with comments | « Source/core/html/HTMLElement.h ('k') | Source/core/rendering/RenderTheme.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698