<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[171486] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/171486">171486</a></dd>
<dt>Author</dt> <dd>achristensen@apple.com</dd>
<dt>Date</dt> <dd>2014-07-23 13:19:37 -0700 (Wed, 23 Jul 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Compile window-inactive and fullscreen pseudoclasses in css selectors.
https://bugs.webkit.org/show_bug.cgi?id=135200
Reviewed by Benjamin Poulain.
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
Removed the check of context.hasSelectionPseudo for a window-inactive pseudoclass.
Moved logic to SelectorCheckerTestFunctions.h to share with the selector compiler.
* css/SelectorCheckerTestFunctions.h:
(WebCore::isWindowInactive):
(WebCore::matchesFullScreenAnimatingFullScreenTransitionPseudoClass):
(WebCore::matchesFullScreenAncestorPseudoClass):
(WebCore::matchesFullScreenDocumentPseudoClass):
Added from SelectorChecker.cpp.
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::addPseudoClassType):
Added unoptimized pseudoclass cases for window-inactive and fullscreen pseudoclasses.
Explicitly listed uncompiled pseudoclasses for future work instead of using a default.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckercpp">trunk/Source/WebCore/css/SelectorChecker.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSelectorCheckerTestFunctionsh">trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h</a></li>
<li><a href="#trunkSourceWebCorecssjitSelectorCompilercpp">trunk/Source/WebCore/cssjit/SelectorCompiler.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (171485 => 171486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-23 20:18:47 UTC (rev 171485)
+++ trunk/Source/WebCore/ChangeLog        2014-07-23 20:19:37 UTC (rev 171486)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-07-23 Alex Christensen <achristensen@webkit.org>
+
+ Compile window-inactive and fullscreen pseudoclasses in css selectors.
+ https://bugs.webkit.org/show_bug.cgi?id=135200
+
+ Reviewed by Benjamin Poulain.
+
+ * css/SelectorChecker.cpp:
+ (WebCore::SelectorChecker::checkOne):
+ Removed the check of context.hasSelectionPseudo for a window-inactive pseudoclass.
+ Moved logic to SelectorCheckerTestFunctions.h to share with the selector compiler.
+ * css/SelectorCheckerTestFunctions.h:
+ (WebCore::isWindowInactive):
+ (WebCore::matchesFullScreenAnimatingFullScreenTransitionPseudoClass):
+ (WebCore::matchesFullScreenAncestorPseudoClass):
+ (WebCore::matchesFullScreenDocumentPseudoClass):
+ Added from SelectorChecker.cpp.
+ * cssjit/SelectorCompiler.cpp:
+ (WebCore::SelectorCompiler::addPseudoClassType):
+ Added unoptimized pseudoclass cases for window-inactive and fullscreen pseudoclasses.
+ Explicitly listed uncompiled pseudoclasses for future work instead of using a default.
+
</ins><span class="cx"> 2014-07-23 Brent Fulgham <bfulgham@apple.com>
</span><span class="cx">
</span><span class="cx"> [Win] Use NO_RETURN_DUE_TO_CRASH on Windows.
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (171485 => 171486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorChecker.cpp        2014-07-23 20:18:47 UTC (rev 171485)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp        2014-07-23 20:19:37 UTC (rev 171486)
</span><span class="lines">@@ -32,7 +32,6 @@
</span><span class="cx"> #include "CSSSelectorList.h"
</span><span class="cx"> #include "Document.h"
</span><span class="cx"> #include "ElementTraversal.h"
</span><del>-#include "FocusController.h"
</del><span class="cx"> #include "Frame.h"
</span><span class="cx"> #include "FrameSelection.h"
</span><span class="cx"> #include "HTMLAnchorElement.h"
</span><span class="lines">@@ -481,9 +480,6 @@
</span><span class="cx"> // CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each
</span><span class="cx"> // (since there are no elements involved).
</span><span class="cx"> return checkScrollbarPseudoClass(context, &element->document(), selector);
</span><del>- } else if (context.hasSelectionPseudo) {
- if (selector->pseudoClassType() == CSSSelector::PseudoClassWindowInactive)
- return !element->document().page()->focusController().isActive();
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Normal element pseudo class checking.
</span><span class="lines">@@ -745,17 +741,11 @@
</span><span class="cx"> case CSSSelector::PseudoClassFullScreen:
</span><span class="cx"> return matchesFullScreenPseudoClass(element);
</span><span class="cx"> case CSSSelector::PseudoClassAnimatingFullScreenTransition:
</span><del>- if (element != element->document().webkitCurrentFullScreenElement())
- return false;
- return element->document().isAnimatingFullScreen();
</del><ins>+ return matchesFullScreenAnimatingFullScreenTransitionPseudoClass(element);
</ins><span class="cx"> case CSSSelector::PseudoClassFullScreenAncestor:
</span><del>- return element->containsFullScreenElement();
</del><ins>+ return matchesFullScreenAncestorPseudoClass(element);
</ins><span class="cx"> case CSSSelector::PseudoClassFullScreenDocument:
</span><del>- // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
- // to all elements of that Document.
- if (!element->document().webkitIsFullScreen())
- return false;
- return true;
</del><ins>+ return matchesFullScreenDocumentPseudoClass(element);
</ins><span class="cx"> #endif
</span><span class="cx"> case CSSSelector::PseudoClassInRange:
</span><span class="cx"> return isInRange(element);
</span><span class="lines">@@ -777,7 +767,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> case CSSSelector::PseudoClassWindowInactive:
</span><del>- return !element->document().page()->focusController().isActive();
</del><ins>+ return isWindowInactive(element);
</ins><span class="cx">
</span><span class="cx"> case CSSSelector::PseudoClassHorizontal:
</span><span class="cx"> case CSSSelector::PseudoClassVertical:
</span></span></pre></div>
<a id="trunkSourceWebCorecssSelectorCheckerTestFunctionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (171485 => 171486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2014-07-23 20:18:47 UTC (rev 171485)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h        2014-07-23 20:19:37 UTC (rev 171486)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef SelectorCheckerTestFunctions_h
</span><span class="cx"> #define SelectorCheckerTestFunctions_h
</span><span class="cx">
</span><ins>+#include "FocusController.h"
</ins><span class="cx"> #include "HTMLInputElement.h"
</span><span class="cx"> #include "HTMLOptionElement.h"
</span><span class="cx"> #include <wtf/Compiler.h>
</span><span class="lines">@@ -111,6 +112,11 @@
</span><span class="cx"> return element->willValidate() && element->isValidFormControlElement();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ALWAYS_INLINE bool isWindowInactive(const Element* element)
+{
+ return !element->document().page()->focusController().isActive();
+}
+
</ins><span class="cx"> inline bool matchesLangPseudoClass(const Element* element, AtomicStringImpl* filter)
</span><span class="cx"> {
</span><span class="cx"> AtomicString value;
</span><span class="lines">@@ -163,6 +169,27 @@
</span><span class="cx"> return false;
</span><span class="cx"> return element == element->document().webkitCurrentFullScreenElement();
</span><span class="cx"> }
</span><ins>+
+ALWAYS_INLINE bool matchesFullScreenAnimatingFullScreenTransitionPseudoClass(const Element* element)
+{
+ if (element != element->document().webkitCurrentFullScreenElement())
+ return false;
+ return element->document().isAnimatingFullScreen();
+}
+
+ALWAYS_INLINE bool matchesFullScreenAncestorPseudoClass(const Element* element)
+{
+ return element->containsFullScreenElement();
+}
+
+ALWAYS_INLINE bool matchesFullScreenDocumentPseudoClass(const Element* element)
+{
+ // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
+ // to all elements of that Document.
+ if (!element->document().webkitIsFullScreen())
+ return false;
+ return true;
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="trunkSourceWebCorecssjitSelectorCompilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/cssjit/SelectorCompiler.cpp (171485 => 171486)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-07-23 20:18:47 UTC (rev 171485)
+++ trunk/Source/WebCore/cssjit/SelectorCompiler.cpp        2014-07-23 20:19:37 UTC (rev 171486)
</span><span class="lines">@@ -396,10 +396,23 @@
</span><span class="cx"> case CSSSelector::PseudoClassValid:
</span><span class="cx"> fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isValid));
</span><span class="cx"> return FunctionType::SimpleSelectorChecker;
</span><ins>+ case CSSSelector::PseudoClassWindowInactive:
+ fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isWindowInactive));
+ return FunctionType::SimpleSelectorChecker;
+
</ins><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> case CSSSelector::PseudoClassFullScreen:
</span><span class="cx"> fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(matchesFullScreenPseudoClass));
</span><span class="cx"> return FunctionType::SimpleSelectorChecker;
</span><ins>+ case CSSSelector::PseudoClassFullScreenDocument:
+ fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(matchesFullScreenDocumentPseudoClass));
+ return FunctionType::SimpleSelectorChecker;
+ case CSSSelector::PseudoClassFullScreenAncestor:
+ fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(matchesFullScreenAncestorPseudoClass));
+ return FunctionType::SimpleSelectorChecker;
+ case CSSSelector::PseudoClassAnimatingFullScreenTransition:
+ fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(matchesFullScreenAnimatingFullScreenTransitionPseudoClass));
+ return FunctionType::SimpleSelectorChecker;
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx"> case CSSSelector::PseudoClassFuture:
</span><span class="lines">@@ -410,6 +423,30 @@
</span><span class="cx"> return FunctionType::SimpleSelectorChecker;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ // FIXME: Compile these pseudoclasses, too!
+ case CSSSelector::PseudoClassEmpty:
+ case CSSSelector::PseudoClassFirstOfType:
+ case CSSSelector::PseudoClassLastOfType:
+ case CSSSelector::PseudoClassOnlyOfType:
+ case CSSSelector::PseudoClassNthOfType:
+ case CSSSelector::PseudoClassNthLastChild:
+ case CSSSelector::PseudoClassNthLastOfType:
+ case CSSSelector::PseudoClassVisited:
+ case CSSSelector::PseudoClassDrag:
+ case CSSSelector::PseudoClassFullPageMedia:
+ case CSSSelector::PseudoClassScope:
+ case CSSSelector::PseudoClassCornerPresent:
+ case CSSSelector::PseudoClassDecrement:
+ case CSSSelector::PseudoClassIncrement:
+ case CSSSelector::PseudoClassHorizontal:
+ case CSSSelector::PseudoClassVertical:
+ case CSSSelector::PseudoClassStart:
+ case CSSSelector::PseudoClassEnd:
+ case CSSSelector::PseudoClassDoubleButton:
+ case CSSSelector::PseudoClassSingleButton:
+ case CSSSelector::PseudoClassNoButton:
+ return FunctionType::CannotCompile;
+
</ins><span class="cx"> // Optimized pseudo selectors.
</span><span class="cx"> case CSSSelector::PseudoClassAnyLink:
</span><span class="cx"> fragment.pseudoClasses.add(CSSSelector::PseudoClassLink);
</span><span class="lines">@@ -533,10 +570,13 @@
</span><span class="cx"> }
</span><span class="cx"> return FunctionType::SimpleSelectorChecker;
</span><span class="cx"> }
</span><del>-
- default:
- break;
</del><ins>+
+ case CSSSelector::PseudoClassUnknown:
+ ASSERT_NOT_REACHED();
+ return FunctionType::CannotMatchAnything;
</ins><span class="cx"> }
</span><ins>+
+ ASSERT_NOT_REACHED();
</ins><span class="cx"> return FunctionType::CannotCompile;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>