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

Unified Diff: sky/engine/core/dom/Element.cpp

Issue 871203005: Remove ElementFlags system. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/ElementRareData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Element.cpp
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index 0815b4c8dfca466ae6d76da7504b7d93ee334cef..6e1ca6f3be36615da4d90fb66ec7f371b33459d2 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -125,36 +125,6 @@ inline ElementRareData& Element::ensureElementRareData()
return static_cast<ElementRareData&>(ensureRareData());
}
-bool Element::hasElementFlagInternal(ElementFlags mask) const
-{
- return elementRareData()->hasElementFlag(mask);
-}
-
-void Element::setElementFlag(ElementFlags mask, bool value)
-{
- if (!hasRareData() && !value)
- return;
- ensureElementRareData().setElementFlag(mask, value);
-}
-
-void Element::clearElementFlag(ElementFlags mask)
-{
- if (!hasRareData())
- return;
- elementRareData()->clearElementFlag(mask);
-}
-
-void Element::clearTabIndexExplicitlyIfNeeded()
-{
- if (hasRareData())
- elementRareData()->clearTabIndexExplicitly();
-}
-
-void Element::setTabIndexExplicitly(short tabIndex)
-{
- ensureElementRareData().setTabIndexExplicitly(tabIndex);
-}
-
void Element::setTabIndex(int value)
{
setIntegralAttribute(HTMLNames::tabindexAttr, value);
@@ -1092,7 +1062,8 @@ void Element::parseAttribute(const QualifiedName& name, const AtomicString& valu
if (name == HTMLNames::tabindexAttr) {
int tabindex = 0;
if (value.isEmpty()) {
- clearTabIndexExplicitlyIfNeeded();
+ if (hasRareData())
+ elementRareData()->clearTabIndex();
if (treeScope().adjustedFocusedElement() == this) {
// We might want to call blur(), but it's dangerous to dispatch
// events here.
@@ -1100,7 +1071,8 @@ void Element::parseAttribute(const QualifiedName& name, const AtomicString& valu
}
} else if (parseHTMLInteger(value, tabindex)) {
// Clamp tabindex to the range of 'short' to match Firefox's behavior.
- setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), std::min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
+ tabindex = max(static_cast<int>(std::numeric_limits<short>::min()), std::min(tabindex, static_cast<int>(std::numeric_limits<short>::max())));
+ ensureElementRareData().setTabIndex(tabindex);
}
}
}
@@ -1227,7 +1199,9 @@ bool Element::supportsFocus() const
// But supportsFocus must return true when the element is editable, or else
// it won't be focusable. Furthermore, supportsFocus cannot just return true
// always or else tabIndex() will change for all HTML elements.
- return hasElementFlag(TabIndexWasSetExplicitly) || (hasEditableStyle() && parentNode() && !parentNode()->hasEditableStyle());
+ if (hasRareData() && elementRareData()->hasTabIndex())
+ return true;
+ return hasEditableStyle() && parentNode() && !parentNode()->hasEditableStyle();
}
bool Element::isFocusable() const
« no previous file with comments | « sky/engine/core/dom/Element.h ('k') | sky/engine/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698