<!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>[201441] trunk/Source</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/201441">201441</a></dd>
<dt>Author</dt> <dd>darin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-26 17:05:24 -0700 (Thu, 26 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Media queries and platform screen modernization and streamlining
https://bugs.webkit.org/show_bug.cgi?id=158067

Reviewed by Alex Christensen.

Source/WebCore:

* bindings/objc/DOM.mm:
(-[DOMHTMLLinkElement _mediaQueryMatches]): Use references, use fastGetAttribute,
pass a document instead of a frame to the media query evaluator and a reference instead
of a pointer.

* css/CSSGrammar.y.in: Use &quot;expression&quot; instead of &quot;exp&quot; for media query expressions.
Update vectors and arguments to move media query expressions instead of using unique_ptr.

* css/CSSImportRule.h: Use pragma once. Removed unneeded forward declarations.
Made more overrides private and marked them final.

* css/CSSParser.cpp:
(WebCore::CSSParser::SourceSize::SourceSize): Added missing WTFMove to avoid reference
count churn. Changed type of expression to no longer use unique_ptr.
(WebCore::CSSParser::sourceSize): Ditto.

* css/CSSParser.h: Changed SourceSize::expression to no longer use unique_ptr.
Also changed SourceSize::length to be Ref instead of RefPtr.

* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::appendAuthorStyleSheets): Updated for changes to
MediaQueryEvaluator.

* css/MediaFeatureNames.cpp:
(WebCore::MediaFeatureNames::init): Streamlined a bit. Removed &quot;MediaFeature&quot; suffix from
names of media feature strings.

* css/MediaFeatureNames.h: Use pragma once. Changed media feature name globals
to use normal WebKit naming style instead of all lowercase with underscores.
Sorted alphabetically. Removed &quot;MediaFeature&quot; suffix from names of media feature strings.

* css/MediaList.cpp:
(WebCore::MediaQuerySet::MediaQuerySet): Simplified copy constructor since the queries
vector can now be copied normally.
(WebCore::parseMediaDescriptor): Normalized types and changed to use isASCIIAlphanumeric.
The old code was not handling '0' the way the comment said it did.
(WebCore::MediaQuerySet::internalParse): Added. Helper function to cut down on redundant
code in functions below.
(WebCore::MediaQuerySet::parse): Use stripLeadingAndTrailingHTMLSpaces instead of
stripWhiteSpace. Streamlined logic using helper function. Updated to use a vector of
queries instead of a vector of unique_ptr.
(WebCore::MediaQuerySet::add): Use internalParse.
(WebCore::MediaQuerySet::remove): Ditto.
(WebCore::MediaQuerySet::addMediaQuery): Changed argument type to not be unique_ptr.
(WebCore::MediaQuerySet::mediaText): Use modern for loop.
(WebCore::MediaList::MediaList): Initialize pointers to null in the class definition
rather than in these constructors.
(WebCore::MediaList::setMediaText): Removed unhelpful local variable.
(WebCore::MediaList::item): Updated since queries no longer use unique_ptr.
(WebCore::addResolutionWarningMessageToConsole): Changed argument types to references
instead of pointers with assertions.
(WebCore::reportMediaQueryWarningIfNeeded): Updated to modernize.

* css/MediaList.h: Use pragma once. Removed unneeded includes and forward declarations.
Changed vector to contain media queries instead of unique_ptr. Use nullptr instead of 0.
Initialize pointers to null here.

* css/MediaQuery.cpp: Deleted now-unneeded copy constructor and destructor. Both are
correctly generated without us writing them explicitly.
(WebCore::MediaQuery::serialize): Rewrote to streamline.
(WebCore::MediaQuery::MediaQuery): Updates since expressions are no longer unique_ptr.
(WebCore::MediaQuery::cssText): Changed return type to reference.

* css/MediaQuery.h: Use pragma once. Added include since this now includes media query
expressions, not just unique_ptr. Deleted the unneeded copy function.

* css/MediaQueryEvaluator.cpp:
(WebCore::isViewportDependent): Moved this here. It used to be a member function of
MediaQueryExp, but this file has a lot more functions about specific features and how
they are evaluated, so it really belongs here.
(WebCore::MediaQueryEvaluator::MediaQueryEvaluator): Changed constructor to take a
document instead of a frame. Initialize the fallback result in the class definition.
(WebCore::MediaQueryEvaluator::evaluate): Changed the argument type to a reference.
(WebCore::compareValue): Made both of the arguments separate template types. This
helps us compare an integer to a double without lots of type casts.
(WebCore::compareAspectRatioValue): Changed to use early return style and got rid of
the casts to int so we will do the work in double instead.
(WebCore::doubleValue): Replaced the old numberValue function with this. Since values
are stored as doubles, it's much better to use double rather than float.
(WebCore::zeroEvaluate): Added. Helpful for the many functions that just need to
evaluate as 0.
(WebCore::oneEvaluate): Ditto.
(WebCore::colorEvaluate): Renamed this and all the functions below. Simplified the logic
to use the new doubleValue function.
(WebCore::colorIndexEvaluate): Use zeroEvaluate.
(WebCore::colorGamutEvaluate): No longer use page just to get from the frame to the
main frame.
(WebCore::monochromeEvaluate): Simplify logic using zeroEvaluate.
(WebCore::invertedColorsEvaluate): Use auto for the keyword; easier to read.
(WebCore::orientationEvaluate): Use early return style.
(WebCore::aspectRatioEvaluate): Ditto.
(WebCore::deviceAspectRatioEvaluate): Simplified logic and removed type casts.
(WebCore::evaluateResolution): Added a couple null checks.
(WebCore::devicePixelRatioEvaluate): Renamed. Added missing type check.
(WebCore::resolutionEvaluate): Ditto.
(WebCore::gridEvaluate): Use zeroEvaluate.
(WebCore::computeLength): Added a null check.
(WebCore::deviceHeightEvaluate): Use early return.
(WebCore::deviceWidthEvaluate): Ditto.
(WebCore::heightEvaluate): Ditto.
(WebCore::widthEvaluate): Ditto.
(WebCore::minColorEvaluate): Updated name only.
(WebCore::maxColorEvaluate): Ditto.
(WebCore::minColorIndexEvaluate): Ditto.
(WebCore::maxColorIndexEvaluate): Ditto.
(WebCore::minMonochromeEvaluate): Ditto.
(WebCore::maxMonochromeEvaluate): Ditto.
(WebCore::minAspectRatioEvaluate): Ditto.
(WebCore::maxAspectRatioEvaluate): Ditto.
(WebCore::minDeviceAspectRatioEvaluate): Ditto.
(WebCore::maxDeviceAspectRatioEvaluate): Ditto.
(WebCore::minDevicePixelRatioEvaluate): Ditto.
(WebCore::maxDevicePixelRatioEvaluate): Ditto.
(WebCore::minHeightEvaluate): Ditto.
(WebCore::maxHeightEvaluate): Ditto.
(WebCore::minWidthEvaluate): Ditto.
(WebCore::maxWidthEvaluate): Ditto.
(WebCore::minDeviceHeightEvaluate): Ditto.
(WebCore::maxDeviceHeightEvaluate): Ditto.
(WebCore::minDeviceWidthEvaluate): Ditto.
(WebCore::maxDeviceWidthEvaluate): Ditto.
(WebCore::minResolutionEvaluate): Ditto.
(WebCore::maxResolutionEvaluate): Ditto.
(WebCore::animationEvaluate): Use oneEvaluate.
(WebCore::transitionEvaluate): Ditto.
(WebCore::transform2dEvaluate): Ditto.
(WebCore::transform3dEvaluate): Simplify using zeroEvaluate and oneEvaluate.
(WebCore::viewModeEvaluate): Simplified logic with fewer local variables and the name &quot;keyword&quot;.
(WebCore::videoPlayableInlineEvaluate): Use reference.
(WebCore::hoverEvaluate): Simplify using keyword.
(WebCore::anyHoverEvaluate): Just updated name.
(WebCore::pointerEvaluate): Simplify using keyword.
(WebCore::anyPointerEvaluate): Just updated name.
(WebCore::add): Added. Helper for building up the media query function map.
(WebCore::MediaQueryEvaluator::evaluate): Moved code to build the function map in here in
a lambda, rather than having it in a separate global function.

* css/MediaQueryEvaluator.h: Use pragma once. Removed uneeded includes. Simplified comments and
modernized their style.

* css/MediaQueryExp.cpp:
(WebCore::isFeatureValidWithIdentifier): Renamed to make it clearer what this does. Updated
to take a reference and use te new feature names.
(WebCore::isFeatureValidWithNonNegativeLengthOrNumber): Ditto.
(WebCore::isFeatureValidWithDensity): Ditto.
(WebCore::isFeatureValidWithNonNegativeInteger): Ditto.
(WebCore::isFeatureValidWithNonNegativeNumber): Ditto.
(WebCore::isFeatureValidWithZeroOrOne): Ditto.
(WebCore::isAspectRatioFeature): Ditto.
(WebCore::isFeatureValidWithoutValue): Ditto.
(WebCore::isFeatureValidWithNumberWithUnit): Added. Helper that calls multiple functions above.
(WebCore::isFeatureValidWithNumber): Ditto.
(WebCore::isSlash): Added. Helper to make aspect ratio code below easier to read.
(WebCore::isPositiveIntegerValue): Ditto.
(WebCore::MediaQueryExpression::MediaQueryExpression): Rearranged code to be much less wordy and
to not use current/next.

* css/MediaQueryExp.h: Use pragma once. Renamed class to MediaQueryExpression. Removed
the isViewportDependent function, now part of MediaQueryEvaluator. Removed unneeded includes.

* css/MediaQueryList.cpp:
(WebCore::MediaQueryList::MediaQueryList): Marked this inline. Use a reference and a Ref&amp;&amp;
instead of PassRefPtr.
(WebCore::MediaQueryList::create): Updated argument types.
(WebCore::MediaQueryList::addListener): Updated argument type and use releaseNonNull.
(WebCore::MediaQueryList::removeListener): Updated argument types.
(WebCore::MediaQueryList::evaluate): Ditto.
(WebCore::MediaQueryList::matches): More of the same.

* css/MediaQueryList.h: Use pragma once. Changed types to use references, RefPtr&amp;&amp; and Ref&amp;&amp;.

* css/MediaQueryMatcher.cpp:
(WebCore::MediaQueryMatcher::MediaQueryMatcher): Take a reference.
(WebCore::MediaQueryMatcher::documentDestroyed): Use nullptr.
(WebCore::MediaQueryMatcher::documentElementUserAgentStyle): Use auto.
(WebCore::MediaQueryMatcher::evaluate): Take a reference. Updated for changes to MediaQueryEvaluator.
(WebCore::MediaQueryMatcher::matchMedia): Updated for above changes.
(WebCore::MediaQueryMatcher::addListener): Use Ref&amp;&amp; and reference for arguments. Simplify code.
(WebCore::MediaQueryMatcher::removeListener): Ditto.
(WebCore::MediaQueryMatcher::styleResolverChanged): Moved the logic for evaluating each query here.
Updated for changes to MediaQueryEvaluator.

* css/MediaQueryMatcher.h: Use pragma once. Changed create to take a reference. Tightened argument
types for addListener and removeListener. Made the private Listener a simple struct rather than a
class. Initialized m_evaluationRound.

* css/RuleSet.cpp:
(WebCore::RuleSet::addChildRules): Updated for changes to MediaQueryEvaluator.
(WebCore::RuleSet::addRulesFromSheet): Ditto.

* css/SourceSizeList.cpp:
(WebCore::match): Updated to use MediaQueryEvaluator in a simpler way.
(WebCore::defaultLength): Use a reference and simpler syntax.
(WebCore::computeLength): Ditto.
(WebCore::parseSizesAttribute): Changed arguments to take a Document instead of both a
RenderView and a Frame.

* css/SourceSizeList.h: Use #pragma once. Change parseSizesAttribute to take a Document.

* css/StyleMedia.cpp:
(WebCore::StyleMedia::matchMedium): Update for changes to MediaQueryEvaluator.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver): Use a MediaQueryEvaluator instead of a unique_ptr
to one.
(WebCore::StyleResolver::appendAuthorStyleSheets): Ditto.
(WebCore::StyleResolver::styleForElement): Ditto.
(WebCore::StyleResolver::pseudoStyleForElement): Ditto.
(WebCore::StyleResolver::pseudoStyleRulesForElement): Ditto.
(WebCore::StyleResolver::addViewportDependentMediaQueryResult): Use references instead of
ponters, and use a vector of MediaQueryResult instead of unique_ptr.
(WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange): Use a modern for loop.

* css/StyleResolver.h: Use a MediaQueryEvaluator instead of a unique_ptr to one.
Use a vector of MediaQueryResult instead of a vector of unique_ptr.

* dom/Document.cpp:
(WebCore::Document::mediaQueryMatcher): Pass a reference instead of a pointer.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::InlineStyleSheetOwner::createSheet): Updated for changes to MediaQueryEvaluator.

* editing/TextIterator.cpp:
(WebCore::SimplifiedBackwardsTextIterator::advance): Removed a stray space (unrelated to
the rest of the patch).

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Updated for changes to the
MediaQueryEvaluator class. Also use auto a bit more and eliminated a double hash table
lookup in code that used hasAttribute followed by fastGetAttribute.
(WebCore::HTMLImageElement::selectImageSource): Updated for changes to parseSizesAttribute.

* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process): Updated for changes to MediaQueryEvaluator.
(WebCore::HTMLLinkElement::setCSSStyleSheet): Use auto.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectNextSourceChild): Updated for changes to MediaQueryEvaluator.

* html/HTMLPictureElement.cpp:
(WebCore::HTMLPictureElement::viewportChangeAffectedPicture): Updated for changes to
MediaQueryEvaluator.

* html/HTMLPictureElement.h: Use #pragma once. Changed viewport dependent media query results
vector to be a vector of results, not of unique_ptr.

* html/parser/HTMLPreloadScanner.cpp:
(WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): Updated for changes to
parseSizesAttribute.
(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Updated for changes to
MediaQueryEvaluator.

* html/parser/HTMLResourcePreloader.cpp:
(WebCore::mediaAttributeMatches): Updated for changes to MediaQueryEvaluator.
(WebCore::HTMLResourcePreloader::preload): Ditto.

* page/DOMWindow.cpp: Removed unneeded include of PlatformScreen.h.

* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll): Simplified code and
updated for changes to PlatformScreenMac functions.

* platform/PlatformScreen.h: Use #pragma once. Use using instad of typedef. Put the typedef
for PlatformDisplayID inside the WebCore namespace. Removed the typedef for ColorProfile.
Renamed the functions that find a screen to just &quot;screen&quot;.

* platform/graphics/DisplayRefreshMonitorClient.cpp:
(WebCore::DisplayRefreshMonitorClient::DisplayRefreshMonitorClient): Moved initialization
of booleans to the class definition.

* platform/graphics/DisplayRefreshMonitorClient.h: Use pragma once. Removed unneeded
forward declarations. Changed display ID data member to be an Optional instead of a boolean
paired with another data member.

* platform/graphics/GraphicsLayerUpdater.h: Use pragma once. Removed unneeded include of
PlatformScreen.h.

* platform/image-decoders/ImageDecoder.h: Use pragma once. Moved ColorProfile here from
PlatformScreen.h, since it's not used there. and is used here.

* platform/mac/PlatformEventFactoryMac.h: Use parma once. Changed reutrn type of the
globalPoint function to NSPoint. Tweaked comments and formatting a bit.

* platform/mac/PlatformEventFactoryMac.mm:
(WebCore::globalPoint): Changed return type to NSPoint and so removed the explicit
conversion to IntPoint.
(WebCore::globalPointForEvent): Changed return type to NSPoint.
(WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): Moved conversion to
IntPoint in here. Also got rid of special indenting style and just indented normally.
(WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Ditto.
(WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Ditto.

* platform/mac/PlatformScreenMac.mm:
(WebCore::displayID): Renamed from displayIDFromScreen and displayFromWidget since this
is C++ and we have overloading to determine the types of arguments. Added a null check
of the how dinwo pointer.
(WebCore::firstScreen): Added. Helper used below.
(WebCore::window): Added. Helper used below.
(WebCore::screen): Renamed from screenForWidget and screenFromWindow and removed the
unneeded window argument from the widget version.
(WebCore::screenDepth): Simplified, using new helpers.
(WebCore::screenDepthPerComponent): Ditto.
(WebCore::screenIsMonochrome): Tweaked comment.
(WebCore::screenHasInvertedColors): Ditto.
(WebCore::screenRect): Simplified using new elpers.
(WebCore::screenAvailableRect): Ditto.
(WebCore::screenSupportsExtendedColor): Streamlined using fewer local variables and
using auto for types of the results of adoptCF.
(WebCore::toUserSpace): Updated for function name changes.
(WebCore::toDeviceSpace): Ditto.

Source/WebKit/mac:

* WebView/WebFrame.mm:
(-[WebFrame _dragSourceEndedAt:operation:]): Updated to use the new version of
globalPoint, which returns an NSPoint.

Source/WebKit2:

* Shared/mac/WebEventFactory.mm:
(WebKit::screenForWindow): Deleted.
(WebKit::flipScreenPoint): Deleted.
(WebKit::globalPoint): Deleted.
(WebKit::globalPointForEvent): Use globalPoint function from WebCore so we don't need
copies of everything in here.

* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::windowDidChangeScreen): Removed unneeded type cast.
(WebKit::WebViewImpl::draggedImage): Added type cast since globalPoint now returns an
NSPoint rather than an IntPoint.

* UIProcess/WebPageProxy.h: Use pragma once. Add a WebCore prefix to a use of
PlatformDisplayID, since that is now inside the WebCore namespace.
* WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
* WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h: Ditto.
* WebProcess/WebPage/DrawingArea.h: Ditto.
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsobjcDOMmm">trunk/Source/WebCore/bindings/objc/DOM.mm</a></li>
<li><a href="#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/css/CSSGrammar.y.in</a></li>
<li><a href="#trunkSourceWebCorecssCSSImportRuleh">trunk/Source/WebCore/css/CSSImportRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleSheetcpp">trunk/Source/WebCore/css/CSSStyleSheet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssDocumentRuleSetscpp">trunk/Source/WebCore/css/DocumentRuleSets.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaFeatureNamescpp">trunk/Source/WebCore/css/MediaFeatureNames.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaFeatureNamesh">trunk/Source/WebCore/css/MediaFeatureNames.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaListcpp">trunk/Source/WebCore/css/MediaList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaListh">trunk/Source/WebCore/css/MediaList.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQuerycpp">trunk/Source/WebCore/css/MediaQuery.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryh">trunk/Source/WebCore/css/MediaQuery.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryEvaluatorcpp">trunk/Source/WebCore/css/MediaQueryEvaluator.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryEvaluatorh">trunk/Source/WebCore/css/MediaQueryEvaluator.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryExpcpp">trunk/Source/WebCore/css/MediaQueryExp.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryExph">trunk/Source/WebCore/css/MediaQueryExp.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryListcpp">trunk/Source/WebCore/css/MediaQueryList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryListh">trunk/Source/WebCore/css/MediaQueryList.h</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryMatchercpp">trunk/Source/WebCore/css/MediaQueryMatcher.cpp</a></li>
<li><a href="#trunkSourceWebCorecssMediaQueryMatcherh">trunk/Source/WebCore/css/MediaQueryMatcher.h</a></li>
<li><a href="#trunkSourceWebCorecssRuleSetcpp">trunk/Source/WebCore/css/RuleSet.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSourceSizeListcpp">trunk/Source/WebCore/css/SourceSizeList.cpp</a></li>
<li><a href="#trunkSourceWebCorecssSourceSizeListh">trunk/Source/WebCore/css/SourceSizeList.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleMediacpp">trunk/Source/WebCore/css/StyleMedia.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolvercpp">trunk/Source/WebCore/css/StyleResolver.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleResolverh">trunk/Source/WebCore/css/StyleResolver.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomInlineStyleSheetOwnercpp">trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingTextIteratorcpp">trunk/Source/WebCore/editing/TextIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLImageElementcpp">trunk/Source/WebCore/html/HTMLImageElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLLinkElementcpp">trunk/Source/WebCore/html/HTMLLinkElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementcpp">trunk/Source/WebCore/html/HTMLMediaElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLPictureElementcpp">trunk/Source/WebCore/html/HTMLPictureElement.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLPictureElementh">trunk/Source/WebCore/html/HTMLPictureElement.h</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLPreloadScannercpp">trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp">trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepagemacEventHandlerMacmm">trunk/Source/WebCore/page/mac/EventHandlerMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformPlatformScreenh">trunk/Source/WebCore/platform/PlatformScreen.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClientcpp">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClienth">trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdaterh">trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h</a></li>
<li><a href="#trunkSourceWebCoreplatformimagedecodersImageDecoderh">trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformEventFactoryMach">trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformEventFactoryMacmm">trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPlatformScreenMacmm">trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebFramemm">trunk/Source/WebKit/mac/WebView/WebFrame.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacWebEventFactorymm">trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplmm">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitorh">trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/ChangeLog        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1,3 +1,321 @@
</span><ins>+2016-05-26  Darin Adler  &lt;darin@apple.com&gt;
+
+        Media queries and platform screen modernization and streamlining
+        https://bugs.webkit.org/show_bug.cgi?id=158067
+
+        Reviewed by Alex Christensen.
+
+        * bindings/objc/DOM.mm:
+        (-[DOMHTMLLinkElement _mediaQueryMatches]): Use references, use fastGetAttribute,
+        pass a document instead of a frame to the media query evaluator and a reference instead
+        of a pointer.
+
+        * css/CSSGrammar.y.in: Use &quot;expression&quot; instead of &quot;exp&quot; for media query expressions.
+        Update vectors and arguments to move media query expressions instead of using unique_ptr.
+
+        * css/CSSImportRule.h: Use pragma once. Removed unneeded forward declarations.
+        Made more overrides private and marked them final.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::SourceSize::SourceSize): Added missing WTFMove to avoid reference
+        count churn. Changed type of expression to no longer use unique_ptr.
+        (WebCore::CSSParser::sourceSize): Ditto.
+
+        * css/CSSParser.h: Changed SourceSize::expression to no longer use unique_ptr.
+        Also changed SourceSize::length to be Ref instead of RefPtr.
+
+        * css/DocumentRuleSets.cpp:
+        (WebCore::DocumentRuleSets::appendAuthorStyleSheets): Updated for changes to
+        MediaQueryEvaluator.
+
+        * css/MediaFeatureNames.cpp:
+        (WebCore::MediaFeatureNames::init): Streamlined a bit. Removed &quot;MediaFeature&quot; suffix from
+        names of media feature strings.
+
+        * css/MediaFeatureNames.h: Use pragma once. Changed media feature name globals
+        to use normal WebKit naming style instead of all lowercase with underscores.
+        Sorted alphabetically. Removed &quot;MediaFeature&quot; suffix from names of media feature strings.
+
+        * css/MediaList.cpp:
+        (WebCore::MediaQuerySet::MediaQuerySet): Simplified copy constructor since the queries
+        vector can now be copied normally.
+        (WebCore::parseMediaDescriptor): Normalized types and changed to use isASCIIAlphanumeric.
+        The old code was not handling '0' the way the comment said it did.
+        (WebCore::MediaQuerySet::internalParse): Added. Helper function to cut down on redundant
+        code in functions below.
+        (WebCore::MediaQuerySet::parse): Use stripLeadingAndTrailingHTMLSpaces instead of
+        stripWhiteSpace. Streamlined logic using helper function. Updated to use a vector of
+        queries instead of a vector of unique_ptr.
+        (WebCore::MediaQuerySet::add): Use internalParse.
+        (WebCore::MediaQuerySet::remove): Ditto.
+        (WebCore::MediaQuerySet::addMediaQuery): Changed argument type to not be unique_ptr.
+        (WebCore::MediaQuerySet::mediaText): Use modern for loop.
+        (WebCore::MediaList::MediaList): Initialize pointers to null in the class definition
+        rather than in these constructors.
+        (WebCore::MediaList::setMediaText): Removed unhelpful local variable.
+        (WebCore::MediaList::item): Updated since queries no longer use unique_ptr.
+        (WebCore::addResolutionWarningMessageToConsole): Changed argument types to references
+        instead of pointers with assertions.
+        (WebCore::reportMediaQueryWarningIfNeeded): Updated to modernize.
+
+        * css/MediaList.h: Use pragma once. Removed unneeded includes and forward declarations.
+        Changed vector to contain media queries instead of unique_ptr. Use nullptr instead of 0.
+        Initialize pointers to null here.
+
+        * css/MediaQuery.cpp: Deleted now-unneeded copy constructor and destructor. Both are
+        correctly generated without us writing them explicitly.
+        (WebCore::MediaQuery::serialize): Rewrote to streamline.
+        (WebCore::MediaQuery::MediaQuery): Updates since expressions are no longer unique_ptr.
+        (WebCore::MediaQuery::cssText): Changed return type to reference.
+
+        * css/MediaQuery.h: Use pragma once. Added include since this now includes media query
+        expressions, not just unique_ptr. Deleted the unneeded copy function.
+
+        * css/MediaQueryEvaluator.cpp:
+        (WebCore::isViewportDependent): Moved this here. It used to be a member function of
+        MediaQueryExp, but this file has a lot more functions about specific features and how
+        they are evaluated, so it really belongs here.
+        (WebCore::MediaQueryEvaluator::MediaQueryEvaluator): Changed constructor to take a
+        document instead of a frame. Initialize the fallback result in the class definition.
+        (WebCore::MediaQueryEvaluator::evaluate): Changed the argument type to a reference.
+        (WebCore::compareValue): Made both of the arguments separate template types. This
+        helps us compare an integer to a double without lots of type casts.
+        (WebCore::compareAspectRatioValue): Changed to use early return style and got rid of
+        the casts to int so we will do the work in double instead.
+        (WebCore::doubleValue): Replaced the old numberValue function with this. Since values
+        are stored as doubles, it's much better to use double rather than float.
+        (WebCore::zeroEvaluate): Added. Helpful for the many functions that just need to
+        evaluate as 0.
+        (WebCore::oneEvaluate): Ditto.
+        (WebCore::colorEvaluate): Renamed this and all the functions below. Simplified the logic
+        to use the new doubleValue function.
+        (WebCore::colorIndexEvaluate): Use zeroEvaluate.
+        (WebCore::colorGamutEvaluate): No longer use page just to get from the frame to the
+        main frame.
+        (WebCore::monochromeEvaluate): Simplify logic using zeroEvaluate.
+        (WebCore::invertedColorsEvaluate): Use auto for the keyword; easier to read.
+        (WebCore::orientationEvaluate): Use early return style.
+        (WebCore::aspectRatioEvaluate): Ditto.
+        (WebCore::deviceAspectRatioEvaluate): Simplified logic and removed type casts.
+        (WebCore::evaluateResolution): Added a couple null checks.
+        (WebCore::devicePixelRatioEvaluate): Renamed. Added missing type check.
+        (WebCore::resolutionEvaluate): Ditto.
+        (WebCore::gridEvaluate): Use zeroEvaluate.
+        (WebCore::computeLength): Added a null check.
+        (WebCore::deviceHeightEvaluate): Use early return.
+        (WebCore::deviceWidthEvaluate): Ditto.
+        (WebCore::heightEvaluate): Ditto.
+        (WebCore::widthEvaluate): Ditto.
+        (WebCore::minColorEvaluate): Updated name only.
+        (WebCore::maxColorEvaluate): Ditto.
+        (WebCore::minColorIndexEvaluate): Ditto.
+        (WebCore::maxColorIndexEvaluate): Ditto.
+        (WebCore::minMonochromeEvaluate): Ditto.
+        (WebCore::maxMonochromeEvaluate): Ditto.
+        (WebCore::minAspectRatioEvaluate): Ditto.
+        (WebCore::maxAspectRatioEvaluate): Ditto.
+        (WebCore::minDeviceAspectRatioEvaluate): Ditto.
+        (WebCore::maxDeviceAspectRatioEvaluate): Ditto.
+        (WebCore::minDevicePixelRatioEvaluate): Ditto.
+        (WebCore::maxDevicePixelRatioEvaluate): Ditto.
+        (WebCore::minHeightEvaluate): Ditto.
+        (WebCore::maxHeightEvaluate): Ditto.
+        (WebCore::minWidthEvaluate): Ditto.
+        (WebCore::maxWidthEvaluate): Ditto.
+        (WebCore::minDeviceHeightEvaluate): Ditto.
+        (WebCore::maxDeviceHeightEvaluate): Ditto.
+        (WebCore::minDeviceWidthEvaluate): Ditto.
+        (WebCore::maxDeviceWidthEvaluate): Ditto.
+        (WebCore::minResolutionEvaluate): Ditto.
+        (WebCore::maxResolutionEvaluate): Ditto.
+        (WebCore::animationEvaluate): Use oneEvaluate.
+        (WebCore::transitionEvaluate): Ditto.
+        (WebCore::transform2dEvaluate): Ditto.
+        (WebCore::transform3dEvaluate): Simplify using zeroEvaluate and oneEvaluate.
+        (WebCore::viewModeEvaluate): Simplified logic with fewer local variables and the name &quot;keyword&quot;.
+        (WebCore::videoPlayableInlineEvaluate): Use reference.
+        (WebCore::hoverEvaluate): Simplify using keyword.
+        (WebCore::anyHoverEvaluate): Just updated name.
+        (WebCore::pointerEvaluate): Simplify using keyword.
+        (WebCore::anyPointerEvaluate): Just updated name.
+        (WebCore::add): Added. Helper for building up the media query function map.
+        (WebCore::MediaQueryEvaluator::evaluate): Moved code to build the function map in here in
+        a lambda, rather than having it in a separate global function.
+
+        * css/MediaQueryEvaluator.h: Use pragma once. Removed uneeded includes. Simplified comments and
+        modernized their style.
+
+        * css/MediaQueryExp.cpp:
+        (WebCore::isFeatureValidWithIdentifier): Renamed to make it clearer what this does. Updated
+        to take a reference and use te new feature names.
+        (WebCore::isFeatureValidWithNonNegativeLengthOrNumber): Ditto.
+        (WebCore::isFeatureValidWithDensity): Ditto.
+        (WebCore::isFeatureValidWithNonNegativeInteger): Ditto.
+        (WebCore::isFeatureValidWithNonNegativeNumber): Ditto.
+        (WebCore::isFeatureValidWithZeroOrOne): Ditto.
+        (WebCore::isAspectRatioFeature): Ditto.
+        (WebCore::isFeatureValidWithoutValue): Ditto.
+        (WebCore::isFeatureValidWithNumberWithUnit): Added. Helper that calls multiple functions above.
+        (WebCore::isFeatureValidWithNumber): Ditto.
+        (WebCore::isSlash): Added. Helper to make aspect ratio code below easier to read.
+        (WebCore::isPositiveIntegerValue): Ditto.
+        (WebCore::MediaQueryExpression::MediaQueryExpression): Rearranged code to be much less wordy and
+        to not use current/next.
+
+        * css/MediaQueryExp.h: Use pragma once. Renamed class to MediaQueryExpression. Removed
+        the isViewportDependent function, now part of MediaQueryEvaluator. Removed unneeded includes.
+
+        * css/MediaQueryList.cpp:
+        (WebCore::MediaQueryList::MediaQueryList): Marked this inline. Use a reference and a Ref&amp;&amp;
+        instead of PassRefPtr.
+        (WebCore::MediaQueryList::create): Updated argument types.
+        (WebCore::MediaQueryList::addListener): Updated argument type and use releaseNonNull.
+        (WebCore::MediaQueryList::removeListener): Updated argument types.
+        (WebCore::MediaQueryList::evaluate): Ditto.
+        (WebCore::MediaQueryList::matches): More of the same.
+
+        * css/MediaQueryList.h: Use pragma once. Changed types to use references, RefPtr&amp;&amp; and Ref&amp;&amp;.
+
+        * css/MediaQueryMatcher.cpp:
+        (WebCore::MediaQueryMatcher::MediaQueryMatcher): Take a reference.
+        (WebCore::MediaQueryMatcher::documentDestroyed): Use nullptr.
+        (WebCore::MediaQueryMatcher::documentElementUserAgentStyle): Use auto.
+        (WebCore::MediaQueryMatcher::evaluate): Take a reference. Updated for changes to MediaQueryEvaluator.
+        (WebCore::MediaQueryMatcher::matchMedia): Updated for above changes.
+        (WebCore::MediaQueryMatcher::addListener): Use Ref&amp;&amp; and reference for arguments. Simplify code.
+        (WebCore::MediaQueryMatcher::removeListener): Ditto.
+        (WebCore::MediaQueryMatcher::styleResolverChanged): Moved the logic for evaluating each query here.
+        Updated for changes to MediaQueryEvaluator.
+
+        * css/MediaQueryMatcher.h: Use pragma once. Changed create to take a reference. Tightened argument
+        types for addListener and removeListener. Made the private Listener a simple struct rather than a
+        class. Initialized m_evaluationRound.
+
+        * css/RuleSet.cpp:
+        (WebCore::RuleSet::addChildRules): Updated for changes to MediaQueryEvaluator.
+        (WebCore::RuleSet::addRulesFromSheet): Ditto.
+
+        * css/SourceSizeList.cpp:
+        (WebCore::match): Updated to use MediaQueryEvaluator in a simpler way.
+        (WebCore::defaultLength): Use a reference and simpler syntax.
+        (WebCore::computeLength): Ditto.
+        (WebCore::parseSizesAttribute): Changed arguments to take a Document instead of both a
+        RenderView and a Frame.
+
+        * css/SourceSizeList.h: Use #pragma once. Change parseSizesAttribute to take a Document.
+
+        * css/StyleMedia.cpp:
+        (WebCore::StyleMedia::matchMedium): Update for changes to MediaQueryEvaluator.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::StyleResolver): Use a MediaQueryEvaluator instead of a unique_ptr
+        to one.
+        (WebCore::StyleResolver::appendAuthorStyleSheets): Ditto.
+        (WebCore::StyleResolver::styleForElement): Ditto.
+        (WebCore::StyleResolver::pseudoStyleForElement): Ditto.
+        (WebCore::StyleResolver::pseudoStyleRulesForElement): Ditto.
+        (WebCore::StyleResolver::addViewportDependentMediaQueryResult): Use references instead of
+        ponters, and use a vector of MediaQueryResult instead of unique_ptr.
+        (WebCore::StyleResolver::hasMediaQueriesAffectedByViewportChange): Use a modern for loop.
+
+        * css/StyleResolver.h: Use a MediaQueryEvaluator instead of a unique_ptr to one.
+        Use a vector of MediaQueryResult instead of a vector of unique_ptr.
+
+        * dom/Document.cpp:
+        (WebCore::Document::mediaQueryMatcher): Pass a reference instead of a pointer.
+
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::InlineStyleSheetOwner::createSheet): Updated for changes to MediaQueryEvaluator.
+
+        * editing/TextIterator.cpp:
+        (WebCore::SimplifiedBackwardsTextIterator::advance): Removed a stray space (unrelated to
+        the rest of the patch).
+
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::bestFitSourceFromPictureElement): Updated for changes to the
+        MediaQueryEvaluator class. Also use auto a bit more and eliminated a double hash table
+        lookup in code that used hasAttribute followed by fastGetAttribute.
+        (WebCore::HTMLImageElement::selectImageSource): Updated for changes to parseSizesAttribute.
+
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::process): Updated for changes to MediaQueryEvaluator.
+        (WebCore::HTMLLinkElement::setCSSStyleSheet): Use auto.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::selectNextSourceChild): Updated for changes to MediaQueryEvaluator.
+
+        * html/HTMLPictureElement.cpp:
+        (WebCore::HTMLPictureElement::viewportChangeAffectedPicture): Updated for changes to
+        MediaQueryEvaluator.
+
+        * html/HTMLPictureElement.h: Use #pragma once. Changed viewport dependent media query results
+        vector to be a vector of results, not of unique_ptr.
+
+        * html/parser/HTMLPreloadScanner.cpp:
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): Updated for changes to
+        parseSizesAttribute.
+        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Updated for changes to
+        MediaQueryEvaluator.
+
+        * html/parser/HTMLResourcePreloader.cpp:
+        (WebCore::mediaAttributeMatches): Updated for changes to MediaQueryEvaluator.
+        (WebCore::HTMLResourcePreloader::preload): Ditto.
+
+        * page/DOMWindow.cpp: Removed unneeded include of PlatformScreen.h.
+
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll): Simplified code and
+        updated for changes to PlatformScreenMac functions.
+
+        * platform/PlatformScreen.h: Use #pragma once. Use using instad of typedef. Put the typedef
+        for PlatformDisplayID inside the WebCore namespace. Removed the typedef for ColorProfile.
+        Renamed the functions that find a screen to just &quot;screen&quot;.
+
+        * platform/graphics/DisplayRefreshMonitorClient.cpp:
+        (WebCore::DisplayRefreshMonitorClient::DisplayRefreshMonitorClient): Moved initialization
+        of booleans to the class definition.
+
+        * platform/graphics/DisplayRefreshMonitorClient.h: Use pragma once. Removed unneeded
+        forward declarations. Changed display ID data member to be an Optional instead of a boolean
+        paired with another data member.
+
+        * platform/graphics/GraphicsLayerUpdater.h: Use pragma once. Removed unneeded include of
+        PlatformScreen.h.
+
+        * platform/image-decoders/ImageDecoder.h: Use pragma once. Moved ColorProfile here from
+        PlatformScreen.h, since it's not used there. and is used here.
+
+        * platform/mac/PlatformEventFactoryMac.h: Use parma once. Changed reutrn type of the
+        globalPoint function to NSPoint. Tweaked comments and formatting a bit.
+
+        * platform/mac/PlatformEventFactoryMac.mm:
+        (WebCore::globalPoint): Changed return type to NSPoint and so removed the explicit
+        conversion to IntPoint.
+        (WebCore::globalPointForEvent): Changed return type to NSPoint.
+        (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder): Moved conversion to
+        IntPoint in here. Also got rid of special indenting style and just indented normally.
+        (WebCore::PlatformWheelEventBuilder::PlatformWheelEventBuilder): Ditto.
+        (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder): Ditto.
+
+        * platform/mac/PlatformScreenMac.mm:
+        (WebCore::displayID): Renamed from displayIDFromScreen and displayFromWidget since this
+        is C++ and we have overloading to determine the types of arguments. Added a null check
+        of the how dinwo pointer.
+        (WebCore::firstScreen): Added. Helper used below.
+        (WebCore::window): Added. Helper used below.
+        (WebCore::screen): Renamed from screenForWidget and screenFromWindow and removed the
+        unneeded window argument from the widget version.
+        (WebCore::screenDepth): Simplified, using new helpers.
+        (WebCore::screenDepthPerComponent): Ditto.
+        (WebCore::screenIsMonochrome): Tweaked comment.
+        (WebCore::screenHasInvertedColors): Ditto.
+        (WebCore::screenRect): Simplified using new elpers.
+        (WebCore::screenAvailableRect): Ditto.
+        (WebCore::screenSupportsExtendedColor): Streamlined using fewer local variables and
+        using auto for types of the results of adoptCF.
+        (WebCore::toUserSpace): Updated for function name changes.
+        (WebCore::toDeviceSpace): Ditto.
+
</ins><span class="cx"> 2016-05-26  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Purge PassRefPtr in Modules/battery
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsobjcDOMmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/objc/DOM.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/objc/DOM.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/bindings/objc/DOM.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -762,7 +762,9 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><ins>+
</ins><span class="cx"> @implementation DOMHTMLLinkElement (WebPrivate)
</span><ins>+
</ins><span class="cx"> - (BOOL)_mediaQueryMatchesForOrientation:(int)orientation
</span><span class="cx"> {
</span><span class="cx">     Document&amp; document = static_cast&lt;HTMLLinkElement*&gt;(core(self))-&gt;document();
</span><span class="lines">@@ -790,18 +792,19 @@
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_mediaQueryMatches
</span><span class="cx"> {
</span><del>-    HTMLLinkElement* link = static_cast&lt;HTMLLinkElement*&gt;(core(self));
-    String media = link-&gt;getAttribute(HTMLNames::mediaAttr);
</del><ins>+    HTMLLinkElement&amp; link = *static_cast&lt;HTMLLinkElement*&gt;(core(self));
+
+    auto&amp; media = link.fastGetAttribute(HTMLNames::mediaAttr);
</ins><span class="cx">     if (media.isEmpty())
</span><span class="cx">         return true;
</span><del>-    Document&amp; document = link-&gt;document();
</del><span class="cx"> 
</span><del>-    RefPtr&lt;MediaQuerySet&gt; mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(media);
-    MediaQueryEvaluator screenEval(&quot;screen&quot;, document.frame(), document.renderView() ? &amp;document.renderView()-&gt;style() : 0);
</del><ins>+    Document&amp; document = link.document();
+    auto mediaQuerySet = MediaQuerySet::createAllowingDescriptionSyntax(media);
+    return MediaQueryEvaluator { &quot;screen&quot;, document, document.renderView() ? &amp;document.renderView()-&gt;style() : nullptr }.evaluate(mediaQuerySet.get());
+}
</ins><span class="cx"> 
</span><del>-    return screenEval.eval(mediaQuerySet.get());
-}
</del><span class="cx"> @end
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> //------------------------------------------------------------------------------------------
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSGrammaryin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.y.in (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSGrammar.y.in        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -37,9 +37,9 @@
</span><span class="cx">     MediaQuerySet* mediaList;
</span><span class="cx">     MediaQuery* mediaQuery;
</span><span class="cx">     MediaQuery::Restrictor mediaQueryRestrictor;
</span><del>-    MediaQueryExp* mediaQueryExp;
</del><ins>+    MediaQueryExpression* mediaQueryExpression;
</ins><span class="cx">     Vector&lt;CSSParser::SourceSize&gt;* sourceSizeList;
</span><del>-    Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;* mediaQueryExpList;
</del><ins>+    Vector&lt;MediaQueryExpression&gt;* mediaQueryExpressionList;
</ins><span class="cx">     StyleKeyframe* keyframe;
</span><span class="cx">     Vector&lt;RefPtr&lt;StyleKeyframe&gt;&gt;* keyframeRuleList;
</span><span class="cx">     CSSPropertyID id;
</span><span class="lines">@@ -271,20 +271,20 @@
</span><span class="cx"> 
</span><span class="cx"> %type &lt;mediaQueryRestrictor&gt; maybe_media_restrictor
</span><span class="cx"> 
</span><del>-%type &lt;mediaQueryExp&gt; media_query_exp base_media_query_exp
-%destructor { delete $$; } media_query_exp base_media_query_exp
</del><ins>+%type &lt;mediaQueryExpression&gt; media_query_expression base_media_query_expression
+%destructor { delete $$; } media_query_expression base_media_query_expression
</ins><span class="cx"> 
</span><span class="cx"> %type &lt;sourceSizeList&gt; source_size_list
</span><span class="cx"> %destructor { delete $$; } source_size_list
</span><span class="cx"> 
</span><del>-%type &lt;mediaQueryExp&gt; maybe_source_media_query_exp
-%destructor { delete $$; } maybe_source_media_query_exp
</del><ins>+%type &lt;mediaQueryExpression&gt; maybe_source_media_query_expression
+%destructor { delete $$; } maybe_source_media_query_expression
</ins><span class="cx"> 
</span><span class="cx"> %type &lt;value&gt; source_size_length
</span><span class="cx"> %destructor { destroy($$); } source_size_length
</span><span class="cx"> 
</span><del>-%type &lt;mediaQueryExpList&gt; media_query_exp_list maybe_and_media_query_exp_list
-%destructor { delete $$; } media_query_exp_list maybe_and_media_query_exp_list
</del><ins>+%type &lt;mediaQueryExpressionList&gt; media_query_expression_list maybe_and_media_query_expression_list
+%destructor { delete $$; } media_query_expression_list maybe_and_media_query_expression_list
</ins><span class="cx"> 
</span><span class="cx"> %type &lt;string&gt; keyframe_name
</span><span class="cx"> 
</span><span class="lines">@@ -576,59 +576,63 @@
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> source_size_list:
</span><del>-    maybe_source_media_query_exp source_size_length {
</del><ins>+    maybe_source_media_query_expression source_size_length {
</ins><span class="cx">         $$ = new Vector&lt;CSSParser::SourceSize&gt;;
</span><del>-        $$-&gt;append(parser-&gt;sourceSize(std::unique_ptr&lt;MediaQueryExp&gt;($1), $2));
</del><ins>+        $$-&gt;append(parser-&gt;sourceSize(WTFMove(*$1), $2));
+        delete $1;
</ins><span class="cx">     }
</span><del>-    | source_size_list maybe_space ',' maybe_space maybe_source_media_query_exp source_size_length {
</del><ins>+    | source_size_list maybe_space ',' maybe_space maybe_source_media_query_expression source_size_length {
</ins><span class="cx">         $$ = $1;
</span><del>-        $$-&gt;append(parser-&gt;sourceSize(std::unique_ptr&lt;MediaQueryExp&gt;($5), $6));
</del><ins>+        $$-&gt;append(parser-&gt;sourceSize(WTFMove(*$5), $6));
+        delete $5;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-maybe_source_media_query_exp:
</del><ins>+maybe_source_media_query_expression:
</ins><span class="cx">     /* empty */ {
</span><del>-        $$ = new MediaQueryExp;
</del><ins>+        $$ = new MediaQueryExpression;
</ins><span class="cx">     }
</span><del>-    | base_media_query_exp maybe_space;
</del><ins>+    | base_media_query_expression maybe_space;
</ins><span class="cx"> 
</span><span class="cx"> source_size_length: unary_term | calc_function;
</span><span class="cx"> 
</span><del>-base_media_query_exp: '(' maybe_space IDENT maybe_space maybe_media_value ')' {
</del><ins>+base_media_query_expression: '(' maybe_space IDENT maybe_space maybe_media_value ')' {
</ins><span class="cx">         std::unique_ptr&lt;CSSParserValueList&gt; mediaValue($5);
</span><span class="cx">         $3.convertToASCIILowercaseInPlace();
</span><del>-        $$ = new MediaQueryExp($3, mediaValue.get());
</del><ins>+        $$ = new MediaQueryExpression($3, mediaValue.get());
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-media_query_exp:
-    maybe_media_restrictor maybe_space base_media_query_exp maybe_space {
</del><ins>+media_query_expression:
+    maybe_media_restrictor maybe_space base_media_query_expression maybe_space {
</ins><span class="cx">         if ($1 != MediaQuery::None) {
</span><span class="cx">             // If restrictor is specified, media query expression is invalid.
</span><span class="cx">             // Create empty media query expression and continue parsing media query.
</span><span class="cx">             delete $3;
</span><del>-            $$ = new MediaQueryExp;
</del><ins>+            $$ = new MediaQueryExpression;
</ins><span class="cx">         } else
</span><span class="cx">             $$ = $3;
</span><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-media_query_exp_list:
-    media_query_exp {
-        $$ = new Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;;
-        $$-&gt;append(std::unique_ptr&lt;MediaQueryExp&gt;($1));
</del><ins>+media_query_expression_list:
+    media_query_expression {
+        $$ = new Vector&lt;MediaQueryExpression&gt;;
+        $$-&gt;append(WTFMove(*$1));
+        delete $1;
</ins><span class="cx">     }
</span><del>-    | media_query_exp_list maybe_space MEDIA_AND maybe_space media_query_exp {
</del><ins>+    | media_query_expression_list maybe_space MEDIA_AND maybe_space media_query_expression {
</ins><span class="cx">         $$ = $1;
</span><del>-        $$-&gt;append(std::unique_ptr&lt;MediaQueryExp&gt;($5));
</del><ins>+        $$-&gt;append(WTFMove(*$5));
+        delete $5;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><del>-maybe_and_media_query_exp_list:
</del><ins>+maybe_and_media_query_expression_list:
</ins><span class="cx">     /*empty*/ {
</span><del>-        $$ = new Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;;
</del><ins>+        $$ = new Vector&lt;MediaQueryExpression&gt;;
</ins><span class="cx">     }
</span><del>-    | MEDIA_AND maybe_space media_query_exp_list {
</del><ins>+    | MEDIA_AND maybe_space media_query_expression_list {
</ins><span class="cx">         $$ = $3;
</span><span class="cx">     }
</span><span class="cx">     ;
</span><span class="lines">@@ -646,13 +650,15 @@
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="cx"> media_query:
</span><del>-    media_query_exp_list {
-        $$ = new MediaQuery(MediaQuery::None, &quot;all&quot;, std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;&gt;($1));
</del><ins>+    media_query_expression_list {
+        $$ = new MediaQuery(MediaQuery::None, &quot;all&quot;, WTFMove(*$1));
+        delete $1;
</ins><span class="cx">     }
</span><span class="cx">     |
</span><del>-    maybe_media_restrictor maybe_space IDENT maybe_space maybe_and_media_query_exp_list {
</del><ins>+    maybe_media_restrictor maybe_space IDENT maybe_space maybe_and_media_query_expression_list {
</ins><span class="cx">         $3.convertToASCIILowercaseInPlace();
</span><del>-        $$ = new MediaQuery($1, $3, std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;&gt;($5));
</del><ins>+        $$ = new MediaQuery($1, $3, WTFMove(*$5));
+        delete $5;
</ins><span class="cx">     }
</span><span class="cx">     ;
</span><span class="cx"> 
</span><span class="lines">@@ -661,16 +667,17 @@
</span><span class="cx"> media_list:
</span><span class="cx">     media_query {
</span><span class="cx">         $$ = &amp;MediaQuerySet::create().leakRef();
</span><del>-        $$-&gt;addMediaQuery(std::unique_ptr&lt;MediaQuery&gt;($1));
</del><ins>+        $$-&gt;addMediaQuery(WTFMove(*$1));
+        delete $1;
</ins><span class="cx">         parser-&gt;updateLastMediaLine(*$$);
</span><span class="cx">     }
</span><span class="cx">     | media_list ',' maybe_space media_query {
</span><span class="cx">         $$ = $1;
</span><del>-        std::unique_ptr&lt;MediaQuery&gt; mediaQuery($4);
</del><span class="cx">         if ($$) {
</span><del>-            $$-&gt;addMediaQuery(WTFMove(mediaQuery));
</del><ins>+            $$-&gt;addMediaQuery(WTFMove(*$4));
</ins><span class="cx">             parser-&gt;updateLastMediaLine(*$$);
</span><span class="cx">         }
</span><ins>+        delete $4;
</ins><span class="cx">     }
</span><span class="cx">     | media_list error {
</span><span class="cx">         $$ = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSImportRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImportRule.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImportRule.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/CSSImportRule.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -19,27 +19,21 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef CSSImportRule_h
-#define CSSImportRule_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;CSSRule.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class CachedCSSStyleSheet;
</del><span class="cx"> class MediaList;
</span><del>-class MediaQuerySet;
</del><span class="cx"> class StyleRuleImport;
</span><span class="cx"> 
</span><span class="cx"> class CSSImportRule final : public CSSRule {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;CSSImportRule&gt; create(StyleRuleImport&amp; rule, CSSStyleSheet* sheet) { return adoptRef(*new CSSImportRule(rule, sheet)); }
</span><del>-    
</del><ins>+
</ins><span class="cx">     virtual ~CSSImportRule();
</span><span class="cx"> 
</span><del>-    String cssText() const override;
-    void reattach(StyleRuleBase&amp;) override;
-
</del><span class="cx">     String href() const;
</span><span class="cx">     MediaList&amp; media() const;
</span><span class="cx">     CSSStyleSheet* styleSheet() const;
</span><span class="lines">@@ -47,7 +41,9 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSImportRule(StyleRuleImport&amp;, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const override { return IMPORT_RULE; }
</del><ins>+    CSSRule::Type type() const final { return IMPORT_RULE; }
+    String cssText() const final;
+    void reattach(StyleRuleBase&amp;) final;
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;StyleRuleImport&gt; m_importRule;
</span><span class="cx">     mutable RefPtr&lt;MediaList&gt; m_mediaCSSOMWrapper;
</span><span class="lines">@@ -57,5 +53,3 @@
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSImportRule, CSSRule::IMPORT_RULE)
</span><del>-
-#endif // CSSImportRule_h
</del></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1529,19 +1529,20 @@
</span><span class="cx"> 
</span><span class="cx"> // FIXME(141289): The following two constructors are only needed because of a bug in MSVC 2013 (and prior).
</span><span class="cx"> // We should remove this code as soon as a Visual Studio update that fixes this problem is released.
</span><ins>+
</ins><span class="cx"> CSSParser::SourceSize::SourceSize(CSSParser::SourceSize&amp;&amp; original)
</span><span class="cx">     : expression(WTFMove(original.expression))
</span><del>-    , length(original.length)
</del><ins>+    , length(WTFMove(original.length))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSParser::SourceSize::SourceSize(std::unique_ptr&lt;MediaQueryExp&gt;&amp;&amp; origExp, RefPtr&lt;CSSValue&gt;&amp;&amp; value)
-    : expression(WTFMove(origExp))
</del><ins>+CSSParser::SourceSize::SourceSize(MediaQueryExpression&amp;&amp; expression, Ref&lt;CSSValue&gt;&amp;&amp; value)
+    : expression(WTFMove(expression))
</ins><span class="cx">     , length(WTFMove(value))
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CSSParser::SourceSize CSSParser::sourceSize(std::unique_ptr&lt;MediaQueryExp&gt;&amp;&amp; expression, CSSParserValue&amp; parserValue)
</del><ins>+CSSParser::SourceSize CSSParser::sourceSize(MediaQueryExpression&amp;&amp; expression, CSSParserValue&amp; parserValue)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;CSSValue&gt; value;
</span><span class="cx">     if (isCalculation(parserValue)) {
</span><span class="lines">@@ -1554,7 +1555,7 @@
</span><span class="cx">     destroy(parserValue);
</span><span class="cx">     // FIXME: Calling the constructor explicitly here to work around an MSVC bug.
</span><span class="cx">     // For other compilers, we did not need to define the constructors and we could use aggregate initialization syntax.
</span><del>-    return SourceSize(WTFMove(expression), WTFMove(value));
</del><ins>+    return SourceSize(WTFMove(expression), value.releaseNonNull());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static inline void filterProperties(bool important, const ParsedPropertyVector&amp; input, Vector&lt;CSSProperty, 256&gt;&amp; output, size_t&amp; unusedEntries, std::bitset&lt;numCSSProperties&gt;&amp; seenProperties, HashSet&lt;AtomicString&gt;&amp; seenCustomProperties)
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/CSSParser.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -66,7 +66,7 @@
</span><span class="cx"> class Document;
</span><span class="cx"> class Element;
</span><span class="cx"> class ImmutableStyleProperties;
</span><del>-class MediaQueryExp;
</del><ins>+class MediaQueryExpression;
</ins><span class="cx"> class MediaQuerySet;
</span><span class="cx"> class MutableStyleProperties;
</span><span class="cx"> class SVGColor;
</span><span class="lines">@@ -168,14 +168,14 @@
</span><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; parseBackgroundColor();
</span><span class="cx"> 
</span><span class="cx">     struct SourceSize {
</span><del>-        std::unique_ptr&lt;MediaQueryExp&gt; expression;
-        RefPtr&lt;CSSValue&gt; length;
</del><ins>+        MediaQueryExpression expression;
+        Ref&lt;CSSValue&gt; length;
</ins><span class="cx"> 
</span><span class="cx">         SourceSize(SourceSize&amp;&amp;);
</span><del>-        SourceSize(std::unique_ptr&lt;MediaQueryExp&gt;&amp;&amp;, RefPtr&lt;CSSValue&gt;&amp;&amp;);
</del><ins>+        SourceSize(MediaQueryExpression&amp;&amp;, Ref&lt;CSSValue&gt;&amp;&amp;);
</ins><span class="cx">     };
</span><span class="cx">     Vector&lt;SourceSize&gt; parseSizesAttribute(StringView);
</span><del>-    SourceSize sourceSize(std::unique_ptr&lt;MediaQueryExp&gt;&amp;&amp;, CSSParserValue&amp;);
</del><ins>+    SourceSize sourceSize(MediaQueryExpression&amp;&amp;, CSSParserValue&amp;);
</ins><span class="cx"> 
</span><span class="cx">     bool parseFillImage(CSSParserValueList&amp;, RefPtr&lt;CSSValue&gt;&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleSheetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -227,11 +227,7 @@
</span><span class="cx">     m_mediaQueries = WTFMove(mediaQueries);
</span><span class="cx">     if (m_mediaCSSOMWrapper &amp;&amp; m_mediaQueries)
</span><span class="cx">         m_mediaCSSOMWrapper-&gt;reattach(m_mediaQueries.get());
</span><del>-
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
-    // Add warning message to inspector whenever dpi/dpcm values are used for &quot;screen&quot; media.
</del><span class="cx">     reportMediaQueryWarningIfNeeded(ownerDocument(), m_mediaQueries.get());
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned CSSStyleSheet::length() const
</span></span></pre></div>
<a id="trunkSourceWebCorecssDocumentRuleSetscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DocumentRuleSets.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DocumentRuleSets.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/DocumentRuleSets.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     // needs to be reconstructed. To handle insertions too the rule order numbers would need to be updated.
</span><span class="cx">     for (auto&amp; cssSheet : styleSheets) {
</span><span class="cx">         ASSERT(!cssSheet-&gt;disabled());
</span><del>-        if (cssSheet-&gt;mediaQueries() &amp;&amp; !medium-&gt;eval(cssSheet-&gt;mediaQueries(), resolver))
</del><ins>+        if (cssSheet-&gt;mediaQueries() &amp;&amp; !medium-&gt;evaluate(*cssSheet-&gt;mediaQueries(), resolver))
</ins><span class="cx">             continue;
</span><span class="cx">         m_authorStyle-&gt;addRulesFromSheet(cssSheet-&gt;contents(), *medium, resolver);
</span><span class="cx">         inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet.get());
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaFeatureNamescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaFeatureNames.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaFeatureNames.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaFeatureNames.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -30,8 +30,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace MediaFeatureNames {
</span><span class="cx"> 
</span><del>-#define DEFINE_MEDIAFEATURE_GLOBAL(name, str) \
-    DEFINE_GLOBAL(AtomicString, name##MediaFeature, str)
</del><ins>+#define DEFINE_MEDIAFEATURE_GLOBAL(name, string) DEFINE_GLOBAL(AtomicString, name)
</ins><span class="cx"> CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(DEFINE_MEDIAFEATURE_GLOBAL)
</span><span class="cx"> #undef DEFINE_MEDIAFEATURE_GLOBAL
</span><span class="cx"> 
</span><span class="lines">@@ -39,10 +38,9 @@
</span><span class="cx"> {
</span><span class="cx">     static bool initialized;
</span><span class="cx">     if (!initialized) {
</span><del>-       // Use placement new to initialize the globals.
-
</del><ins>+        // Use placement new to initialize the globals.
</ins><span class="cx">         AtomicString::init();
</span><del>-#define INITIALIZE_GLOBAL(name, str) new (NotNull, (void*)&amp;name##MediaFeature) AtomicString(str, AtomicString::ConstructFromLiteral);
</del><ins>+#define INITIALIZE_GLOBAL(name, string) new (NotNull, (void*)&amp;name) AtomicString(string, AtomicString::ConstructFromLiteral);
</ins><span class="cx">         CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(INITIALIZE_GLOBAL)
</span><span class="cx"> #undef INITIALIZE_GLOBAL
</span><span class="cx">         initialized = true;
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaFeatureNamesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaFeatureNames.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaFeatureNames.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaFeatureNames.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -17,80 +17,78 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  *
</span><span class="cx">  */
</span><del>-#ifndef MediaFeatureNames_h
-#define MediaFeatureNames_h
</del><span class="cx"> 
</span><ins>+#pragma once
+
</ins><span class="cx"> #include &lt;wtf/text/AtomicString.h&gt;
</span><span class="cx"> 
</span><del>-namespace WebCore {
-    namespace MediaFeatureNames {
-
</del><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><del>-#define CSS_MEDIAQUERY_VIEW_MODE(macro) macro(view_mode, &quot;-webkit-view-mode&quot;)
</del><ins>+#define CSS_MEDIAQUERY_VIEW_MODE(macro) macro(viewMode, &quot;-webkit-view-mode&quot;)
</ins><span class="cx"> #else
</span><span class="cx"> #define CSS_MEDIAQUERY_VIEW_MODE(macro)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
</span><del>-    macro(any_hover, &quot;any-hover&quot;) \
-    macro(any_pointer, &quot;any-pointer&quot;) \
</del><ins>+    macro(animation, &quot;-webkit-animation&quot;) \
+    macro(anyHover, &quot;any-hover&quot;) \
+    macro(anyPointer, &quot;any-pointer&quot;) \
+    macro(aspectRatio, &quot;aspect-ratio&quot;) \
</ins><span class="cx">     macro(color, &quot;color&quot;) \
</span><del>-    macro(color_index, &quot;color-index&quot;) \
-    macro(color_gamut, &quot;color-gamut&quot;) \
</del><ins>+    macro(colorGamut, &quot;color-gamut&quot;) \
+    macro(colorIndex, &quot;color-index&quot;) \
+    macro(deviceAspectRatio, &quot;device-aspect-ratio&quot;) \
+    macro(deviceHeight, &quot;device-height&quot;) \
+    macro(devicePixelRatio, &quot;-webkit-device-pixel-ratio&quot;) \
+    macro(deviceWidth, &quot;device-width&quot;) \
</ins><span class="cx">     macro(grid, &quot;grid&quot;) \
</span><del>-    macro(monochrome, &quot;monochrome&quot;) \
</del><span class="cx">     macro(height, &quot;height&quot;) \
</span><span class="cx">     macro(hover, &quot;hover&quot;) \
</span><del>-    macro(width, &quot;width&quot;) \
</del><ins>+    macro(invertedColors, &quot;inverted-colors&quot;) \
+    macro(maxAspectRatio, &quot;max-aspect-ratio&quot;) \
+    macro(maxColor, &quot;max-color&quot;) \
+    macro(maxColorIndex, &quot;max-color-index&quot;) \
+    macro(maxDeviceAspectRatio, &quot;max-device-aspect-ratio&quot;) \
+    macro(maxDeviceHeight, &quot;max-device-height&quot;) \
+    macro(maxDevicePixelRatio, &quot;-webkit-max-device-pixel-ratio&quot;) \
+    macro(maxDeviceWidth, &quot;max-device-width&quot;) \
+    macro(maxHeight, &quot;max-height&quot;) \
+    macro(maxMonochrome, &quot;max-monochrome&quot;) \
+    macro(maxResolution, &quot;max-resolution&quot;) \
+    macro(maxWidth, &quot;max-width&quot;) \
+    macro(minAspectRatio, &quot;min-aspect-ratio&quot;) \
+    macro(minColor, &quot;min-color&quot;) \
+    macro(minColorIndex, &quot;min-color-index&quot;) \
+    macro(minDeviceAspectRatio, &quot;min-device-aspect-ratio&quot;) \
+    macro(minDeviceHeight, &quot;min-device-height&quot;) \
+    macro(minDevicePixelRatio, &quot;-webkit-min-device-pixel-ratio&quot;) \
+    macro(minDeviceWidth, &quot;min-device-width&quot;) \
+    macro(minHeight, &quot;min-height&quot;) \
+    macro(minMonochrome, &quot;min-monochrome&quot;) \
+    macro(minResolution, &quot;min-resolution&quot;) \
+    macro(minWidth, &quot;min-width&quot;) \
+    macro(monochrome, &quot;monochrome&quot;) \
</ins><span class="cx">     macro(orientation, &quot;orientation&quot;) \
</span><del>-    macro(aspect_ratio, &quot;aspect-ratio&quot;) \
-    macro(device_aspect_ratio, &quot;device-aspect-ratio&quot;) \
-    macro(device_pixel_ratio, &quot;-webkit-device-pixel-ratio&quot;) \
-    macro(device_height, &quot;device-height&quot;) \
-    macro(device_width, &quot;device-width&quot;) \
-    macro(inverted_colors, &quot;inverted-colors&quot;) \
-    macro(max_color, &quot;max-color&quot;) \
-    macro(max_color_index, &quot;max-color-index&quot;) \
-    macro(max_aspect_ratio, &quot;max-aspect-ratio&quot;) \
-    macro(max_device_aspect_ratio, &quot;max-device-aspect-ratio&quot;) \
-    macro(max_device_pixel_ratio, &quot;-webkit-max-device-pixel-ratio&quot;) \
-    macro(max_device_height, &quot;max-device-height&quot;) \
-    macro(max_device_width, &quot;max-device-width&quot;) \
-    macro(max_height, &quot;max-height&quot;) \
-    macro(max_monochrome, &quot;max-monochrome&quot;) \
-    macro(max_width, &quot;max-width&quot;) \
-    macro(max_resolution, &quot;max-resolution&quot;) \
-    macro(min_color, &quot;min-color&quot;) \
-    macro(min_color_index, &quot;min-color-index&quot;) \
-    macro(min_aspect_ratio, &quot;min-aspect-ratio&quot;) \
-    macro(min_device_aspect_ratio, &quot;min-device-aspect-ratio&quot;) \
-    macro(min_device_pixel_ratio, &quot;-webkit-min-device-pixel-ratio&quot;) \
-    macro(min_device_height, &quot;min-device-height&quot;) \
-    macro(min_device_width, &quot;min-device-width&quot;) \
-    macro(min_height, &quot;min-height&quot;) \
-    macro(min_monochrome, &quot;min-monochrome&quot;) \
-    macro(min_width, &quot;min-width&quot;) \
-    macro(min_resolution, &quot;min-resolution&quot;) \
</del><span class="cx">     macro(pointer, &quot;pointer&quot;) \
</span><span class="cx">     macro(resolution, &quot;resolution&quot;) \
</span><del>-    macro(transform_2d, &quot;-webkit-transform-2d&quot;) \
-    macro(transform_3d, &quot;-webkit-transform-3d&quot;) \
</del><ins>+    macro(transform2d, &quot;-webkit-transform-2d&quot;) \
+    macro(transform3d, &quot;-webkit-transform-3d&quot;) \
</ins><span class="cx">     macro(transition, &quot;-webkit-transition&quot;) \
</span><del>-    macro(animation, &quot;-webkit-animation&quot;) \
-    macro(video_playable_inline, &quot;-webkit-video-playable-inline&quot;) \
</del><ins>+    macro(videoPlayableInline, &quot;-webkit-video-playable-inline&quot;) \
+    macro(width, &quot;width&quot;) \
</ins><span class="cx">     CSS_MEDIAQUERY_VIEW_MODE(macro)
</span><span class="cx"> 
</span><span class="cx"> // end of macro
</span><span class="cx"> 
</span><ins>+namespace WebCore {
+namespace MediaFeatureNames {
+
</ins><span class="cx"> #ifndef CSS_MEDIAQUERY_NAMES_HIDE_GLOBALS
</span><del>-    #define CSS_MEDIAQUERY_NAMES_DECLARE(name, str) extern const AtomicString name##MediaFeature;
</del><ins>+#define CSS_MEDIAQUERY_NAMES_DECLARE(name, string) extern const AtomicString name;
</ins><span class="cx">     CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(CSS_MEDIAQUERY_NAMES_DECLARE)
</span><del>-    #undef CSS_MEDIAQUERY_NAMES_DECLARE
</del><ins>+#undef CSS_MEDIAQUERY_NAMES_DECLARE
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-        void init();
</del><ins>+    void init();
</ins><span class="cx"> 
</span><del>-    } // namespace MediaFeatureNames
</del><ins>+} // namespace MediaFeatureNames
</ins><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // MediaFeatureNames_h
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaList.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaList.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaList.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -17,6 +17,7 @@
</span><span class="cx">  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><ins>+
</ins><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -26,9 +27,9 @@
</span><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><ins>+#include &quot;HTMLParserIdioms.h&quot;
</ins><span class="cx"> #include &quot;MediaFeatureNames.h&quot;
</span><span class="cx"> #include &quot;MediaQuery.h&quot;
</span><del>-#include &quot;MediaQueryExp.h&quot;
</del><span class="cx"> #include &quot;ScriptableDocumentParser.h&quot;
</span><span class="cx"> #include &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="lines">@@ -74,28 +75,27 @@
</span><span class="cx">     , m_lastLine(0)
</span><span class="cx"> {
</span><span class="cx">     bool success = parse(mediaString);
</span><ins>+
</ins><span class="cx">     // FIXME: parsing can fail. The problem with failing constructor is that
</span><span class="cx">     // we would need additional flag saying MediaList is not valid
</span><span class="cx">     // Parse can fail only when fallbackToDescriptor == false, i.e when HTML4 media descriptor
</span><span class="cx">     // forward-compatible syntax is not in use.
</span><span class="cx">     // DOMImplementationCSS seems to mandate that media descriptors are used
</span><del>-    // for both html and svg, even though svg:style doesn't use media descriptors
</del><ins>+    // for both HTML and SVG, even though svg:style doesn't use media descriptors
</ins><span class="cx">     // Currently the only places where parsing can fail are
</span><span class="cx">     // creating &lt;svg:style&gt;, creating css media / import rules from js
</span><del>-    
</del><ins>+
</ins><span class="cx">     // FIXME: This doesn't make much sense.
</span><span class="cx">     if (!success)
</span><span class="cx">         parse(&quot;invalid&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaQuerySet::MediaQuerySet(const MediaQuerySet&amp; o)
</span><del>-    : RefCounted&lt;MediaQuerySet&gt;()
</del><ins>+    : RefCounted()
</ins><span class="cx">     , m_fallbackToDescriptor(o.m_fallbackToDescriptor)
</span><span class="cx">     , m_lastLine(o.m_lastLine)
</span><del>-    , m_queries(o.m_queries.size())
</del><ins>+    , m_queries(o.m_queries)
</ins><span class="cx"> {
</span><del>-    for (unsigned i = 0; i &lt; m_queries.size(); ++i)
-        m_queries[i] = o.m_queries[i]-&gt;copy();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaQuerySet::~MediaQuerySet()
</span><span class="lines">@@ -109,46 +109,51 @@
</span><span class="cx">     // US ASCII letter [a-zA-Z] (ISO 10646 hex 41-5a, 61-7a), digit [0-9] (hex 30-39),
</span><span class="cx">     // or hyphen (hex 2d).&quot;
</span><span class="cx">     unsigned length = string.length();
</span><del>-    unsigned i = 0;
-    for (; i &lt; length; ++i) {
-        unsigned short c = string[i];
-        if (! ((c &gt;= 'a' &amp;&amp; c &lt;= 'z')
-               || (c &gt;= 'A' &amp;&amp; c &lt;= 'Z')
-               || (c &gt;= '1' &amp;&amp; c &lt;= '9')
-               || (c == '-')))
</del><ins>+    unsigned i;
+    for (i = 0; i &lt; length; ++i) {
+        auto character = string[i];
+        if (!(isASCIIAlphanumeric(character) || character == '-'))
</ins><span class="cx">             break;
</span><span class="cx">     }
</span><span class="cx">     return string.left(i);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Optional&lt;MediaQuery&gt; MediaQuerySet::internalParse(CSSParser&amp; parser, const String&amp; queryString)
+{
+    if (auto query = parser.parseMediaQuery(queryString))
+        return WTFMove(*query);
+    if (!m_fallbackToDescriptor)
+        return Nullopt;
+    return MediaQuery { MediaQuery::None, parseMediaDescriptor(queryString), Vector&lt;MediaQueryExpression&gt; { } };
+}
+
+Optional&lt;MediaQuery&gt; MediaQuerySet::internalParse(const String&amp; queryString)
+{
+    CSSParser parser(CSSStrictMode);
+    return internalParse(parser, queryString);
+}
+
</ins><span class="cx"> bool MediaQuerySet::parse(const String&amp; mediaString)
</span><span class="cx"> {
</span><span class="cx">     CSSParser parser(CSSStrictMode);
</span><span class="cx">     
</span><del>-    Vector&lt;std::unique_ptr&lt;MediaQuery&gt;&gt; result;
</del><ins>+    Vector&lt;MediaQuery&gt; result;
</ins><span class="cx">     Vector&lt;String&gt; list;
</span><span class="cx">     mediaString.split(',', list);
</span><del>-    for (unsigned i = 0; i &lt; list.size(); ++i) {
-        String medium = list[i].stripWhiteSpace();
</del><ins>+    for (auto&amp; listString : list) {
+        String medium = stripLeadingAndTrailingHTMLSpaces(listString);
</ins><span class="cx">         if (medium.isEmpty()) {
</span><del>-            if (!m_fallbackToDescriptor)
-                return false;
</del><ins>+            if (m_fallbackToDescriptor)
+                continue;
+        } else if (auto query = internalParse(parser, medium)) {
+            result.append(WTFMove(query.value()));
</ins><span class="cx">             continue;
</span><span class="cx">         }
</span><del>-        std::unique_ptr&lt;MediaQuery&gt; mediaQuery = parser.parseMediaQuery(medium);
-        if (!mediaQuery) {
-            if (!m_fallbackToDescriptor)
-                return false;
-            String mediaDescriptor = parseMediaDescriptor(medium);
-            if (mediaDescriptor.isNull())
-                continue;
-            mediaQuery = std::make_unique&lt;MediaQuery&gt;(MediaQuery::None, mediaDescriptor, nullptr);
-        }
-        result.append(WTFMove(mediaQuery));
</del><ins>+        return false;
</ins><span class="cx">     }
</span><span class="cx">     // &quot;,,,,&quot; falls straight through, but is not valid unless fallback
</span><span class="cx">     if (!m_fallbackToDescriptor &amp;&amp; list.isEmpty()) {
</span><del>-        String strippedMediaString = mediaString.stripWhiteSpace();
</del><ins>+        String strippedMediaString = stripLeadingAndTrailingHTMLSpaces(mediaString);
</ins><span class="cx">         if (!strippedMediaString.isEmpty())
</span><span class="cx">             return false;
</span><span class="cx">     }
</span><span class="lines">@@ -158,40 +163,24 @@
</span><span class="cx"> 
</span><span class="cx"> bool MediaQuerySet::add(const String&amp; queryString)
</span><span class="cx"> {
</span><del>-    CSSParser parser(CSSStrictMode);
-
-    std::unique_ptr&lt;MediaQuery&gt; parsedQuery = parser.parseMediaQuery(queryString);
-    if (!parsedQuery &amp;&amp; m_fallbackToDescriptor) {
-        String medium = parseMediaDescriptor(queryString);
-        if (!medium.isNull())
-            parsedQuery = std::make_unique&lt;MediaQuery&gt;(MediaQuery::None, medium, nullptr);
-    }
</del><ins>+    auto parsedQuery = internalParse(queryString);
</ins><span class="cx">     if (!parsedQuery)
</span><span class="cx">         return false;
</span><del>-
-    m_queries.append(WTFMove(parsedQuery));
</del><ins>+    m_queries.append(WTFMove(parsedQuery.value()));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaQuerySet::remove(const String&amp; queryStringToRemove)
</del><ins>+bool MediaQuerySet::remove(const String&amp; queryString)
</ins><span class="cx"> {
</span><del>-    CSSParser parser(CSSStrictMode);
-
-    std::unique_ptr&lt;MediaQuery&gt; parsedQuery = parser.parseMediaQuery(queryStringToRemove);
-    if (!parsedQuery &amp;&amp; m_fallbackToDescriptor) {
-        String medium = parseMediaDescriptor(queryStringToRemove);
-        if (!medium.isNull())
-            parsedQuery = std::make_unique&lt;MediaQuery&gt;(MediaQuery::None, medium, nullptr);
-    }
</del><ins>+    auto parsedQuery = internalParse(queryString);
</ins><span class="cx">     if (!parsedQuery)
</span><span class="cx">         return false;
</span><del>-    
</del><span class="cx">     return m_queries.removeFirstMatching([&amp;parsedQuery](auto&amp; query) {
</span><del>-        return *query == *parsedQuery;
</del><ins>+        return query == parsedQuery.value();
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQuerySet::addMediaQuery(std::unique_ptr&lt;MediaQuery&gt; mediaQuery)
</del><ins>+void MediaQuerySet::addMediaQuery(MediaQuery&amp;&amp; mediaQuery)
</ins><span class="cx"> {
</span><span class="cx">     m_queries.append(WTFMove(mediaQuery));
</span><span class="cx"> }
</span><span class="lines">@@ -199,14 +188,12 @@
</span><span class="cx"> String MediaQuerySet::mediaText() const
</span><span class="cx"> {
</span><span class="cx">     StringBuilder text;
</span><del>-    
-    bool first = true;
-    for (size_t i = 0; i &lt; m_queries.size(); ++i) {
-        if (!first)
</del><ins>+    bool needComma = false;
+    for (auto&amp; query : m_queries) {
+        if (needComma)
</ins><span class="cx">             text.appendLiteral(&quot;, &quot;);
</span><del>-        else
-            first = false;
-        text.append(m_queries[i]-&gt;cssText());
</del><ins>+        text.append(query.cssText());
+        needComma = true;
</ins><span class="cx">     }
</span><span class="cx">     return text.toString();
</span><span class="cx"> }
</span><span class="lines">@@ -214,13 +201,11 @@
</span><span class="cx"> MediaList::MediaList(MediaQuerySet* mediaQueries, CSSStyleSheet* parentSheet)
</span><span class="cx">     : m_mediaQueries(mediaQueries)
</span><span class="cx">     , m_parentStyleSheet(parentSheet)
</span><del>-    , m_parentRule(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaList::MediaList(MediaQuerySet* mediaQueries, CSSRule* parentRule)
</span><span class="cx">     : m_mediaQueries(mediaQueries)
</span><del>-    , m_parentStyleSheet(0)
</del><span class="cx">     , m_parentRule(parentRule)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -232,9 +217,7 @@
</span><span class="cx"> void MediaList::setMediaText(const String&amp; value, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     CSSStyleSheet::RuleMutationScope mutationScope(m_parentRule);
</span><del>-
-    bool success = m_mediaQueries-&gt;parse(value);
-    if (!success) {
</del><ins>+    if (!m_mediaQueries-&gt;parse(value)) {
</ins><span class="cx">         ec = SYNTAX_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -246,7 +229,7 @@
</span><span class="cx"> {
</span><span class="cx">     auto&amp; queries = m_mediaQueries-&gt;queryVector();
</span><span class="cx">     if (index &lt; queries.size())
</span><del>-        return queries[index]-&gt;cssText();
</del><ins>+        return queries[index].cssText();
</ins><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -284,11 +267,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(RESOLUTION_MEDIA_QUERY)
</span><del>-static void addResolutionWarningMessageToConsole(Document* document, const String&amp; serializedExpression, const CSSPrimitiveValue* value)
-{
-    ASSERT(document);
-    ASSERT(value);
</del><span class="cx"> 
</span><ins>+static void addResolutionWarningMessageToConsole(Document&amp; document, const String&amp; serializedExpression, const CSSPrimitiveValue&amp; value)
+{
</ins><span class="cx">     static NeverDestroyed&lt;String&gt; mediaQueryMessage(ASCIILiteral(&quot;Consider using 'dppx' units instead of '%replacementUnits%', as in CSS '%replacementUnits%' means dots-per-CSS-%lengthUnit%, not dots-per-physical-%lengthUnit%, so does not correspond to the actual '%replacementUnits%' of a screen. In media query expression: &quot;));
</span><span class="cx">     static NeverDestroyed&lt;String&gt; mediaValueDPI(ASCIILiteral(&quot;dpi&quot;));
</span><span class="cx">     static NeverDestroyed&lt;String&gt; mediaValueDPCM(ASCIILiteral(&quot;dpcm&quot;));
</span><span class="lines">@@ -296,16 +277,16 @@
</span><span class="cx">     static NeverDestroyed&lt;String&gt; lengthUnitCentimeter(ASCIILiteral(&quot;centimeter&quot;));
</span><span class="cx"> 
</span><span class="cx">     String message;
</span><del>-    if (value-&gt;isDotsPerInch())
-        message = String(mediaQueryMessage).replace(&quot;%replacementUnits%&quot;, mediaValueDPI).replace(&quot;%lengthUnit%&quot;, lengthUnitInch);
-    else if (value-&gt;isDotsPerCentimeter())
-        message = String(mediaQueryMessage).replace(&quot;%replacementUnits%&quot;, mediaValueDPCM).replace(&quot;%lengthUnit%&quot;, lengthUnitCentimeter);
</del><ins>+    if (value.isDotsPerInch())
+        message = mediaQueryMessage.get().replace(&quot;%replacementUnits%&quot;, mediaValueDPI).replace(&quot;%lengthUnit%&quot;, lengthUnitInch);
+    else if (value.isDotsPerCentimeter())
+        message = mediaQueryMessage.get().replace(&quot;%replacementUnits%&quot;, mediaValueDPCM).replace(&quot;%lengthUnit%&quot;, lengthUnitCentimeter);
</ins><span class="cx">     else
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx"> 
</span><span class="cx">     message.append(serializedExpression);
</span><span class="cx"> 
</span><del>-    document-&gt;addConsoleMessage(MessageSource::CSS, MessageLevel::Debug, message);
</del><ins>+    document.addConsoleMessage(MessageSource::CSS, MessageLevel::Debug, message);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void reportMediaQueryWarningIfNeeded(Document* document, const MediaQuerySet* mediaQuerySet)
</span><span class="lines">@@ -313,31 +294,23 @@
</span><span class="cx">     if (!mediaQuerySet || !document)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    auto&amp; mediaQueries = mediaQuerySet-&gt;queryVector();
-    const size_t queryCount = mediaQueries.size();
-
-    if (!queryCount)
-        return;
-
-    for (size_t i = 0; i &lt; queryCount; ++i) {
-        const MediaQuery* query = mediaQueries[i].get();
-        String mediaType = query-&gt;mediaType();
-        if (!query-&gt;ignored() &amp;&amp; !equalLettersIgnoringASCIICase(mediaType, &quot;print&quot;)) {
-            auto&amp; expressions = query-&gt;expressions();
-            for (size_t j = 0; j &lt; expressions.size(); ++j) {
-                const MediaQueryExp* exp = expressions.at(j).get();
-                if (exp-&gt;mediaFeature() == MediaFeatureNames::resolutionMediaFeature || exp-&gt;mediaFeature() == MediaFeatureNames::max_resolutionMediaFeature || exp-&gt;mediaFeature() == MediaFeatureNames::min_resolutionMediaFeature) {
-                    CSSValue* cssValue =  exp-&gt;value();
-                    if (is&lt;CSSPrimitiveValue&gt;(cssValue)) {
-                        CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*cssValue);
</del><ins>+    for (auto&amp; query : mediaQuerySet-&gt;queryVector()) {
+        if (!query.ignored() &amp;&amp; !equalLettersIgnoringASCIICase(query.mediaType(), &quot;print&quot;)) {
+            auto&amp; expressions = query.expressions();
+            for (auto&amp; expression : expressions) {
+                if (expression.mediaFeature() == MediaFeatureNames::resolution || expression.mediaFeature() == MediaFeatureNames::maxResolution || expression.mediaFeature() == MediaFeatureNames::minResolution) {
+                    auto* value = expression.value();
+                    if (is&lt;CSSPrimitiveValue&gt;(value)) {
+                        auto&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
</ins><span class="cx">                         if (primitiveValue.isDotsPerInch() || primitiveValue.isDotsPerCentimeter())
</span><del>-                            addResolutionWarningMessageToConsole(document, mediaQuerySet-&gt;mediaText(), &amp;primitiveValue);
</del><ins>+                            addResolutionWarningMessageToConsole(*document, mediaQuerySet-&gt;mediaText(), primitiveValue);
</ins><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaList.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaList.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaList.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -18,25 +18,23 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaList_h
-#define MediaList_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;ExceptionCode.h&quot;
</del><span class="cx"> #include &lt;memory&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><del>-#include &lt;wtf/PassRefPtr.h&gt;
-#include &lt;wtf/RefCounted.h&gt;
</del><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+class CSSParser;
</ins><span class="cx"> class CSSRule;
</span><span class="cx"> class CSSStyleSheet;
</span><span class="cx"> class Document;
</span><del>-class MediaList;
</del><span class="cx"> class MediaQuery;
</span><span class="cx"> 
</span><ins>+using ExceptionCode = int;
+
</ins><span class="cx"> class MediaQuerySet : public RefCounted&lt;MediaQuerySet&gt; {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;MediaQuerySet&gt; create()
</span><span class="lines">@@ -52,18 +50,18 @@
</span><span class="cx">         return adoptRef(*new MediaQuerySet(mediaString, true));
</span><span class="cx">     }
</span><span class="cx">     ~MediaQuerySet();
</span><del>-    
</del><ins>+
</ins><span class="cx">     bool parse(const String&amp;);
</span><span class="cx">     bool add(const String&amp;);
</span><span class="cx">     bool remove(const String&amp;);
</span><span class="cx"> 
</span><del>-    void addMediaQuery(std::unique_ptr&lt;MediaQuery&gt;);
</del><ins>+    void addMediaQuery(MediaQuery&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    const Vector&lt;std::unique_ptr&lt;MediaQuery&gt;&gt;&amp; queryVector() const { return m_queries; }
-    
</del><ins>+    const Vector&lt;MediaQuery&gt;&amp; queryVector() const { return m_queries; }
+
</ins><span class="cx">     int lastLine() const { return m_lastLine; }
</span><span class="cx">     void setLastLine(int lastLine) { m_lastLine = lastLine; }
</span><del>-    
</del><ins>+
</ins><span class="cx">     String mediaText() const;
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;MediaQuerySet&gt; copy() const { return adoptRef(*new MediaQuerySet(*this)); }
</span><span class="lines">@@ -72,10 +70,13 @@
</span><span class="cx">     MediaQuerySet();
</span><span class="cx">     MediaQuerySet(const String&amp; mediaQuery, bool fallbackToDescription);
</span><span class="cx">     MediaQuerySet(const MediaQuerySet&amp;);
</span><del>-    
</del><ins>+
+    Optional&lt;MediaQuery&gt; internalParse(CSSParser&amp;, const String&amp;);
+    Optional&lt;MediaQuery&gt; internalParse(const String&amp;);
+
</ins><span class="cx">     unsigned m_fallbackToDescriptor : 1; // true if failed media query parsing should fallback to media description parsing.
</span><span class="cx">     signed m_lastLine : 31;
</span><del>-    Vector&lt;std::unique_ptr&lt;MediaQuery&gt;&gt; m_queries;
</del><ins>+    Vector&lt;MediaQuery&gt; m_queries;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class MediaList : public RefCounted&lt;MediaList&gt; {
</span><span class="lines">@@ -99,11 +100,10 @@
</span><span class="cx">     String mediaText() const { return m_mediaQueries-&gt;mediaText(); }
</span><span class="cx">     void setMediaText(const String&amp;, ExceptionCode&amp;);
</span><span class="cx"> 
</span><del>-    // Not part of CSSOM.
</del><span class="cx">     CSSRule* parentRule() const { return m_parentRule; }
</span><span class="cx">     CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; }
</span><del>-    void clearParentStyleSheet() { ASSERT(m_parentStyleSheet); m_parentStyleSheet = 0; }
-    void clearParentRule() { ASSERT(m_parentRule); m_parentRule = 0; }
</del><ins>+    void clearParentStyleSheet() { ASSERT(m_parentStyleSheet); m_parentStyleSheet = nullptr; }
+    void clearParentRule() { ASSERT(m_parentRule); m_parentRule = nullptr; }
</ins><span class="cx">     const MediaQuerySet* queries() const { return m_mediaQueries.get(); }
</span><span class="cx"> 
</span><span class="cx">     void reattach(MediaQuerySet*);
</span><span class="lines">@@ -114,15 +114,20 @@
</span><span class="cx">     MediaList(MediaQuerySet*, CSSRule* parentRule);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MediaQuerySet&gt; m_mediaQueries;
</span><del>-    CSSStyleSheet* m_parentStyleSheet;
-    CSSRule* m_parentRule;
</del><ins>+    CSSStyleSheet* m_parentStyleSheet { nullptr };
+    CSSRule* m_parentRule { nullptr };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-#if ENABLE(RESOLUTION_MEDIA_QUERY)
</del><span class="cx"> // Adds message to inspector console whenever dpi or dpcm values are used for &quot;screen&quot; media.
</span><ins>+// FIXME: Seems strange to have this here in this file, and unclear exactly who should call this and when.
</ins><span class="cx"> void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*);
</span><ins>+
+#if !ENABLE(RESOLUTION_MEDIA_QUERY)
+
+inline void reportMediaQueryWarningIfNeeded(Document*, const MediaQuerySet*)
+{
+}
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaQuerycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQuery.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQuery.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQuery.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -29,7 +29,6 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;MediaQuery.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;MediaQueryExp.h&quot;
</del><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -37,86 +36,62 @@
</span><span class="cx"> // http://dev.w3.org/csswg/cssom/#serialize-a-media-query
</span><span class="cx"> String MediaQuery::serialize() const
</span><span class="cx"> {
</span><del>-    StringBuilder result;
-    if (!m_ignored) {
-        switch (m_restrictor) {
-        case MediaQuery::Only:
-            result.appendLiteral(&quot;only &quot;);
-            break;
-        case MediaQuery::Not:
-            result.appendLiteral(&quot;not &quot;);
-            break;
-        case MediaQuery::None:
-            break;
-        }
</del><ins>+    if (m_ignored) {
+        // If query is invalid, serialized text should turn into &quot;not all&quot;.
+        return ASCIILiteral(&quot;not all&quot;);
+    }
</ins><span class="cx"> 
</span><del>-        if (m_expressions-&gt;isEmpty()) {
-            result.append(m_mediaType);
-            return result.toString();
-        }
-
-        if (m_mediaType != &quot;all&quot; || m_restrictor != None) {
-            result.append(m_mediaType);
</del><ins>+    bool shouldOmitMediaType = false;
+    StringBuilder result;
+    switch (m_restrictor) {
+    case MediaQuery::Only:
+        result.appendLiteral(&quot;only &quot;);
+        break;
+    case MediaQuery::Not:
+        result.appendLiteral(&quot;not &quot;);
+        break;
+    case MediaQuery::None:
+        shouldOmitMediaType = !m_expressions.isEmpty() &amp;&amp; m_mediaType == &quot;all&quot;;
+        break;
+    }
+    bool needsAnd = false;
+    if (!shouldOmitMediaType) {
+        result.append(m_mediaType);
+        needsAnd = true;
+    }
+    for (auto&amp; expression : m_expressions) {
+        if (needsAnd)
</ins><span class="cx">             result.appendLiteral(&quot; and &quot;);
</span><del>-        }
-
-        result.append(m_expressions-&gt;at(0)-&gt;serialize());
-        for (size_t i = 1; i &lt; m_expressions-&gt;size(); ++i) {
-            result.appendLiteral(&quot; and &quot;);
-            result.append(m_expressions-&gt;at(i)-&gt;serialize());
-        }
-    } else {
-        // If query is invalid, serialized text should turn into &quot;not all&quot;.
-        result.appendLiteral(&quot;not all&quot;);
</del><ins>+        result.append(expression.serialize());
+        needsAnd = true;
</ins><span class="cx">     }
</span><span class="cx">     return result.toString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQuery::MediaQuery(Restrictor r, const String&amp; mediaType, std::unique_ptr&lt;ExpressionVector&gt; exprs)
-    : m_restrictor(r)
</del><ins>+MediaQuery::MediaQuery(Restrictor restrictor, const String&amp; mediaType, Vector&lt;MediaQueryExpression&gt;&amp;&amp; expressions)
+    : m_restrictor(restrictor)
</ins><span class="cx">     , m_mediaType(mediaType.convertToASCIILowercase())
</span><del>-    , m_expressions(WTFMove(exprs))
-    , m_ignored(false)
</del><ins>+    , m_expressions(WTFMove(expressions))
</ins><span class="cx"> {
</span><del>-    if (!m_expressions) {
-        m_expressions = std::make_unique&lt;ExpressionVector&gt;();
-        return;
-    }
-
-    std::sort(m_expressions-&gt;begin(), m_expressions-&gt;end(), [](auto&amp; a, auto&amp; b) {
-        return codePointCompare(a-&gt;serialize(), b-&gt;serialize()) &lt; 0;
</del><ins>+    std::sort(m_expressions.begin(), m_expressions.end(), [](auto&amp; a, auto&amp; b) {
+        return codePointCompare(a.serialize(), b.serialize()) &lt; 0;
</ins><span class="cx">     });
</span><span class="cx"> 
</span><del>-    // remove all duplicated expressions
</del><ins>+    // Remove all duplicated expressions.
</ins><span class="cx">     String key;
</span><del>-    for (int i = m_expressions-&gt;size() - 1; i &gt;= 0; --i) {
</del><ins>+    for (int i = m_expressions.size() - 1; i &gt;= 0; --i) {
</ins><span class="cx"> 
</span><del>-        // if not all of the expressions is valid the media query must be ignored.
</del><ins>+        // If any expression is invalid the media query must be ignored.
</ins><span class="cx">         if (!m_ignored)
</span><del>-            m_ignored = !m_expressions-&gt;at(i)-&gt;isValid();
</del><ins>+            m_ignored = !m_expressions[i].isValid();
</ins><span class="cx"> 
</span><del>-        if (m_expressions-&gt;at(i)-&gt;serialize() == key)
-            m_expressions-&gt;remove(i);
</del><ins>+        if (m_expressions[i].serialize() == key)
+            m_expressions.remove(i);
</ins><span class="cx">         else
</span><del>-            key = m_expressions-&gt;at(i)-&gt;serialize();
</del><ins>+            key = m_expressions[i].serialize();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQuery::MediaQuery(const MediaQuery&amp; o)
-    : m_restrictor(o.m_restrictor)
-    , m_mediaType(o.m_mediaType)
-    , m_expressions(std::make_unique&lt;ExpressionVector&gt;(o.m_expressions-&gt;size()))
-    , m_ignored(o.m_ignored)
-    , m_serializationCache(o.m_serializationCache)
-{
-    for (unsigned i = 0; i &lt; m_expressions-&gt;size(); ++i)
-        (*m_expressions)[i] = std::make_unique&lt;MediaQueryExp&gt;(*o.m_expressions-&gt;at(i));
-}
-
-MediaQuery::~MediaQuery()
-{
-}
-
</del><span class="cx"> // http://dev.w3.org/csswg/cssom/#compare-media-queries
</span><span class="cx"> bool MediaQuery::operator==(const MediaQuery&amp; other) const
</span><span class="cx"> {
</span><span class="lines">@@ -124,11 +99,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // http://dev.w3.org/csswg/cssom/#serialize-a-list-of-media-queries
</span><del>-String MediaQuery::cssText() const
</del><ins>+const String&amp; MediaQuery::cssText() const
</ins><span class="cx"> {
</span><span class="cx">     if (m_serializationCache.isNull())
</span><del>-        const_cast&lt;MediaQuery*&gt;(this)-&gt;m_serializationCache = serialize();
-
</del><ins>+        m_serializationCache = serialize();
</ins><span class="cx">     return m_serializationCache;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQuery.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQuery.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQuery.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -26,49 +26,37 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaQuery_h
-#define MediaQuery_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &lt;memory&gt;
</del><ins>+#include &quot;MediaQueryExp.h&quot;
</ins><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><del>-#include &lt;wtf/text/StringHash.h&gt;
-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-class MediaQueryExp;
</del><span class="cx"> 
</span><span class="cx"> class MediaQuery {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    enum Restrictor {
-        Only, Not, None
-    };
</del><ins>+    enum Restrictor { Only, Not, None };
</ins><span class="cx"> 
</span><del>-    typedef Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt; ExpressionVector;
</del><ins>+    MediaQuery(Restrictor, const String&amp; mediaType, Vector&lt;MediaQueryExpression&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    MediaQuery(Restrictor, const String&amp; mediaType, std::unique_ptr&lt;Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;&gt; exprs);
-    MediaQuery(const MediaQuery&amp;);
-    ~MediaQuery();
-
</del><span class="cx">     Restrictor restrictor() const { return m_restrictor; }
</span><del>-    const Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;&amp; expressions() const { return *m_expressions; }
-    String mediaType() const { return m_mediaType; }
-    bool operator==(const MediaQuery&amp; other) const;
-    String cssText() const;
</del><ins>+    const Vector&lt;MediaQueryExpression&gt;&amp; expressions() const { return m_expressions; }
+    const String&amp; mediaType() const { return m_mediaType; }
</ins><span class="cx">     bool ignored() const { return m_ignored; }
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;MediaQuery&gt; copy() const { return std::make_unique&lt;MediaQuery&gt;(*this); }
</del><ins>+    const String&amp; cssText() const;
</ins><span class="cx"> 
</span><del>- private:
-    Restrictor m_restrictor;
-    String m_mediaType;
-    std::unique_ptr&lt;ExpressionVector&gt; m_expressions;
-    bool m_ignored;
-    String m_serializationCache;
</del><ins>+    bool operator==(const MediaQuery&amp; other) const;
</ins><span class="cx"> 
</span><ins>+private:
</ins><span class="cx">     String serialize() const;
</span><ins>+
+    Restrictor m_restrictor;
+    String m_mediaType;
+    Vector&lt;MediaQueryExpression&gt; m_expressions;
+    bool m_ignored { false };
+    mutable String m_serializationCache;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryEvaluatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryEvaluator.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> #include &quot;MediaFeatureNames.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="cx"> #include &quot;MediaQuery.h&quot;
</span><del>-#include &quot;MediaQueryExp.h&quot;
</del><span class="cx"> #include &quot;NodeRenderStyle.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PlatformScreen.h&quot;
</span><span class="lines">@@ -58,45 +57,43 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-using namespace MediaFeatureNames;
-
</del><span class="cx"> enum MediaFeaturePrefix { MinPrefix, MaxPrefix, NoPrefix };
</span><span class="cx"> 
</span><del>-typedef bool (*EvalFunc)(CSSValue*, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix);
-typedef HashMap&lt;AtomicStringImpl*, EvalFunc&gt; FunctionMap;
-static FunctionMap* gFunctionMap;
</del><ins>+typedef bool (*MediaQueryFunction)(CSSValue*, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix);
+typedef HashMap&lt;AtomicStringImpl*, MediaQueryFunction&gt; MediaQueryFunctionMap;
</ins><span class="cx"> 
</span><del>-/*
- * FIXME: following media features are not implemented: scan
- *
- * scan: The &quot;scan&quot; media feature describes the scanning process of
- * tv output devices. It's unknown how to retrieve this information from
- * the platform
- */
</del><ins>+static bool isViewportDependent(const AtomicString&amp; mediaFeature)
+{
+    return mediaFeature == MediaFeatureNames::width
+        || mediaFeature == MediaFeatureNames::height
+        || mediaFeature == MediaFeatureNames::minWidth
+        || mediaFeature == MediaFeatureNames::minHeight
+        || mediaFeature == MediaFeatureNames::maxWidth
+        || mediaFeature == MediaFeatureNames::maxHeight
+        || mediaFeature == MediaFeatureNames::orientation
+        || mediaFeature == MediaFeatureNames::aspectRatio
+        || mediaFeature == MediaFeatureNames::minAspectRatio
+        || mediaFeature == MediaFeatureNames::maxAspectRatio;
+}
</ins><span class="cx"> 
</span><span class="cx"> MediaQueryEvaluator::MediaQueryEvaluator(bool mediaFeatureResult)
</span><del>-    : m_expResult(mediaFeatureResult)
</del><ins>+    : m_fallbackResult(mediaFeatureResult)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaQueryEvaluator::MediaQueryEvaluator(const String&amp; acceptedMediaType, bool mediaFeatureResult)
</span><span class="cx">     : m_mediaType(acceptedMediaType)
</span><del>-    , m_expResult(mediaFeatureResult)
</del><ins>+    , m_fallbackResult(mediaFeatureResult)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQueryEvaluator::MediaQueryEvaluator(const String&amp; acceptedMediaType, Frame* frame, const RenderStyle* style)
</del><ins>+MediaQueryEvaluator::MediaQueryEvaluator(const String&amp; acceptedMediaType, Document&amp; document, const RenderStyle* style)
</ins><span class="cx">     : m_mediaType(acceptedMediaType)
</span><del>-    , m_frame(frame)
</del><ins>+    , m_frame(document.frame())
</ins><span class="cx">     , m_style(style)
</span><del>-    , m_expResult(false) // doesn't matter when we have m_frame and m_style
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQueryEvaluator::~MediaQueryEvaluator()
-{
-}
-
</del><span class="cx"> bool MediaQueryEvaluator::mediaTypeMatch(const String&amp; mediaTypeToMatch) const
</span><span class="cx"> {
</span><span class="cx">     return mediaTypeToMatch.isEmpty()
</span><span class="lines">@@ -118,82 +115,74 @@
</span><span class="cx">     return r == MediaQuery::Not ? !value : value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, StyleResolver* styleResolver) const
</del><ins>+bool MediaQueryEvaluator::evaluate(const MediaQuerySet&amp; querySet, StyleResolver* styleResolver) const
</ins><span class="cx"> {
</span><del>-    if (!querySet)
-        return true;
-
-    auto&amp; queries = querySet-&gt;queryVector();
</del><ins>+    auto&amp; queries = querySet.queryVector();
</ins><span class="cx">     if (!queries.size())
</span><span class="cx">         return true; // empty query list evaluates to true
</span><span class="cx"> 
</span><span class="cx">     // iterate over queries, stop if any of them eval to true (OR semantics)
</span><span class="cx">     bool result = false;
</span><span class="cx">     for (size_t i = 0; i &lt; queries.size() &amp;&amp; !result; ++i) {
</span><del>-        MediaQuery* query = queries[i].get();
</del><ins>+        auto&amp; query = queries[i];
</ins><span class="cx"> 
</span><del>-        if (query-&gt;ignored() || (!query-&gt;expressions().size() &amp;&amp; query-&gt;mediaType().isEmpty()))
</del><ins>+        if (query.ignored() || (!query.expressions().size() &amp;&amp; query.mediaType().isEmpty()))
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        if (mediaTypeMatch(query-&gt;mediaType())) {
-            auto&amp; expressions = query-&gt;expressions();
-            // iterate through expressions, stop if any of them eval to false
-            // (AND semantics)
</del><ins>+        if (mediaTypeMatch(query.mediaType())) {
+            auto&amp; expressions = query.expressions();
+            // iterate through expressions, stop if any of them eval to false (AND semantics)
</ins><span class="cx">             size_t j = 0;
</span><span class="cx">             for (; j &lt; expressions.size(); ++j) {
</span><del>-                bool exprResult = eval(expressions.at(j).get());
-                if (styleResolver &amp;&amp; expressions.at(j)-&gt;isViewportDependent())
-                    styleResolver-&gt;addViewportDependentMediaQueryResult(expressions.at(j).get(), exprResult);
-                if (!exprResult)
</del><ins>+                bool expressionResult = evaluate(expressions[j]);
+                if (styleResolver &amp;&amp; isViewportDependent(expressions[j].mediaFeature()))
+                    styleResolver-&gt;addViewportDependentMediaQueryResult(expressions[j], expressionResult);
+                if (!expressionResult)
</ins><span class="cx">                     break;
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             // assume true if we are at the end of the list,
</span><span class="cx">             // otherwise assume false
</span><del>-            result = applyRestrictor(query-&gt;restrictor(), expressions.size() == j);
</del><ins>+            result = applyRestrictor(query.restrictor(), expressions.size() == j);
</ins><span class="cx">         } else
</span><del>-            result = applyRestrictor(query-&gt;restrictor(), false);
</del><ins>+            result = applyRestrictor(query.restrictor(), false);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaQueryEvaluator::evalCheckingViewportDependentResults(const MediaQuerySet* querySet, Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt;&amp; results)
</del><ins>+bool MediaQueryEvaluator::evaluate(const MediaQuerySet&amp; querySet, Vector&lt;MediaQueryResult&gt;&amp; results) const
</ins><span class="cx"> {
</span><del>-    if (!querySet)
-        return true;
-
-    auto&amp; queries = querySet-&gt;queryVector();
</del><ins>+    auto&amp; queries = querySet.queryVector();
</ins><span class="cx">     if (!queries.size())
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     bool result = false;
</span><span class="cx">     for (size_t i = 0; i &lt; queries.size() &amp;&amp; !result; ++i) {
</span><del>-        MediaQuery* query = queries[i].get();
</del><ins>+        auto&amp; query = queries[i];
</ins><span class="cx"> 
</span><del>-        if (query-&gt;ignored())
</del><ins>+        if (query.ignored())
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        if (mediaTypeMatch(query-&gt;mediaType())) {
-            auto&amp; expressions = query-&gt;expressions();
</del><ins>+        if (mediaTypeMatch(query.mediaType())) {
+            auto&amp; expressions = query.expressions();
</ins><span class="cx">             size_t j = 0;
</span><span class="cx">             for (; j &lt; expressions.size(); ++j) {
</span><del>-                bool exprResult = eval(expressions.at(j).get());
-                if (expressions.at(j)-&gt;isViewportDependent())
-                    results.append(std::make_unique&lt;MediaQueryResult&gt;(*expressions.at(j), exprResult));
-                if (!exprResult)
</del><ins>+                bool expressionResult = evaluate(expressions[j]);
+                if (isViewportDependent(expressions[j].mediaFeature()))
+                    results.append({ expressions[j], expressionResult });
+                if (!expressionResult)
</ins><span class="cx">                     break;
</span><span class="cx">             }
</span><del>-            result = applyRestrictor(query-&gt;restrictor(), expressions.size() == j);
</del><ins>+            result = applyRestrictor(query.restrictor(), expressions.size() == j);
</ins><span class="cx">         } else
</span><del>-            result = applyRestrictor(query-&gt;restrictor(), false);
</del><ins>+            result = applyRestrictor(query.restrictor(), false);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template&lt;typename T&gt;
-bool compareValue(T a, T b, MediaFeaturePrefix op)
</del><ins>+template&lt;typename T, typename U&gt; bool compareValue(T a, U b, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><span class="cx">     switch (op) {
</span><span class="cx">     case MinPrefix:
</span><span class="lines">@@ -208,46 +197,50 @@
</span><span class="cx"> 
</span><span class="cx"> static bool compareAspectRatioValue(CSSValue* value, int width, int height, MediaFeaturePrefix op)
</span><span class="cx"> {
</span><del>-    if (is&lt;CSSAspectRatioValue&gt;(*value)) {
-        CSSAspectRatioValue&amp; aspectRatio = downcast&lt;CSSAspectRatioValue&gt;(*value);
-        return compareValue(width * static_cast&lt;int&gt;(aspectRatio.denominatorValue()), height * static_cast&lt;int&gt;(aspectRatio.numeratorValue()), op);
-    }
-
-    return false;
</del><ins>+    if (!is&lt;CSSAspectRatioValue&gt;(value))
+        return false;
+    auto&amp; aspectRatio = downcast&lt;CSSAspectRatioValue&gt;(*value);
+    return compareValue(width * aspectRatio.denominatorValue(), height * aspectRatio.numeratorValue(), op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool numberValue(CSSValue* value, float&amp; result)
</del><ins>+static Optional&lt;double&gt; doubleValue(CSSValue* value)
</ins><span class="cx"> {
</span><del>-    if (is&lt;CSSPrimitiveValue&gt;(*value) &amp;&amp; downcast&lt;CSSPrimitiveValue&gt;(*value).isNumber()) {
-        result = downcast&lt;CSSPrimitiveValue&gt;(*value).getFloatValue(CSSPrimitiveValue::CSS_NUMBER);
-        return true;
-    }
-    return false;
</del><ins>+    if (!is&lt;CSSPrimitiveValue&gt;(value) || !downcast&lt;CSSPrimitiveValue&gt;(*value).isNumber())
+        return Nullopt;
+    return downcast&lt;CSSPrimitiveValue&gt;(*value).getDoubleValue(CSSPrimitiveValue::CSS_NUMBER);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool colorMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool zeroEvaluate(CSSValue* value, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    int bitsPerComponent = screenDepthPerComponent(frame-&gt;page()-&gt;mainFrame().view());
-    float number;
-    if (value)
-        return numberValue(value, number) &amp;&amp; compareValue(bitsPerComponent, static_cast&lt;int&gt;(number), op);
-
-    return bitsPerComponent != 0;
</del><ins>+    auto numericValue = doubleValue(value);
+    return numericValue &amp;&amp; compareValue(0, numericValue.value(), op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool color_indexMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix op)
</del><ins>+static bool oneEvaluate(CSSValue* value, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    // FIXME: It's unknown how to retrieve the information if the display mode is indexed
-    // Assume we don't support indexed display.
</del><span class="cx">     if (!value)
</span><del>-        return false;
</del><ins>+        return true;
+    auto numericValue = doubleValue(value);
+    return numericValue &amp;&amp; compareValue(1, numericValue.value(), op);
+}
</ins><span class="cx"> 
</span><del>-    float number;
-    return numberValue(value, number) &amp;&amp; compareValue(0, static_cast&lt;int&gt;(number), op);
</del><ins>+static bool colorEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
+{
+    int bitsPerComponent = screenDepthPerComponent(frame.mainFrame().view());
+    auto numericValue = doubleValue(value);
+    if (!numericValue)
+        return bitsPerComponent;
+    return compareValue(bitsPerComponent, numericValue.value(), op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool color_gamutMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool colorIndexEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><ins>+    // Always return false for indexed display.
+    return zeroEvaluate(value, op);
+}
+
+static bool colorGamutEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix)
+{
</ins><span class="cx">     if (!value)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -255,12 +248,10 @@
</span><span class="cx">     case CSSValueSrgb:
</span><span class="cx">         return true;
</span><span class="cx">     case CSSValueP3:
</span><del>-        // FIXME: For the moment we'll just assume an &quot;extended
-        // color&quot; display is at least as good as P3.
-        return screenSupportsExtendedColor(frame-&gt;page()-&gt;mainFrame().view());
</del><ins>+        // FIXME: For the moment we just assume any &quot;extended color&quot; display is at least as good as P3.
+        return screenSupportsExtendedColor(frame.mainFrame().view());
</ins><span class="cx">     case CSSValueRec2020:
</span><del>-        // FIXME: At some point we should start detecting displays that
-        // support more colors.
</del><ins>+        // FIXME: At some point we should start detecting displays that support more colors.
</ins><span class="cx">         return false;
</span><span class="cx">     default:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="lines">@@ -268,90 +259,82 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool monochromeMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool monochromeEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (!screenIsMonochrome(frame-&gt;page()-&gt;mainFrame().view())) {
-        if (value) {
-            float number;
-            return numberValue(value, number) &amp;&amp; compareValue(0, static_cast&lt;int&gt;(number), op);
-        }
-        return false;
-    }
-
-    return colorMediaFeatureEval(value, conversionData, frame, op);
</del><ins>+    if (!screenIsMonochrome(frame.mainFrame().view()))
+        return zeroEvaluate(value, op);
+    return colorEvaluate(value, conversionData, frame, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool inverted_colorsMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix)
</del><ins>+static bool invertedColorsEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><span class="cx">     bool isInverted = screenHasInvertedColors();
</span><del>-
</del><span class="cx">     if (!value)
</span><span class="cx">         return isInverted;
</span><del>-
-    const CSSValueID id = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
-    return (isInverted &amp;&amp; id == CSSValueInverted) || (!isInverted &amp;&amp; id == CSSValueNone);
</del><ins>+    return downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID() == (isInverted ? CSSValueInverted : CSSValueNone);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool orientationMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool orientationEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    FrameView* view = frame-&gt;view();
</del><ins>+    FrameView* view = frame.view();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    int width = view-&gt;layoutWidth();
-    int height = view-&gt;layoutHeight();
-    if (is&lt;CSSPrimitiveValue&gt;(value)) {
-        const CSSValueID id = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
-        if (width &gt; height) // Square viewport is portrait.
-            return CSSValueLandscape == id;
-        return CSSValuePortrait == id;
</del><ins>+    auto width = view-&gt;layoutWidth();
+    auto height = view-&gt;layoutHeight();
+
+    if (!is&lt;CSSPrimitiveValue&gt;(value)) {
+        // Expression (orientation) evaluates to true if width and height &gt;= 0.
+        return height &gt;= 0 &amp;&amp; width &gt;= 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Expression (orientation) evaluates to true if width and height &gt;= 0.
-    return height &gt;= 0 &amp;&amp; width &gt;= 0;
</del><ins>+    auto keyword = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
+    if (width &gt; height) // Square viewport is portrait.
+        return keyword == CSSValueLandscape;
+    return keyword == CSSValuePortrait;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool aspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    FrameView* view = frame-&gt;view();
</del><ins>+    // ({,min-,max-}aspect-ratio)
+    // assume if we have a device, its aspect ratio is non-zero
+    if (!value)
+        return true;
+
+    FrameView* view = frame.view();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    if (value)
-        return compareAspectRatioValue(value, view-&gt;layoutWidth(), view-&gt;layoutHeight(), op);
-
-    // ({,min-,max-}aspect-ratio)
-    // assume if we have a device, its aspect ratio is non-zero
-    return true;
</del><ins>+    return compareAspectRatioValue(value, view-&gt;layoutWidth(), view-&gt;layoutHeight(), op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool device_aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool deviceAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        FloatRect sg = screenRect(frame-&gt;page()-&gt;mainFrame().view());
-        return compareAspectRatioValue(value, static_cast&lt;int&gt;(sg.width()), static_cast&lt;int&gt;(sg.height()), op);
-    }
-
</del><span class="cx">     // ({,min-,max-}device-aspect-ratio)
</span><span class="cx">     // assume if we have a device, its aspect ratio is non-zero
</span><del>-    return true;
</del><ins>+    if (!value)
+        return true;
+
+    auto size = screenRect(frame.mainFrame().view()).size();
+    return compareAspectRatioValue(value, size.width(), size.height(), op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool evalResolution(CSSValue* value, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool evaluateResolution(CSSValue* value, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: Possible handle other media types than 'screen' and 'print'.
</span><del>-    FrameView* view = frame-&gt;view();
</del><ins>+    FrameView* view = frame.view();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     float deviceScaleFactor = 0;
</span><ins>+
</ins><span class="cx">     // This checks the actual media type applied to the document, and we know
</span><span class="cx">     // this method only got called if this media type matches the one defined
</span><span class="cx">     // in the query. Thus, if if the document's media type is &quot;print&quot;, the
</span><span class="cx">     // media type of the query will either be &quot;print&quot; or &quot;all&quot;.
</span><span class="cx">     String mediaType = view-&gt;mediaType();
</span><span class="cx">     if (equalLettersIgnoringASCIICase(mediaType, &quot;screen&quot;))
</span><del>-        deviceScaleFactor = frame-&gt;page()-&gt;deviceScaleFactor();
</del><ins>+        deviceScaleFactor = frame.page() ? frame.page()-&gt;deviceScaleFactor() : 1;
</ins><span class="cx">     else if (equalLettersIgnoringASCIICase(mediaType, &quot;print&quot;)) {
</span><span class="cx">         // The resolution of images while printing should not depend on the dpi
</span><span class="cx">         // of the screen. Until we support proper ways of querying this info
</span><span class="lines">@@ -362,22 +345,22 @@
</span><span class="cx">     if (!value)
</span><span class="cx">         return !!deviceScaleFactor;
</span><span class="cx"> 
</span><del>-    if (!is&lt;CSSPrimitiveValue&gt;(*value))
</del><ins>+    if (!is&lt;CSSPrimitiveValue&gt;(value))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    CSSPrimitiveValue&amp; resolution = downcast&lt;CSSPrimitiveValue&gt;(*value);
</del><ins>+    auto&amp; resolution = downcast&lt;CSSPrimitiveValue&gt;(*value);
</ins><span class="cx">     return compareValue(deviceScaleFactor, resolution.isNumber() ? resolution.getFloatValue() : resolution.getFloatValue(CSSPrimitiveValue::CSS_DPPX), op);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool device_pixel_ratioMediaFeatureEval(CSSValue *value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool devicePixelRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    return (!value || downcast&lt;CSSPrimitiveValue&gt;(*value).isNumber()) &amp;&amp; evalResolution(value, frame, op);
</del><ins>+    return (!value || (is&lt;CSSPrimitiveValue&gt;(*value) &amp;&amp; downcast&lt;CSSPrimitiveValue&gt;(*value).isNumber())) &amp;&amp; evaluateResolution(value, frame, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool resolutionMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool resolutionEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(RESOLUTION_MEDIA_QUERY)
</span><del>-    return (!value || downcast&lt;CSSPrimitiveValue&gt;(*value).isResolution()) &amp;&amp; evalResolution(value, frame, op);
</del><ins>+    return (!value || (is&lt;CSSPrimitiveValue&gt;(*value) &amp;&amp; downcast&lt;CSSPrimitiveValue&gt;(*value).isResolution())) &amp;&amp; evaluateResolution(value, frame, op);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(value);
</span><span class="cx">     UNUSED_PARAM(frame);
</span><span class="lines">@@ -386,22 +369,17 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool gridMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix op)
</del><ins>+static bool gridEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    // if output device is bitmap, grid: 0 == true
-    // assume we have bitmap device
-    float number;
-    if (value &amp;&amp; numberValue(value, number))
-        return compareValue(static_cast&lt;int&gt;(number), 0, op);
-    return false;
</del><ins>+    return zeroEvaluate(value, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool computeLength(CSSValue* value, bool strict, const CSSToLengthConversionData&amp; conversionData, int&amp; result)
</span><span class="cx"> {
</span><del>-    if (!is&lt;CSSPrimitiveValue&gt;(*value))
</del><ins>+    if (!is&lt;CSSPrimitiveValue&gt;(value))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
</del><ins>+    auto&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
</ins><span class="cx"> 
</span><span class="cx">     if (primitiveValue.isNumber()) {
</span><span class="cx">         result = primitiveValue.getIntValue();
</span><span class="lines">@@ -416,271 +394,227 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool device_heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool deviceHeightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        FloatRect sg = screenRect(frame-&gt;page()-&gt;mainFrame().view());
-        int length;
-        long height = sg.height();
-        return computeLength(value, !frame-&gt;document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(static_cast&lt;int&gt;(height), length, op);
-    }
</del><span class="cx">     // ({,min-,max-}device-height)
</span><span class="cx">     // assume if we have a device, assume non-zero
</span><del>-    return true;
</del><ins>+    if (!value)
+        return true;
+    int length;
+    auto height = screenRect(frame.mainFrame().view()).height();
+    return computeLength(value, !frame.document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(height, length, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool device_widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool deviceWidthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        FloatRect sg = screenRect(frame-&gt;page()-&gt;mainFrame().view());
-        int length;
-        long width = sg.width();
-        return computeLength(value, !frame-&gt;document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(static_cast&lt;int&gt;(width), length, op);
-    }
</del><span class="cx">     // ({,min-,max-}device-width)
</span><span class="cx">     // assume if we have a device, assume non-zero
</span><del>-    return true;
</del><ins>+    if (!value)
+        return true;
+    int length;
+    auto width = screenRect(frame.mainFrame().view()).width();
+    return computeLength(value, !frame.document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(width, length, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool heightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    FrameView* view = frame-&gt;view();
</del><ins>+    FrameView* view = frame.view();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return false;
</span><del>-
-    if (value) {
-        int height = view-&gt;layoutHeight();
-        if (RenderView* renderView = frame-&gt;document()-&gt;renderView())
-            height = adjustForAbsoluteZoom(height, *renderView);
-        int length;
-        return computeLength(value, !frame-&gt;document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(height, length, op);
-    }
-
-    return view-&gt;layoutHeight() != 0;
</del><ins>+    int height = view-&gt;layoutHeight();
+    if (!value)
+        return height;
+    if (auto* renderView = frame.document()-&gt;renderView())
+        height = adjustForAbsoluteZoom(height, *renderView);
+    int length;
+    return computeLength(value, !frame.document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(height, length, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool widthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    FrameView* view = frame-&gt;view();
</del><ins>+    FrameView* view = frame.view();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return false;
</span><del>-
-    if (value) {
-        int width = view-&gt;layoutWidth();
-        if (RenderView* renderView = frame-&gt;document()-&gt;renderView())
-            width = adjustForAbsoluteZoom(width, *renderView);
-        int length;
-        return computeLength(value, !frame-&gt;document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(width, length, op);
-    }
-
-    return view-&gt;layoutWidth() != 0;
</del><ins>+    int width = view-&gt;layoutWidth();
+    if (!value)
+        return width;
+    if (auto* renderView = frame.document()-&gt;renderView())
+        width = adjustForAbsoluteZoom(width, *renderView);
+    int length;
+    return computeLength(value, !frame.document()-&gt;inQuirksMode(), conversionData, length) &amp;&amp; compareValue(width, length, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// rest of the functions are trampolines which set the prefix according to the media feature expression used
-
-static bool min_colorMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minColorEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return colorMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return colorEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_colorMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxColorEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return colorMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return colorEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_color_indexMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minColorIndexEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return color_indexMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return colorIndexEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_color_indexMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxColorIndexEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return color_indexMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return colorIndexEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_monochromeMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minMonochromeEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return monochromeMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return monochromeEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_monochromeMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxMonochromeEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return monochromeMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return monochromeEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return aspect_ratioMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return aspectRatioEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return aspect_ratioMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return aspectRatioEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_device_aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minDeviceAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_aspect_ratioMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return deviceAspectRatioEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_device_aspect_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxDeviceAspectRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_aspect_ratioMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return deviceAspectRatioEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_device_pixel_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minDevicePixelRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_pixel_ratioMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return devicePixelRatioEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_device_pixel_ratioMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxDevicePixelRatioEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_pixel_ratioMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return devicePixelRatioEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minHeightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return heightMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return heightEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxHeightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return heightMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return heightEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minWidthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return widthMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return widthEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxWidthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return widthMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return widthEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_device_heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minDeviceHeightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_heightMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return deviceHeightEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_device_heightMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxDeviceHeightEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_heightMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return deviceHeightEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_device_widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minDeviceWidthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_widthMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return deviceWidthEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_device_widthMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxDeviceWidthEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return device_widthMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return deviceWidthEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool min_resolutionMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool minResolutionEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return resolutionMediaFeatureEval(value, conversionData, frame, MinPrefix);
</del><ins>+    return resolutionEvaluate(value, conversionData, frame, MinPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool max_resolutionMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool maxResolutionEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; conversionData, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return resolutionMediaFeatureEval(value, conversionData, frame, MaxPrefix);
</del><ins>+    return resolutionEvaluate(value, conversionData, frame, MaxPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool animationMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix op)
</del><ins>+static bool animationEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        float number;
-        return numberValue(value, number) &amp;&amp; compareValue(1, static_cast&lt;int&gt;(number), op);
-    }
-    return true;
</del><ins>+    return oneEvaluate(value, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool transitionMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix op)
</del><ins>+static bool transitionEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        float number;
-        return numberValue(value, number) &amp;&amp; compareValue(1, static_cast&lt;int&gt;(number), op);
-    }
-    return true;
</del><ins>+    return oneEvaluate(value, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool transform_2dMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix op)
</del><ins>+static bool transform2dEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    if (value) {
-        float number;
-        return numberValue(value, number) &amp;&amp; compareValue(1, static_cast&lt;int&gt;(number), op);
-    }
-    return true;
</del><ins>+    return oneEvaluate(value, op);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool transform_3dMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+static bool transform3dEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix op)
</ins><span class="cx"> {
</span><del>-    bool returnValueIfNoParameter;
-    int have3dRendering;
-
</del><span class="cx"> #if ENABLE(3D_TRANSFORMS)
</span><del>-    bool threeDEnabled = false;
-    if (RenderView* view = frame-&gt;contentRenderer())
-        threeDEnabled = view-&gt;compositor().canRender3DTransforms();
-
-    returnValueIfNoParameter = threeDEnabled;
-    have3dRendering = threeDEnabled ? 1 : 0;
</del><ins>+    auto* view = frame.contentRenderer();
+    return view &amp;&amp; view-&gt;compositor().canRender3DTransforms() ? oneEvaluate(value, op) : zeroEvaluate(value, op);
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(frame);
</span><del>-    returnValueIfNoParameter = false;
-    have3dRendering = 0;
</del><ins>+    return zeroEvaluate(value, op);
</ins><span class="cx"> #endif
</span><del>-
-    if (value) {
-        float number;
-        return numberValue(value, number) &amp;&amp; compareValue(have3dRendering, static_cast&lt;int&gt;(number), op);
-    }
-    return returnValueIfNoParameter;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><del>-static bool view_modeMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix op)
</del><ins>+
+static bool viewModeEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    UNUSED_PARAM(op);
</del><span class="cx">     if (!value)
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    const int viewModeCSSKeywordID = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
-    const Page::ViewMode viewMode = frame-&gt;page()-&gt;viewMode();
-    bool result = false;
-    switch (viewMode) {
</del><ins>+    auto keyword = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
+
+    switch (frame.page()-&gt;viewMode()) {
</ins><span class="cx">     case Page::ViewModeWindowed:
</span><del>-        result = viewModeCSSKeywordID == CSSValueWindowed;
-        break;
</del><ins>+        return keyword == CSSValueWindowed;
</ins><span class="cx">     case Page::ViewModeFloating:
</span><del>-        result = viewModeCSSKeywordID == CSSValueFloating;
-        break;
</del><ins>+        return keyword == CSSValueFloating;
</ins><span class="cx">     case Page::ViewModeFullscreen:
</span><del>-        result = viewModeCSSKeywordID == CSSValueFullscreen;
-        break;
</del><ins>+        return keyword == CSSValueFullscreen;
</ins><span class="cx">     case Page::ViewModeMaximized:
</span><del>-        result = viewModeCSSKeywordID == CSSValueMaximized;
-        break;
</del><ins>+        return keyword == CSSValueMaximized;
</ins><span class="cx">     case Page::ViewModeMinimized:
</span><del>-        result = viewModeCSSKeywordID == CSSValueMinimized;
-        break;
</del><ins>+        return keyword == CSSValueMinimized;
</ins><span class="cx">     default:
</span><del>-        result = false;
</del><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return result;
</del><ins>+    return false;
</ins><span class="cx"> }
</span><ins>+
</ins><span class="cx"> #endif // ENABLE(VIEW_MODE_CSS_MEDIA)
</span><span class="cx"> 
</span><del>-static bool video_playable_inlineMediaFeatureEval(CSSValue*, const CSSToLengthConversionData&amp;, Frame* frame, MediaFeaturePrefix)
</del><ins>+static bool videoPlayableInlineEvaluate(CSSValue*, const CSSToLengthConversionData&amp;, Frame&amp; frame, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><del>-    return frame-&gt;settings().allowsInlineMediaPlayback();
</del><ins>+    return frame.settings().allowsInlineMediaPlayback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool hoverMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix)
</del><ins>+static bool hoverEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><span class="cx">     if (!is&lt;CSSPrimitiveValue&gt;(value)) {
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><span class="lines">@@ -690,70 +624,65 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    int hoverCSSKeywordID = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
</del><ins>+    auto keyword = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
</ins><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><del>-    return hoverCSSKeywordID == CSSValueNone;
</del><ins>+    return keyword == CSSValueNone;
</ins><span class="cx"> #else
</span><del>-    return hoverCSSKeywordID == CSSValueHover;
</del><ins>+    return keyword == CSSValueHover;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool any_hoverMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; cssToLengthConversionData, Frame* frame, MediaFeaturePrefix prefix)
</del><ins>+static bool anyHoverEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; cssToLengthConversionData, Frame&amp; frame, MediaFeaturePrefix prefix)
</ins><span class="cx"> {
</span><del>-    return hoverMediaFeatureEval(value, cssToLengthConversionData, frame, prefix);
</del><ins>+    return hoverEvaluate(value, cssToLengthConversionData, frame, prefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool pointerMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp;, Frame*, MediaFeaturePrefix)
</del><ins>+static bool pointerEvaluate(CSSValue* value, const CSSToLengthConversionData&amp;, Frame&amp;, MediaFeaturePrefix)
</ins><span class="cx"> {
</span><span class="cx">     if (!is&lt;CSSPrimitiveValue&gt;(value))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><del>-    int pointerCSSKeywordID = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
</del><ins>+    auto keyword = downcast&lt;CSSPrimitiveValue&gt;(*value).getValueID();
</ins><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><del>-    return pointerCSSKeywordID == CSSValueCoarse;
</del><ins>+    return keyword == CSSValueCoarse;
</ins><span class="cx"> #else
</span><del>-    return pointerCSSKeywordID == CSSValueFine;
</del><ins>+    return keyword == CSSValueFine;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool any_pointerMediaFeatureEval(CSSValue* value, const CSSToLengthConversionData&amp; cssToLengthConversionData, Frame* frame, MediaFeaturePrefix prefix)
</del><ins>+static bool anyPointerEvaluate(CSSValue* value, const CSSToLengthConversionData&amp; cssToLengthConversionData, Frame&amp; frame, MediaFeaturePrefix prefix)
</ins><span class="cx"> {
</span><del>-    return pointerMediaFeatureEval(value, cssToLengthConversionData, frame, prefix);
</del><ins>+    return pointerEvaluate(value, cssToLengthConversionData, frame, prefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void createFunctionMap()
</del><ins>+// Use this function instead of calling add directly to avoid inlining.
+static void add(MediaQueryFunctionMap&amp; map, AtomicStringImpl* key, MediaQueryFunction value)
</ins><span class="cx"> {
</span><del>-    // Create the table.
-    gFunctionMap = new FunctionMap;
-#define ADD_TO_FUNCTIONMAP(name, str)  \
-    gFunctionMap-&gt;set(name##MediaFeature.impl(), name##MediaFeatureEval);
-    CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP);
-#undef ADD_TO_FUNCTIONMAP
</del><ins>+    map.add(key, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaQueryEvaluator::eval(const MediaQueryExp* expr) const
</del><ins>+bool MediaQueryEvaluator::evaluate(const MediaQueryExpression&amp; expression) const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_frame || !m_frame-&gt;view() || !m_style)
</span><del>-        return m_expResult;
</del><ins>+        return m_fallbackResult;
</ins><span class="cx"> 
</span><del>-    if (!expr-&gt;isValid())
</del><ins>+    if (!expression.isValid())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    if (!gFunctionMap)
-        createFunctionMap();
</del><ins>+    static NeverDestroyed&lt;MediaQueryFunctionMap&gt; map = [] {
+        MediaQueryFunctionMap map;
+#define ADD_TO_FUNCTIONMAP(name, str) add(map, MediaFeatureNames::name.impl(), name##Evaluate);
+        CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(ADD_TO_FUNCTIONMAP);
+#undef ADD_TO_FUNCTIONMAP
+        return map;
+    }();
</ins><span class="cx"> 
</span><del>-    // call the media feature evaluation function. Assume no prefix
-    // and let trampoline functions override the prefix if prefix is
-    // used
-    EvalFunc func = gFunctionMap-&gt;get(expr-&gt;mediaFeature().impl());
-    if (func) {
-        CSSToLengthConversionData conversionData(m_style,
-            m_frame-&gt;document()-&gt;documentElement()-&gt;renderStyle(),
-            m_frame-&gt;document()-&gt;renderView(), 1, false);
-        return func(expr-&gt;value(), conversionData, m_frame, NoPrefix);
-    }
</del><ins>+    auto function = map.get().get(expression.mediaFeature().impl());
+    if (!function)
+        return false;
</ins><span class="cx"> 
</span><del>-    return false;
</del><ins>+    Document&amp; document = *m_frame-&gt;document();
+    return function(expression.value(), { m_style, document.documentElement()-&gt;renderStyle(), document.renderView(), 1, false }, *m_frame, NoPrefix);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryEvaluatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryEvaluator.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryEvaluator.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryEvaluator.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -25,83 +25,56 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaQueryEvaluator_h
-#define MediaQueryEvaluator_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;MediaQueryExp.h&quot;
</span><del>-#include &lt;wtf/text/WTFString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><ins>+
+class Document;
</ins><span class="cx"> class Frame;
</span><del>-class MediaQueryExp;
</del><span class="cx"> class MediaQuerySet;
</span><span class="cx"> class RenderStyle;
</span><span class="cx"> class StyleResolver;
</span><span class="cx"> 
</span><del>-class MediaQueryResult {
-    WTF_MAKE_NONCOPYABLE(MediaQueryResult); WTF_MAKE_FAST_ALLOCATED;
-public:
-    MediaQueryResult(const MediaQueryExp&amp; expr, bool result)
-        : m_expression(expr)
-        , m_result(result)
-    {
-    }
-
-    MediaQueryExp m_expression;
-    bool m_result;
</del><ins>+struct MediaQueryResult {
+    MediaQueryExpression expression;
+    bool result;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><del>-/**
- * Class that evaluates css media queries as defined in
- * CSS3 Module &quot;Media Queries&quot; (http://www.w3.org/TR/css3-mediaqueries/)
- * Special constructors are needed, if simple media queries are to be
- * evaluated without knowledge of the medium features. This can happen
- * for example when parsing UA stylesheets, if evaluation is done
- * right after parsing.
- *
- * the boolean parameter is used to approximate results of evaluation, if
- * the device characteristics are not known. This can be used to prune the loading
- * of stylesheets to only those which are probable to match.
- */
</del><ins>+// Some of the constructors are used for cases where the device characteristics are not known.
+// These  can be used to prune the loading of stylesheets to only those which are not already known to not match.
+
</ins><span class="cx"> class MediaQueryEvaluator {
</span><del>-     WTF_MAKE_NONCOPYABLE(MediaQueryEvaluator); WTF_MAKE_FAST_ALLOCATED;
</del><span class="cx"> public:
</span><del>-    /** Creates evaluator which evaluates only simple media queries
-     *  Evaluator returns true for &quot;all&quot;, and returns value of \mediaFeatureResult
-     *  for any media features
-     */
</del><ins>+    // Creates evaluator which evaluates only simple media queries.
+    // Evaluator returns true for &quot;all&quot;, and returns value of \mediaFeatureResult for any media features.
</ins><span class="cx">     explicit MediaQueryEvaluator(bool mediaFeatureResult = false);
</span><span class="cx"> 
</span><del>-    /** Creates evaluator which evaluates only simple media queries
-     *  Evaluator  returns true for acceptedMediaType and returns value of \mediafeatureResult
-     *  for any media features
-     */
</del><ins>+    // Creates evaluator which evaluates only simple media queries.
+    // Evaluator returns true for acceptedMediaType and returns value of \mediaFeatureResult for any media features.
</ins><span class="cx">     MediaQueryEvaluator(const String&amp; acceptedMediaType, bool mediaFeatureResult = false);
</span><span class="cx"> 
</span><del>-    /** Creates evaluator which evaluates full media queries
-     */
-    MediaQueryEvaluator(const String&amp; acceptedMediaType, Frame*, const RenderStyle*);
</del><ins>+    // Creates evaluator which evaluates full media queries.
+    MediaQueryEvaluator(const String&amp; acceptedMediaType, Document&amp;, const RenderStyle*);
</ins><span class="cx"> 
</span><del>-    ~MediaQueryEvaluator();
-
</del><span class="cx">     bool mediaTypeMatch(const String&amp; mediaTypeToMatch) const;
</span><span class="cx">     bool mediaTypeMatchSpecific(const char* mediaTypeToMatch) const;
</span><span class="cx"> 
</span><del>-    /** Evaluates a list of media queries */
-    bool eval(const MediaQuerySet*, StyleResolver* = 0) const;
</del><ins>+    // Evaluates a list of media queries.
+    bool evaluate(const MediaQuerySet&amp;, StyleResolver* = nullptr) const;
</ins><span class="cx"> 
</span><del>-    /** Evaluates media query subexpression, ie &quot;and (media-feature: value)&quot; part */
-    bool eval(const MediaQueryExp*) const;
-    
-    /* Evaluates a list of media queries and fills in a vector with any viewport-dependent results found. */
-    bool evalCheckingViewportDependentResults(const MediaQuerySet*, Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt;&amp;);
</del><ins>+    // Evaluates media query subexpression, ie &quot;and (media-feature: value)&quot; part.
+    bool evaluate(const MediaQueryExpression&amp;) const;
</ins><span class="cx"> 
</span><ins>+    // Evaluates a list of media queries and fills in a vector with any viewport-dependent results found.
+    bool evaluate(const MediaQuerySet&amp;, Vector&lt;MediaQueryResult&gt;&amp;) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     String m_mediaType;
</span><span class="cx">     Frame* m_frame { nullptr }; // not owned
</span><span class="cx">     const RenderStyle* m_style { nullptr };
</span><del>-    bool m_expResult;
</del><ins>+    bool m_fallbackResult { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span><del>-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryExpcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryExp.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryExp.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryExp.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -32,201 +32,186 @@
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><span class="cx"> #include &quot;CSSPrimitiveValue.h&quot;
</span><span class="cx"> #include &quot;CSSValueList.h&quot;
</span><ins>+#include &quot;MediaFeatureNames.h&quot;
</ins><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static inline bool featureWithCSSValueID(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithIdentifier(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (!value-&gt;id)
</del><ins>+    if (!value.id)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::orientationMediaFeature
</del><ins>+    return mediaFeature == MediaFeatureNames::orientation
</ins><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><del>-        || mediaFeature == MediaFeatureNames::view_modeMediaFeature
-#endif // ENABLE(VIEW_MODE_CSS_MEDIA)
-        || mediaFeature == MediaFeatureNames::color_gamutMediaFeature
-        || mediaFeature == MediaFeatureNames::any_hoverMediaFeature
-        || mediaFeature == MediaFeatureNames::any_pointerMediaFeature
-        || mediaFeature == MediaFeatureNames::hoverMediaFeature
-        || mediaFeature == MediaFeatureNames::inverted_colorsMediaFeature
-        || mediaFeature == MediaFeatureNames::pointerMediaFeature;
</del><ins>+        || mediaFeature == MediaFeatureNames::viewMode
+#endif
+        || mediaFeature == MediaFeatureNames::colorGamut
+        || mediaFeature == MediaFeatureNames::anyHover
+        || mediaFeature == MediaFeatureNames::anyPointer
+        || mediaFeature == MediaFeatureNames::hover
+        || mediaFeature == MediaFeatureNames::invertedColors
+        || mediaFeature == MediaFeatureNames::pointer;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithValidPositiveLenghtOrNumber(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithNonNegativeLengthOrNumber(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (!(CSSPrimitiveValue::isLength(value-&gt;unit) || value-&gt;unit == CSSPrimitiveValue::CSS_NUMBER) || value-&gt;fValue &lt; 0)
</del><ins>+    if (!(CSSPrimitiveValue::isLength(value.unit) || value.unit == CSSPrimitiveValue::CSS_NUMBER) || value.fValue &lt; 0)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::heightMediaFeature
-        || mediaFeature == MediaFeatureNames::max_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::min_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::widthMediaFeature
-        || mediaFeature == MediaFeatureNames::max_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::min_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::device_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_widthMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::height
+        || mediaFeature == MediaFeatureNames::maxHeight
+        || mediaFeature == MediaFeatureNames::minHeight
+        || mediaFeature == MediaFeatureNames::width
+        || mediaFeature == MediaFeatureNames::maxWidth
+        || mediaFeature == MediaFeatureNames::minWidth
+        || mediaFeature == MediaFeatureNames::deviceHeight
+        || mediaFeature == MediaFeatureNames::maxDeviceHeight
+        || mediaFeature == MediaFeatureNames::minDeviceHeight
+        || mediaFeature == MediaFeatureNames::deviceWidth
+        || mediaFeature == MediaFeatureNames::maxDeviceWidth
+        || mediaFeature == MediaFeatureNames::minDeviceWidth;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithValidDensity(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithDensity(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (!CSSPrimitiveValue::isResolution(value-&gt;unit) || value-&gt;fValue &lt;= 0)
</del><ins>+    if (!CSSPrimitiveValue::isResolution(value.unit) || value.fValue &lt;= 0)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::resolutionMediaFeature
-        || mediaFeature == MediaFeatureNames::max_resolutionMediaFeature
-        || mediaFeature == MediaFeatureNames::min_resolutionMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::resolution
+        || mediaFeature == MediaFeatureNames::maxResolution
+        || mediaFeature == MediaFeatureNames::minResolution;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithPositiveInteger(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithNonNegativeInteger(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (!value-&gt;isInt || value-&gt;fValue &lt; 0)
</del><ins>+    if (!value.isInt || value.fValue &lt; 0)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::colorMediaFeature
-        || mediaFeature == MediaFeatureNames::max_colorMediaFeature
-        || mediaFeature == MediaFeatureNames::min_colorMediaFeature
-        || mediaFeature == MediaFeatureNames::color_indexMediaFeature
-        || mediaFeature == MediaFeatureNames::max_color_indexMediaFeature
-        || mediaFeature == MediaFeatureNames::min_color_indexMediaFeature
-        || mediaFeature == MediaFeatureNames::min_monochromeMediaFeature
-        || mediaFeature == MediaFeatureNames::max_monochromeMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::color
+        || mediaFeature == MediaFeatureNames::maxColor
+        || mediaFeature == MediaFeatureNames::minColor
+        || mediaFeature == MediaFeatureNames::colorIndex
+        || mediaFeature == MediaFeatureNames::maxColorIndex
+        || mediaFeature == MediaFeatureNames::minColorIndex
+        || mediaFeature == MediaFeatureNames::minMonochrome
+        || mediaFeature == MediaFeatureNames::maxMonochrome;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithPositiveNumber(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithNonNegativeNumber(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (value-&gt;unit != CSSPrimitiveValue::CSS_NUMBER || value-&gt;fValue &lt; 0)
</del><ins>+    if (value.unit != CSSPrimitiveValue::CSS_NUMBER || value.fValue &lt; 0)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::transform_2dMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_3dMediaFeature
-        || mediaFeature == MediaFeatureNames::transitionMediaFeature
-        || mediaFeature == MediaFeatureNames::animationMediaFeature
-        || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_pixel_ratioMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::transform2d
+        || mediaFeature == MediaFeatureNames::transform3d
+        || mediaFeature == MediaFeatureNames::transition
+        || mediaFeature == MediaFeatureNames::animation
+        || mediaFeature == MediaFeatureNames::devicePixelRatio
+        || mediaFeature == MediaFeatureNames::maxDevicePixelRatio
+        || mediaFeature == MediaFeatureNames::minDevicePixelRatio;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithZeroOrOne(const AtomicString&amp; mediaFeature, const CSSParserValue* value)
</del><ins>+static inline bool isFeatureValidWithZeroOrOne(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    if (!value-&gt;isInt || !(value-&gt;fValue == 1 || !value-&gt;fValue))
</del><ins>+    if (!value.isInt || !(value.fValue == 1 || !value.fValue))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return mediaFeature == MediaFeatureNames::gridMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::grid;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithAspectRatio(const AtomicString&amp; mediaFeature)
</del><ins>+static inline bool isAspectRatioFeature(const AtomicString&amp; mediaFeature)
</ins><span class="cx"> {
</span><del>-    return mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::min_device_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::max_device_aspect_ratioMediaFeature;
</del><ins>+    return mediaFeature == MediaFeatureNames::aspectRatio
+        || mediaFeature == MediaFeatureNames::deviceAspectRatio
+        || mediaFeature == MediaFeatureNames::minAspectRatio
+        || mediaFeature == MediaFeatureNames::maxAspectRatio
+        || mediaFeature == MediaFeatureNames::minDeviceAspectRatio
+        || mediaFeature == MediaFeatureNames::maxDeviceAspectRatio;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static inline bool featureWithoutValue(const AtomicString&amp; mediaFeature)
</del><ins>+static inline bool isFeatureValidWithoutValue(const AtomicString&amp; mediaFeature)
</ins><span class="cx"> {
</span><span class="cx">     // Media features that are prefixed by min/max cannot be used without a value.
</span><del>-    return mediaFeature == MediaFeatureNames::any_hoverMediaFeature
-        || mediaFeature == MediaFeatureNames::any_pointerMediaFeature
-        || mediaFeature == MediaFeatureNames::monochromeMediaFeature
-        || mediaFeature == MediaFeatureNames::colorMediaFeature
-        || mediaFeature == MediaFeatureNames::color_indexMediaFeature
-        || mediaFeature == MediaFeatureNames::gridMediaFeature
-        || mediaFeature == MediaFeatureNames::heightMediaFeature
-        || mediaFeature == MediaFeatureNames::widthMediaFeature
-        || mediaFeature == MediaFeatureNames::device_heightMediaFeature
-        || mediaFeature == MediaFeatureNames::device_widthMediaFeature
-        || mediaFeature == MediaFeatureNames::orientationMediaFeature
-        || mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::device_aspect_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::hoverMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_2dMediaFeature
-        || mediaFeature == MediaFeatureNames::transform_3dMediaFeature
-        || mediaFeature == MediaFeatureNames::transitionMediaFeature
-        || mediaFeature == MediaFeatureNames::animationMediaFeature
-        || mediaFeature == MediaFeatureNames::inverted_colorsMediaFeature
</del><ins>+    return mediaFeature == MediaFeatureNames::anyHover
+        || mediaFeature == MediaFeatureNames::anyPointer
+        || mediaFeature == MediaFeatureNames::monochrome
+        || mediaFeature == MediaFeatureNames::color
+        || mediaFeature == MediaFeatureNames::colorIndex
+        || mediaFeature == MediaFeatureNames::grid
+        || mediaFeature == MediaFeatureNames::height
+        || mediaFeature == MediaFeatureNames::width
+        || mediaFeature == MediaFeatureNames::deviceHeight
+        || mediaFeature == MediaFeatureNames::deviceWidth
+        || mediaFeature == MediaFeatureNames::orientation
+        || mediaFeature == MediaFeatureNames::aspectRatio
+        || mediaFeature == MediaFeatureNames::deviceAspectRatio
+        || mediaFeature == MediaFeatureNames::hover
+        || mediaFeature == MediaFeatureNames::transform2d
+        || mediaFeature == MediaFeatureNames::transform3d
+        || mediaFeature == MediaFeatureNames::transition
+        || mediaFeature == MediaFeatureNames::animation
+        || mediaFeature == MediaFeatureNames::invertedColors
</ins><span class="cx"> #if ENABLE(VIEW_MODE_CSS_MEDIA)
</span><del>-        || mediaFeature == MediaFeatureNames::view_modeMediaFeature
-#endif // ENABLE(VIEW_MODE_CSS_MEDIA)
-        || mediaFeature == MediaFeatureNames::pointerMediaFeature
-        || mediaFeature == MediaFeatureNames::device_pixel_ratioMediaFeature
-        || mediaFeature == MediaFeatureNames::resolutionMediaFeature
-        || mediaFeature == MediaFeatureNames::video_playable_inlineMediaFeature;
</del><ins>+        || mediaFeature == MediaFeatureNames::viewMode
+#endif
+        || mediaFeature == MediaFeatureNames::pointer
+        || mediaFeature == MediaFeatureNames::devicePixelRatio
+        || mediaFeature == MediaFeatureNames::resolution
+        || mediaFeature == MediaFeatureNames::videoPlayableInline;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQueryExp::MediaQueryExp(const AtomicString&amp; mediaFeature, CSSParserValueList* valueList)
-    : m_mediaFeature(mediaFeature)
</del><ins>+static inline bool isFeatureValidWithNumberWithUnit(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><del>-    // Initialize media query expression that must have 1 or more values.
-    if (valueList) {
-        if (valueList-&gt;size() == 1) {
-            CSSParserValue* value = valueList-&gt;current();
</del><ins>+    return isFeatureValidWithDensity(mediaFeature, value) || isFeatureValidWithNonNegativeLengthOrNumber(mediaFeature, value);
+}
</ins><span class="cx"> 
</span><del>-            // Media features that use CSSValueIDs.
-            if (featureWithCSSValueID(mediaFeature, value))
-                m_value = CSSPrimitiveValue::createIdentifier(value-&gt;id);
</del><ins>+static inline bool isFeatureValidWithNumber(const AtomicString&amp; mediaFeature, const CSSParserValue&amp; value)
+{
+    return isFeatureValidWithNonNegativeInteger(mediaFeature, value) || isFeatureValidWithNonNegativeNumber(mediaFeature, value) || isFeatureValidWithZeroOrOne(mediaFeature, value);
+}
</ins><span class="cx"> 
</span><del>-            // Media features that must have non-negative &lt;density&gt;, ie. dppx, dpi or dpcm.
-            else if (featureWithValidDensity(mediaFeature, value))
-                m_value = CSSPrimitiveValue::create(value-&gt;fValue, (CSSPrimitiveValue::UnitTypes) value-&gt;unit);
</del><ins>+static inline bool isSlash(CSSParserValue&amp; value)
+{
+    return value.unit == CSSParserValue::Operator &amp;&amp; value.iValue == '/';
+}
</ins><span class="cx"> 
</span><del>-            // Media features that must have non-negative &lt;lenght&gt; or number value.
-            else if (featureWithValidPositiveLenghtOrNumber(mediaFeature, value))
-                m_value = CSSPrimitiveValue::create(value-&gt;fValue, (CSSPrimitiveValue::UnitTypes) value-&gt;unit);
</del><ins>+static inline bool isPositiveIntegerValue(CSSParserValue&amp; value)
+{
+    return value.unit == CSSPrimitiveValue::CSS_NUMBER &amp;&amp; value.fValue &gt; 0 &amp;&amp; value.isInt;
+}
</ins><span class="cx"> 
</span><del>-            // Media features that must have non-negative integer value.
-            else if (featureWithPositiveInteger(mediaFeature, value))
-                m_value = CSSPrimitiveValue::create(value-&gt;fValue, CSSPrimitiveValue::CSS_NUMBER);
-
-            // Media features that must have non-negative number value.
-            else if (featureWithPositiveNumber(mediaFeature, value))
-                m_value = CSSPrimitiveValue::create(value-&gt;fValue, CSSPrimitiveValue::CSS_NUMBER);
-
-            // Media features that must have (0|1) value.
-            else if (featureWithZeroOrOne(mediaFeature, value))
-                m_value = CSSPrimitiveValue::create(value-&gt;fValue, CSSPrimitiveValue::CSS_NUMBER);
-
-            m_isValid = m_value;
-        } else if (valueList-&gt;size() == 3 &amp;&amp; featureWithAspectRatio(mediaFeature)) {
-            // Create list of values.
-            // Currently accepts only &lt;integer&gt;/&lt;integer&gt;.
-            // Applicable to device-aspect-ratio and aspec-ratio.
-            bool isValid = true;
-            float numeratorValue = 0;
-            float denominatorValue = 0;
-
-            // The aspect-ratio must be &lt;integer&gt; (whitespace)? / (whitespace)? &lt;integer&gt;.
-            for (unsigned i = 0; i &lt; 3; ++i, valueList-&gt;next()) {
-                const CSSParserValue* value = valueList-&gt;current();
-                if (i != 1 &amp;&amp; value-&gt;unit == CSSPrimitiveValue::CSS_NUMBER &amp;&amp; value-&gt;fValue &gt; 0 &amp;&amp; value-&gt;isInt) {
-                    if (!i)
-                        numeratorValue = value-&gt;fValue;
-                    else
-                        denominatorValue = value-&gt;fValue;
-                } else if (i == 1 &amp;&amp; value-&gt;unit == CSSParserValue::Operator &amp;&amp; value-&gt;iValue == '/')
-                    continue;
-                else {
-                    isValid = false;
-                    break;
-                }
-            }
-
-            if (isValid)
-                m_value = CSSAspectRatioValue::create(numeratorValue, denominatorValue);
-
-            m_isValid = m_value;
</del><ins>+MediaQueryExpression::MediaQueryExpression(const AtomicString&amp; mediaFeature, CSSParserValueList* valueList)
+    : m_mediaFeature(mediaFeature)
+{
+    if (!valueList) {
+        if (isFeatureValidWithoutValue(mediaFeature))
+            m_isValid = true;
+    } else if (valueList-&gt;size() == 1) {
+        auto&amp; value = *valueList-&gt;valueAt(0);
+        if (isFeatureValidWithIdentifier(mediaFeature, value)) {
+            m_value = CSSPrimitiveValue::createIdentifier(value.id);
+            m_isValid = true;
+        } else if (isFeatureValidWithNumberWithUnit(mediaFeature, value) || isFeatureValidWithNonNegativeLengthOrNumber(mediaFeature, value)) {
+            m_value = CSSPrimitiveValue::create(value.fValue, (CSSPrimitiveValue::UnitTypes) value.unit);
+            m_isValid = true;
+        } else if (isFeatureValidWithNumber(mediaFeature, value)) {
+            // FIXME: Can we merge this with the case above?
+            m_value = CSSPrimitiveValue::create(value.fValue, CSSPrimitiveValue::CSS_NUMBER);
+            m_isValid = true;
</ins><span class="cx">         }
</span><del>-    } else if (featureWithoutValue(mediaFeature))
-        m_isValid = true;
</del><ins>+    } else if (valueList-&gt;size() == 3 &amp;&amp; isAspectRatioFeature(mediaFeature)) {
+        auto&amp; numerator = *valueList-&gt;valueAt(0);
+        auto&amp; slash = *valueList-&gt;valueAt(1);
+        auto&amp; denominator = *valueList-&gt;valueAt(2);
+        if (isPositiveIntegerValue(numerator) &amp;&amp; isSlash(slash) &amp;&amp; isPositiveIntegerValue(denominator)) {
+            m_value = CSSAspectRatioValue::create(numerator.fValue, denominator.fValue);
+            m_isValid = true;
+        }
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-String MediaQueryExp::serialize() const
</del><ins>+String MediaQueryExpression::serialize() const
</ins><span class="cx"> {
</span><span class="cx">     if (!m_serializationCache.isNull())
</span><span class="cx">         return m_serializationCache;
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryExph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryExp.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryExp.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryExp.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -25,32 +25,29 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaQueryExp_h
-#define MediaQueryExp_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;CSSValue.h&quot;
</span><del>-#include &quot;MediaFeatureNames.h&quot;
</del><span class="cx"> #include &lt;memory&gt;
</span><del>-#include &lt;wtf/text/AtomicString.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class CSSParserValueList;
</span><span class="cx"> 
</span><del>-class MediaQueryExp {
</del><ins>+// FIXME: Rename the file to match this class's name.
+class MediaQueryExpression {
</ins><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    explicit MediaQueryExp(const AtomicString&amp; mediaFeature = emptyAtom, CSSParserValueList* values = nullptr);
</del><ins>+    explicit MediaQueryExpression(const AtomicString&amp; mediaFeature = emptyAtom, CSSParserValueList* values = nullptr);
</ins><span class="cx"> 
</span><span class="cx">     const AtomicString&amp; mediaFeature() const;
</span><span class="cx">     CSSValue* value() const;
</span><span class="cx"> 
</span><span class="cx">     bool isValid() const;
</span><del>-    bool isViewportDependent() const;
</del><span class="cx"> 
</span><span class="cx">     String serialize() const;
</span><span class="cx"> 
</span><del>-    bool operator==(const MediaQueryExp&amp;) const;
</del><ins>+    bool operator==(const MediaQueryExpression&amp;) const;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     AtomicString m_mediaFeature;
</span><span class="lines">@@ -59,42 +56,25 @@
</span><span class="cx">     mutable String m_serializationCache;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline const AtomicString&amp; MediaQueryExp::mediaFeature() const
</del><ins>+inline const AtomicString&amp; MediaQueryExpression::mediaFeature() const
</ins><span class="cx"> {
</span><span class="cx">     return m_mediaFeature;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline CSSValue* MediaQueryExp::value() const
</del><ins>+inline CSSValue* MediaQueryExpression::value() const
</ins><span class="cx"> {
</span><span class="cx">     return m_value.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool MediaQueryExp::operator==(const MediaQueryExp&amp; other) const
</del><ins>+inline bool MediaQueryExpression::operator==(const MediaQueryExpression&amp; other) const
</ins><span class="cx"> {
</span><del>-    return (other.m_mediaFeature == m_mediaFeature)
-        &amp;&amp; ((!other.m_value &amp;&amp; !m_value)
-            || (other.m_value &amp;&amp; m_value &amp;&amp; other.m_value-&gt;equals(*m_value)));
</del><ins>+    return other.m_mediaFeature == m_mediaFeature
+        &amp;&amp; ((!m_value &amp;&amp; !other.m_value) || (m_value &amp;&amp; other.m_value &amp;&amp; *m_value == *other.m_value));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool MediaQueryExp::isValid() const
</del><ins>+inline bool MediaQueryExpression::isValid() const
</ins><span class="cx"> {
</span><span class="cx">     return m_isValid;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool MediaQueryExp::isViewportDependent() const
-{
-    return m_mediaFeature == MediaFeatureNames::widthMediaFeature
-        || m_mediaFeature == MediaFeatureNames::heightMediaFeature
-        || m_mediaFeature == MediaFeatureNames::min_widthMediaFeature
-        || m_mediaFeature == MediaFeatureNames::min_heightMediaFeature
-        || m_mediaFeature == MediaFeatureNames::max_widthMediaFeature
-        || m_mediaFeature == MediaFeatureNames::max_heightMediaFeature
-        || m_mediaFeature == MediaFeatureNames::orientationMediaFeature
-        || m_mediaFeature == MediaFeatureNames::aspect_ratioMediaFeature
-        || m_mediaFeature == MediaFeatureNames::min_aspect_ratioMediaFeature
-        || m_mediaFeature == MediaFeatureNames::max_aspect_ratioMediaFeature;
-}
-
</del><span class="cx"> } // namespace
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryList.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryList.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryList.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -27,18 +27,18 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-Ref&lt;MediaQueryList&gt; MediaQueryList::create(PassRefPtr&lt;MediaQueryMatcher&gt; vector, PassRefPtr&lt;MediaQuerySet&gt; media, bool matches)
</del><ins>+inline MediaQueryList::MediaQueryList(MediaQueryMatcher&amp; matcher, Ref&lt;MediaQuerySet&gt;&amp;&amp; media, bool matches)
+    : m_matcher(matcher)
+    , m_media(WTFMove(media))
+    , m_evaluationRound(m_matcher-&gt;evaluationRound())
+    , m_changeRound(m_evaluationRound - 1) // Any value that is not the same as m_evaluationRound would do.
+    , m_matches(matches)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new MediaQueryList(vector, media, matches));
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQueryList::MediaQueryList(PassRefPtr&lt;MediaQueryMatcher&gt; vector, PassRefPtr&lt;MediaQuerySet&gt; media, bool matches)
-    : m_matcher(vector)
-    , m_media(media)
-    , m_evaluationRound(m_matcher-&gt;evaluationRound())
-    , m_changeRound(m_evaluationRound - 1) // m_evaluationRound and m_changeRound initial values must be different.
-    , m_matches(matches)
</del><ins>+Ref&lt;MediaQueryList&gt; MediaQueryList::create(MediaQueryMatcher&amp; matcher, Ref&lt;MediaQuerySet&gt;&amp;&amp; media, bool matches)
</ins><span class="cx"> {
</span><ins>+    return adoptRef(*new MediaQueryList(matcher, WTFMove(media), matches));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MediaQueryList::~MediaQueryList()
</span><span class="lines">@@ -50,26 +50,26 @@
</span><span class="cx">     return m_media-&gt;mediaText();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQueryList::addListener(PassRefPtr&lt;MediaQueryListListener&gt; listener)
</del><ins>+void MediaQueryList::addListener(RefPtr&lt;MediaQueryListListener&gt;&amp;&amp; listener)
</ins><span class="cx"> {
</span><span class="cx">     if (!listener)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_matcher-&gt;addListener(listener, this);
</del><ins>+    m_matcher-&gt;addListener(listener.releaseNonNull(), *this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQueryList::removeListener(PassRefPtr&lt;MediaQueryListListener&gt; listener)
</del><ins>+void MediaQueryList::removeListener(RefPtr&lt;MediaQueryListListener&gt;&amp;&amp; listener)
</ins><span class="cx"> {
</span><span class="cx">     if (!listener)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_matcher-&gt;removeListener(listener.get(), this);
</del><ins>+    m_matcher-&gt;removeListener(*listener, *this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQueryList::evaluate(MediaQueryEvaluator* evaluator, bool&amp; notificationNeeded)
</del><ins>+void MediaQueryList::evaluate(MediaQueryEvaluator&amp; evaluator, bool&amp; notificationNeeded)
</ins><span class="cx"> {
</span><del>-    if (m_evaluationRound != m_matcher-&gt;evaluationRound() &amp;&amp; evaluator)
-        setMatches(evaluator-&gt;eval(m_media.get()));
</del><ins>+    if (m_evaluationRound != m_matcher-&gt;evaluationRound())
+        setMatches(evaluator.evaluate(m_media.get()));
</ins><span class="cx">     notificationNeeded = m_changeRound == m_matcher-&gt;evaluationRound();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryList.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryList.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryList.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -17,8 +17,7 @@
</span><span class="cx">  *  Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaQueryList_h
-#define MediaQueryList_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="lines">@@ -38,28 +37,27 @@
</span><span class="cx"> 
</span><span class="cx"> class MediaQueryList : public RefCounted&lt;MediaQueryList&gt; {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;MediaQueryList&gt; create(PassRefPtr&lt;MediaQueryMatcher&gt;, PassRefPtr&lt;MediaQuerySet&gt;, bool);
</del><ins>+    static Ref&lt;MediaQueryList&gt; create(MediaQueryMatcher&amp;, Ref&lt;MediaQuerySet&gt;&amp;&amp;, bool);
</ins><span class="cx">     ~MediaQueryList();
</span><span class="cx"> 
</span><span class="cx">     String media() const;
</span><span class="cx">     bool matches();
</span><span class="cx"> 
</span><del>-    void addListener(PassRefPtr&lt;MediaQueryListListener&gt;);
-    void removeListener(PassRefPtr&lt;MediaQueryListListener&gt;);
</del><ins>+    void addListener(RefPtr&lt;MediaQueryListListener&gt;&amp;&amp;);
+    void removeListener(RefPtr&lt;MediaQueryListListener&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    void evaluate(MediaQueryEvaluator*, bool&amp; notificationNeeded);
</del><ins>+    void evaluate(MediaQueryEvaluator&amp;, bool&amp; notificationNeeded);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    MediaQueryList(PassRefPtr&lt;MediaQueryMatcher&gt;, PassRefPtr&lt;MediaQuerySet&gt;, bool matches);
</del><ins>+    MediaQueryList(MediaQueryMatcher&amp;, Ref&lt;MediaQuerySet&gt;&amp;&amp;, bool matches);
+
</ins><span class="cx">     void setMatches(bool);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MediaQueryMatcher&gt; m_matcher;
-    RefPtr&lt;MediaQuerySet&gt; m_media;
</del><ins>+    Ref&lt;MediaQueryMatcher&gt; m_matcher;
+    Ref&lt;MediaQuerySet&gt; m_media;
</ins><span class="cx">     unsigned m_evaluationRound; // Indicates if the query has been evaluated after the last style selector change.
</span><span class="cx">     unsigned m_changeRound; // Used to know if the query has changed in the last style selector change.
</span><span class="cx">     bool m_matches;
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span><del>-
-#endif // MediaQueryList_h
</del></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -21,7 +21,6 @@
</span><span class="cx"> #include &quot;MediaQueryMatcher.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;Document.h&quot;
</span><del>-#include &quot;Element.h&quot;
</del><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameView.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><span class="lines">@@ -33,31 +32,11 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-MediaQueryMatcher::Listener::Listener(PassRefPtr&lt;MediaQueryListListener&gt; listener, PassRefPtr&lt;MediaQueryList&gt; query)
-    : m_listener(listener)
-    , m_query(query)
</del><ins>+MediaQueryMatcher::MediaQueryMatcher(Document&amp; document)
+    : m_document(&amp;document)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MediaQueryMatcher::Listener::~Listener()
-{
-}
-
-void MediaQueryMatcher::Listener::evaluate(MediaQueryEvaluator* evaluator)
-{
-    bool notify;
-    m_query-&gt;evaluate(evaluator, notify);
-    if (notify)
-        m_listener-&gt;queryChanged(m_query.get());
-}
-
-MediaQueryMatcher::MediaQueryMatcher(Document* document)
-    : m_document(document)
-    , m_evaluationRound(1)
-{
-    ASSERT(m_document);
-}
-
</del><span class="cx"> MediaQueryMatcher::~MediaQueryMatcher()
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -65,7 +44,7 @@
</span><span class="cx"> void MediaQueryMatcher::documentDestroyed()
</span><span class="cx"> {
</span><span class="cx">     m_listeners.clear();
</span><del>-    m_document = 0;
</del><ins>+    m_document = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String MediaQueryMatcher::mediaType() const
</span><span class="lines">@@ -81,23 +60,19 @@
</span><span class="cx">     if (!m_document || !m_document-&gt;frame())
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    Element* documentElement = m_document-&gt;documentElement();
</del><ins>+    auto* documentElement = m_document-&gt;documentElement();
</ins><span class="cx">     if (!documentElement)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     return m_document-&gt;ensureStyleResolver().styleForElement(*documentElement, m_document-&gt;renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool MediaQueryMatcher::evaluate(const MediaQuerySet* media)
</del><ins>+bool MediaQueryMatcher::evaluate(const MediaQuerySet&amp; media)
</ins><span class="cx"> {
</span><del>-    if (!media)
-        return false;
-
</del><span class="cx">     auto style = documentElementUserAgentStyle();
</span><span class="cx">     if (!style)
</span><span class="cx">         return false;
</span><del>-    MediaQueryEvaluator evaluator(mediaType(), m_document-&gt;frame(), style.get());
-    return evaluator.eval(media);
</del><ins>+    return MediaQueryEvaluator { mediaType(), *m_document, style.get() }.evaluate(media);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;MediaQueryList&gt; MediaQueryMatcher::matchMedia(const String&amp; query)
</span><span class="lines">@@ -105,34 +80,29 @@
</span><span class="cx">     if (!m_document)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MediaQuerySet&gt; media = MediaQuerySet::create(query);
-#if ENABLE(RESOLUTION_MEDIA_QUERY)
-    // Add warning message to inspector whenever dpi/dpcm values are used for &quot;screen&quot; media.
-    reportMediaQueryWarningIfNeeded(m_document, media.get());
-#endif
-    return MediaQueryList::create(this, media, evaluate(media.get()));
</del><ins>+    auto media = MediaQuerySet::create(query);
+    reportMediaQueryWarningIfNeeded(m_document, media.ptr());
+    bool result = evaluate(media.get());
+    return MediaQueryList::create(*this, WTFMove(media), result);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQueryMatcher::addListener(PassRefPtr&lt;MediaQueryListListener&gt; listener, PassRefPtr&lt;MediaQueryList&gt; query)
</del><ins>+void MediaQueryMatcher::addListener(Ref&lt;MediaQueryListListener&gt;&amp;&amp; listener, MediaQueryList&amp; query)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_document)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; m_listeners.size(); ++i) {
-        if (*m_listeners[i]-&gt;listener() == *listener &amp;&amp; m_listeners[i]-&gt;query() == query)
</del><ins>+    for (auto&amp; existingListener : m_listeners) {
+        if (existingListener.listener.get() == listener.get() &amp;&amp; existingListener.query.ptr() == &amp;query)
</ins><span class="cx">             return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_listeners.append(std::make_unique&lt;Listener&gt;(listener, query));
</del><ins>+    m_listeners.append(Listener { WTFMove(listener), query });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MediaQueryMatcher::removeListener(MediaQueryListListener* listener, MediaQueryList* query)
</del><ins>+void MediaQueryMatcher::removeListener(MediaQueryListListener&amp; listener, MediaQueryList&amp; query)
</ins><span class="cx"> {
</span><del>-    if (!m_document)
-        return;
-
-    m_listeners.removeFirstMatching([listener, query](auto&amp; current) {
-        return *current-&gt;listener() == *listener &amp;&amp; current-&gt;query() == query;
</del><ins>+    m_listeners.removeFirstMatching([&amp;listener, &amp;query](auto&amp; existingListener) {
+        return existingListener.listener.get() == listener &amp;&amp; existingListener.query.ptr() == &amp;query;
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -145,9 +115,14 @@
</span><span class="cx">     auto style = documentElementUserAgentStyle();
</span><span class="cx">     if (!style)
</span><span class="cx">         return;
</span><del>-    MediaQueryEvaluator evaluator(mediaType(), m_document-&gt;frame(), style.get());
-    for (size_t i = 0; i &lt; m_listeners.size(); ++i)
-        m_listeners[i]-&gt;evaluate(&amp;evaluator);
</del><ins>+
+    MediaQueryEvaluator evaluator { mediaType(), *m_document, style.get() };
+    for (auto&amp; listener : m_listeners) {
+        bool notify;
+        listener.query-&gt;evaluate(evaluator, notify);
+        if (notify)
+            listener.listener-&gt;queryChanged(listener.query.ptr());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssMediaQueryMatcherh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/MediaQueryMatcher.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/MediaQueryMatcher.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/MediaQueryMatcher.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -17,8 +17,7 @@
</span><span class="cx">  *  Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef MediaQueryMatcher_h
-#define MediaQueryMatcher_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="lines">@@ -37,53 +36,43 @@
</span><span class="cx"> // MediaQueryMatcher class is responsible for keeping a vector of pairs
</span><span class="cx"> // MediaQueryList x MediaQueryListListener. It is responsible for evaluating the queries
</span><span class="cx"> // whenever it is needed and to call the listeners if the corresponding query has changed.
</span><del>-// The listeners must be called in the very same order in which they have been added.
</del><ins>+// The listeners must be called in the order in which they were added.
</ins><span class="cx"> 
</span><span class="cx"> class MediaQueryMatcher : public RefCounted&lt;MediaQueryMatcher&gt; {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;MediaQueryMatcher&gt; create(Document* document) { return adoptRef(*new MediaQueryMatcher(document)); }
</del><ins>+    static Ref&lt;MediaQueryMatcher&gt; create(Document&amp; document) { return adoptRef(*new MediaQueryMatcher(document)); }
</ins><span class="cx">     ~MediaQueryMatcher();
</span><ins>+
</ins><span class="cx">     void documentDestroyed();
</span><span class="cx"> 
</span><del>-    void addListener(PassRefPtr&lt;MediaQueryListListener&gt;, PassRefPtr&lt;MediaQueryList&gt;);
-    void removeListener(MediaQueryListListener*, MediaQueryList*);
</del><ins>+    void addListener(Ref&lt;MediaQueryListListener&gt;&amp;&amp;, MediaQueryList&amp;);
+    void removeListener(MediaQueryListListener&amp;, MediaQueryList&amp;);
</ins><span class="cx"> 
</span><span class="cx">     RefPtr&lt;MediaQueryList&gt; matchMedia(const String&amp;);
</span><span class="cx"> 
</span><span class="cx">     unsigned evaluationRound() const { return m_evaluationRound; }
</span><ins>+
</ins><span class="cx">     void styleResolverChanged();
</span><del>-    bool evaluate(const MediaQuerySet*);
</del><span class="cx"> 
</span><del>-private:
-    class Listener {
-        WTF_MAKE_FAST_ALLOCATED;
-    public:
-        Listener(PassRefPtr&lt;MediaQueryListListener&gt;, PassRefPtr&lt;MediaQueryList&gt;);
-        ~Listener();
</del><ins>+    bool evaluate(const MediaQuerySet&amp;);
</ins><span class="cx"> 
</span><del>-        void evaluate(MediaQueryEvaluator*);
-
-        MediaQueryListListener* listener() { return m_listener.get(); }
-        MediaQueryList* query() { return m_query.get(); }
-
-    private:
-        RefPtr&lt;MediaQueryListListener&gt; m_listener;
-        RefPtr&lt;MediaQueryList&gt; m_query;
</del><ins>+private:
+    struct Listener {
+        Ref&lt;MediaQueryListListener&gt; listener;
+        Ref&lt;MediaQueryList&gt; query;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><del>-    MediaQueryMatcher(Document*);
</del><ins>+    explicit MediaQueryMatcher(Document&amp;);
</ins><span class="cx">     std::unique_ptr&lt;RenderStyle&gt; documentElementUserAgentStyle() const;
</span><span class="cx">     String mediaType() const;
</span><span class="cx"> 
</span><span class="cx">     Document* m_document;
</span><del>-    Vector&lt;std::unique_ptr&lt;Listener&gt;&gt; m_listeners;
</del><ins>+    Vector&lt;Listener&gt; m_listeners;
</ins><span class="cx"> 
</span><span class="cx">     // This value is incremented at style selector changes.
</span><span class="cx">     // It is used to avoid evaluating queries more then once and to make sure
</span><span class="cx">     // that a media query result change is notified exactly once.
</span><del>-    unsigned m_evaluationRound;
</del><ins>+    unsigned m_evaluationRound { 1 };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // MediaQueryMatcher_h
</del></span></pre></div>
<a id="trunkSourceWebCorecssRuleSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/RuleSet.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/RuleSet.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/RuleSet.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx">             addPageRule(downcast&lt;StyleRulePage&gt;(rule.get()));
</span><span class="cx">         else if (is&lt;StyleRuleMedia&gt;(*rule)) {
</span><span class="cx">             auto&amp; mediaRule = downcast&lt;StyleRuleMedia&gt;(*rule);
</span><del>-            if ((!mediaRule.mediaQueries() || medium.eval(mediaRule.mediaQueries(), resolver)))
</del><ins>+            if ((!mediaRule.mediaQueries() || medium.evaluate(*mediaRule.mediaQueries(), resolver)))
</ins><span class="cx">                 addChildRules(mediaRule.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);
</span><span class="cx">         } else if (is&lt;StyleRuleFontFace&gt;(*rule) &amp;&amp; resolver) {
</span><span class="cx">             // Add this font face to our set.
</span><span class="lines">@@ -363,7 +363,7 @@
</span><span class="cx"> void RuleSet::addRulesFromSheet(StyleSheetContents&amp; sheet, const MediaQueryEvaluator&amp; medium, StyleResolver* resolver)
</span><span class="cx"> {
</span><span class="cx">     for (auto&amp; rule : sheet.importRules()) {
</span><del>-        if (rule-&gt;styleSheet() &amp;&amp; (!rule-&gt;mediaQueries() || medium.eval(rule-&gt;mediaQueries(), resolver)))
</del><ins>+        if (rule-&gt;styleSheet() &amp;&amp; (!rule-&gt;mediaQueries() || medium.evaluate(*rule-&gt;mediaQueries(), resolver)))
</ins><span class="cx">             addRulesFromSheet(*rule-&gt;styleSheet(), medium, resolver);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssSourceSizeListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SourceSizeList.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SourceSizeList.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/SourceSizeList.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -24,58 +24,47 @@
</span><span class="cx"> #include &quot;CSSParser.h&quot;
</span><span class="cx"> #include &quot;CSSToLengthConversionData.h&quot;
</span><span class="cx"> #include &quot;MediaList.h&quot;
</span><del>-#include &quot;MediaQuery.h&quot;
</del><span class="cx"> #include &quot;MediaQueryEvaluator.h&quot;
</span><del>-#include &quot;MediaQueryExp.h&quot;
</del><span class="cx"> #include &quot;RenderStyle.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static bool match(std::unique_ptr&lt;MediaQueryExp&gt;&amp;&amp; expression, const RenderStyle&amp; style, Frame* frame)
</del><ins>+static bool match(const MediaQueryExpression&amp; expression, const RenderStyle&amp; style, Document&amp; document)
</ins><span class="cx"> {
</span><del>-    if (expression-&gt;mediaFeature().isEmpty())
-        return true;
-
-    auto expList = std::make_unique&lt;Vector&lt;std::unique_ptr&lt;MediaQueryExp&gt;&gt;&gt;();
-    expList-&gt;append(WTFMove(expression));
-
-    RefPtr&lt;MediaQuerySet&gt; mediaQuerySet = MediaQuerySet::create();
-    mediaQuerySet-&gt;addMediaQuery(std::make_unique&lt;MediaQuery&gt;(MediaQuery::None, &quot;all&quot;, WTFMove(expList)));
-
-    MediaQueryEvaluator mediaQueryEvaluator(&quot;screen&quot;, frame, &amp;style);
-    return mediaQueryEvaluator.eval(mediaQuerySet.get());
</del><ins>+    return expression.mediaFeature().isEmpty() || MediaQueryEvaluator { &quot;screen&quot;, document, &amp;style }.evaluate(expression);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static float defaultLength(const RenderStyle&amp; style, RenderView* view)
</del><ins>+static float defaultLength(const RenderStyle&amp; style, RenderView&amp; renderer)
</ins><span class="cx"> {
</span><del>-    return clampTo&lt;float&gt;(CSSPrimitiveValue::computeNonCalcLengthDouble(CSSToLengthConversionData(&amp;style, &amp;style, view), CSSPrimitiveValue::CSS_VW, 100.0));
</del><ins>+    return clampTo&lt;float&gt;(CSSPrimitiveValue::computeNonCalcLengthDouble({ &amp;style, &amp;style, &amp;renderer }, CSSPrimitiveValue::CSS_VW, 100.0));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static float computeLength(CSSValue* value, const RenderStyle&amp; style, RenderView* view)
</del><ins>+static float computeLength(CSSValue&amp; value, const RenderStyle&amp; style, RenderView&amp; renderer)
</ins><span class="cx"> {
</span><del>-    CSSToLengthConversionData conversionData(&amp;style, &amp;style, view);
</del><ins>+    CSSToLengthConversionData conversionData(&amp;style, &amp;style, &amp;renderer);
</ins><span class="cx">     if (is&lt;CSSPrimitiveValue&gt;(value)) {
</span><del>-        CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(*value);
</del><ins>+        CSSPrimitiveValue&amp; primitiveValue = downcast&lt;CSSPrimitiveValue&gt;(value);
</ins><span class="cx">         if (!primitiveValue.isLength())
</span><del>-            return defaultLength(style, view);
</del><ins>+            return defaultLength(style, renderer);
</ins><span class="cx">         return primitiveValue.computeLength&lt;float&gt;(conversionData);
</span><span class="cx">     }
</span><span class="cx">     if (is&lt;CSSCalcValue&gt;(value))
</span><del>-        return downcast&lt;CSSCalcValue&gt;(*value).computeLengthPx(conversionData);
-    return defaultLength(style, view);
</del><ins>+        return downcast&lt;CSSCalcValue&gt;(value).computeLengthPx(conversionData);
+    return defaultLength(style, renderer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-float parseSizesAttribute(StringView sizesAttribute, RenderView* view, Frame* frame)
</del><ins>+float parseSizesAttribute(Document&amp; document, StringView sizesAttribute)
</ins><span class="cx"> {
</span><del>-    if (!view)
</del><ins>+    auto* renderer = document.renderView();
+    if (!renderer)
</ins><span class="cx">         return 0;
</span><del>-    auto&amp; style = view-&gt;style();
</del><ins>+    auto&amp; style = renderer-&gt;style();
</ins><span class="cx">     for (auto&amp; sourceSize : CSSParser(CSSStrictMode).parseSizesAttribute(sizesAttribute)) {
</span><del>-        if (match(WTFMove(sourceSize.expression), style, frame))
-            return computeLength(sourceSize.length.get(), style, view);
</del><ins>+        if (match(sourceSize.expression, style, document))
+            return computeLength(sourceSize.length.get(), style, *renderer);
</ins><span class="cx">     }
</span><del>-    return defaultLength(style, view);
</del><ins>+    return defaultLength(style, *renderer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssSourceSizeListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/SourceSizeList.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/SourceSizeList.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/SourceSizeList.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -18,18 +18,14 @@
</span><span class="cx">  * Boston, MA 02110-1301, USA.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef SourceSizeList_h
-#define SourceSizeList_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class Frame;
-class RenderView;
</del><ins>+class Document;
</ins><span class="cx"> 
</span><del>-float parseSizesAttribute(StringView sizesAttribute, RenderView*, Frame*);
</del><ins>+float parseSizesAttribute(Document&amp;, StringView sizesAttribute);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // SourceSizeList_h
</del></span></pre></div>
<a id="trunkSourceWebCorecssStyleMediacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleMedia.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleMedia.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/StyleMedia.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -63,12 +63,11 @@
</span><span class="cx"> 
</span><span class="cx">     auto rootStyle = document-&gt;ensureStyleResolver().styleForElement(*documentElement, document-&gt;renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;MediaQuerySet&gt; media = MediaQuerySet::create();
</del><ins>+    auto media = MediaQuerySet::create();
</ins><span class="cx">     if (!media-&gt;parse(query))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    MediaQueryEvaluator screenEval(type(), m_frame, rootStyle.get());
-    return screenEval.eval(media.get());
</del><ins>+    return MediaQueryEvaluator { type(), *document, rootStyle.get() }.evaluate(media.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolvercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/StyleResolver.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -270,19 +270,19 @@
</span><span class="cx">     // is always from the document that owns the style selector
</span><span class="cx">     FrameView* view = m_document.view();
</span><span class="cx">     if (view)
</span><del>-        m_medium = std::make_unique&lt;MediaQueryEvaluator&gt;(view-&gt;mediaType());
</del><ins>+        m_mediaQueryEvaluator = MediaQueryEvaluator { view-&gt;mediaType() };
</ins><span class="cx">     else
</span><del>-        m_medium = std::make_unique&lt;MediaQueryEvaluator&gt;(&quot;all&quot;);
</del><ins>+        m_mediaQueryEvaluator = MediaQueryEvaluator { &quot;all&quot; };
</ins><span class="cx"> 
</span><span class="cx">     if (root)
</span><span class="cx">         m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), MatchOnlyUserAgentRules).renderStyle;
</span><span class="cx"> 
</span><span class="cx">     if (m_rootDefaultStyle &amp;&amp; view)
</span><del>-        m_medium = std::make_unique&lt;MediaQueryEvaluator&gt;(view-&gt;mediaType(), &amp;view-&gt;frame(), m_rootDefaultStyle.get());
</del><ins>+        m_mediaQueryEvaluator = MediaQueryEvaluator { view-&gt;mediaType(), m_document, m_rootDefaultStyle.get() };
</ins><span class="cx"> 
</span><span class="cx">     m_ruleSets.resetAuthorStyle();
</span><span class="cx"> 
</span><del>-    m_ruleSets.initUserStyle(m_document.extensionStyleSheets(), *m_medium, *this);
</del><ins>+    m_ruleSets.initUserStyle(m_document.extensionStyleSheets(), m_mediaQueryEvaluator, *this);
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(SVG_FONTS)
</span><span class="cx">     if (m_document.svgExtensions()) {
</span><span class="lines">@@ -295,7 +295,7 @@
</span><span class="cx"> 
</span><span class="cx"> void StyleResolver::appendAuthorStyleSheets(const Vector&lt;RefPtr&lt;CSSStyleSheet&gt;&gt;&amp; styleSheets)
</span><span class="cx"> {
</span><del>-    m_ruleSets.appendAuthorStyleSheets(styleSheets, m_medium.get(), m_inspectorCSSOMWrappers, this);
</del><ins>+    m_ruleSets.appendAuthorStyleSheets(styleSheets, &amp;m_mediaQueryEvaluator, m_inspectorCSSOMWrappers, this);
</ins><span class="cx">     if (auto renderView = document().renderView())
</span><span class="cx">         renderView-&gt;style().fontCascade().update(&amp;document().fontSelector());
</span><span class="cx"> 
</span><span class="lines">@@ -419,7 +419,7 @@
</span><span class="cx"> 
</span><span class="cx">     ElementRuleCollector collector(element, m_ruleSets, m_state.selectorFilter());
</span><span class="cx">     collector.setRegionForStyling(regionForStyling);
</span><del>-    collector.setMedium(m_medium.get());
</del><ins>+    collector.setMedium(&amp;m_mediaQueryEvaluator);
</ins><span class="cx"> 
</span><span class="cx">     if (matchingBehavior == MatchOnlyUserAgentRules)
</span><span class="cx">         collector.matchUARules();
</span><span class="lines">@@ -582,7 +582,7 @@
</span><span class="cx">     // Check UA, user and author rules.
</span><span class="cx">     ElementRuleCollector collector(element, m_ruleSets, m_state.selectorFilter());
</span><span class="cx">     collector.setPseudoStyleRequest(pseudoStyleRequest);
</span><del>-    collector.setMedium(m_medium.get());
</del><ins>+    collector.setMedium(&amp;m_mediaQueryEvaluator);
</ins><span class="cx">     collector.matchUARules();
</span><span class="cx"> 
</span><span class="cx">     if (m_matchAuthorAndUserStyles) {
</span><span class="lines">@@ -1086,7 +1086,7 @@
</span><span class="cx">     ElementRuleCollector collector(*element, m_ruleSets, m_state.selectorFilter());
</span><span class="cx">     collector.setMode(SelectorChecker::Mode::CollectingRules);
</span><span class="cx">     collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
</span><del>-    collector.setMedium(m_medium.get());
</del><ins>+    collector.setMedium(&amp;m_mediaQueryEvaluator);
</ins><span class="cx"> 
</span><span class="cx">     if (rulesToInclude &amp; UAAndUserCSSRules) {
</span><span class="cx">         // First we match rules from the user agent sheet.
</span><span class="lines">@@ -1878,16 +1878,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void StyleResolver::addViewportDependentMediaQueryResult(const MediaQueryExp* expr, bool result)
</del><ins>+void StyleResolver::addViewportDependentMediaQueryResult(const MediaQueryExpression&amp; expression, bool result)
</ins><span class="cx"> {
</span><del>-    m_viewportDependentMediaQueryResults.append(std::make_unique&lt;MediaQueryResult&gt;(*expr, result));
</del><ins>+    m_viewportDependentMediaQueryResults.append(MediaQueryResult { expression, result });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool StyleResolver::hasMediaQueriesAffectedByViewportChange() const
</span><span class="cx"> {
</span><del>-    unsigned s = m_viewportDependentMediaQueryResults.size();
-    for (unsigned i = 0; i &lt; s; i++) {
-        if (m_medium-&gt;eval(&amp;m_viewportDependentMediaQueryResults[i]-&gt;m_expression) != m_viewportDependentMediaQueryResults[i]-&gt;m_result)
</del><ins>+    for (auto&amp; result : m_viewportDependentMediaQueryResults) {
+        if (m_mediaQueryEvaluator.evaluate(result.expression) != result.result)
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleResolver.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleResolver.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/StyleResolver.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -155,7 +155,7 @@
</span><span class="cx">     DocumentRuleSets&amp; ruleSets() { return m_ruleSets; }
</span><span class="cx">     const DocumentRuleSets&amp; ruleSets() const { return m_ruleSets; }
</span><span class="cx"> 
</span><del>-    const MediaQueryEvaluator&amp; mediaQueryEvaluator() const { return *m_medium; }
</del><ins>+    const MediaQueryEvaluator&amp; mediaQueryEvaluator() const { return m_mediaQueryEvaluator; }
</ins><span class="cx"> 
</span><span class="cx">     void setOverrideDocumentElementStyle(RenderStyle* style) { m_overrideDocumentElementStyle = style; }
</span><span class="cx"> 
</span><span class="lines">@@ -201,7 +201,7 @@
</span><span class="cx">     ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResolver.get(); }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    void addViewportDependentMediaQueryResult(const MediaQueryExp*, bool result);
</del><ins>+    void addViewportDependentMediaQueryResult(const MediaQueryExpression&amp;, bool result);
</ins><span class="cx">     bool hasViewportDependentMediaQueries() const { return !m_viewportDependentMediaQueryResults.isEmpty(); }
</span><span class="cx">     bool hasMediaQueriesAffectedByViewportChange() const;
</span><span class="cx"> 
</span><span class="lines">@@ -517,7 +517,7 @@
</span><span class="cx"> 
</span><span class="cx">     Timer m_matchedPropertiesCacheSweepTimer;
</span><span class="cx"> 
</span><del>-    std::unique_ptr&lt;MediaQueryEvaluator&gt; m_medium;
</del><ins>+    MediaQueryEvaluator m_mediaQueryEvaluator;
</ins><span class="cx">     std::unique_ptr&lt;RenderStyle&gt; m_rootDefaultStyle;
</span><span class="cx"> 
</span><span class="cx">     Document&amp; m_document;
</span><span class="lines">@@ -526,7 +526,7 @@
</span><span class="cx"> 
</span><span class="cx">     RenderStyle* m_overrideDocumentElementStyle { nullptr };
</span><span class="cx"> 
</span><del>-    Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt; m_viewportDependentMediaQueryResults;
</del><ins>+    Vector&lt;MediaQueryResult&gt; m_viewportDependentMediaQueryResults;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(CSS_DEVICE_ADAPTATION)
</span><span class="cx">     RefPtr&lt;ViewportStyleResolver&gt; m_viewportStyleResolver;
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -132,6 +132,7 @@
</span><span class="cx"> void StyleSheetContents::parserAppendRule(Ref&lt;StyleRuleBase&gt;&amp;&amp; rule)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!rule-&gt;isCharsetRule());
</span><ins>+
</ins><span class="cx">     if (is&lt;StyleRuleImport&gt;(rule)) {
</span><span class="cx">         // Parser enforces that @import rules come before anything else except @charset.
</span><span class="cx">         ASSERT(m_childRules.isEmpty());
</span><span class="lines">@@ -141,17 +142,13 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if ENABLE(RESOLUTION_MEDIA_QUERY)
-    // Add warning message to inspector if dpi/dpcm values are used for screen media.
</del><span class="cx">     if (is&lt;StyleRuleMedia&gt;(rule))
</span><span class="cx">         reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast&lt;StyleRuleMedia&gt;(rule.get()).mediaQueries());
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     // NOTE: The selector list has to fit into RuleData. &lt;http://webkit.org/b/118369&gt;
</span><span class="cx">     // If we're adding a rule with a huge number of selectors, split it up into multiple rules
</span><span class="cx">     if (is&lt;StyleRule&gt;(rule) &amp;&amp; downcast&lt;StyleRule&gt;(rule.get()).selectorList().componentCount() &gt; RuleData::maximumSelectorComponentCount) {
</span><del>-        Vector&lt;RefPtr&lt;StyleRule&gt;&gt; rules = downcast&lt;StyleRule&gt;(rule.get()).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount);
-        m_childRules.appendVector(rules);
</del><ins>+        m_childRules.appendVector(downcast&lt;StyleRule&gt;(rule.get()).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -802,7 +802,7 @@
</span><span class="cx"> MediaQueryMatcher&amp; Document::mediaQueryMatcher()
</span><span class="cx"> {
</span><span class="cx">     if (!m_mediaQueryMatcher)
</span><del>-        m_mediaQueryMatcher = MediaQueryMatcher::create(this);
</del><ins>+        m_mediaQueryMatcher = MediaQueryMatcher::create(*this);
</ins><span class="cx">     return *m_mediaQueryMatcher;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomInlineStyleSheetOwnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx"> 
</span><span class="cx">     MediaQueryEvaluator screenEval(ASCIILiteral(&quot;screen&quot;), true);
</span><span class="cx">     MediaQueryEvaluator printEval(ASCIILiteral(&quot;print&quot;), true);
</span><del>-    if (!screenEval.eval(mediaQueries.get()) &amp;&amp; !printEval.eval(mediaQueries.get()))
</del><ins>+    if (!screenEval.evaluate(*mediaQueries) &amp;&amp; !printEval.evaluate(*mediaQueries))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     authorStyleSheetsForElement(element).addPendingSheet();
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingTextIteratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/TextIterator.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/editing/TextIterator.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1266,7 +1266,7 @@
</span><span class="cx">         } else {
</span><span class="cx">             // Exit empty containers as we pass over them or containers
</span><span class="cx">             // where [container, 0] is where we started iterating.
</span><del>-            if (!m_handledNode &amp;&amp; canHaveChildrenForEditing(*m_node)  &amp;&amp; m_node-&gt;parentNode() &amp;&amp; (!m_node-&gt;lastChild() || (m_node == m_endContainer &amp;&amp; !m_endOffset))) {
</del><ins>+            if (!m_handledNode &amp;&amp; canHaveChildrenForEditing(*m_node) &amp;&amp; m_node-&gt;parentNode() &amp;&amp; (!m_node-&gt;lastChild() || (m_node == m_endContainer &amp;&amp; !m_endOffset))) {
</ins><span class="cx">                 exitNode();
</span><span class="cx">                 if (m_positionNode) {
</span><span class="cx">                     m_handledNode = true;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLImageElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLImageElement.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -153,27 +153,31 @@
</span><span class="cx">         if (!is&lt;HTMLSourceElement&gt;(*child))
</span><span class="cx">             continue;
</span><span class="cx">         auto&amp; source = downcast&lt;HTMLSourceElement&gt;(*child);
</span><ins>+
</ins><span class="cx">         auto&amp; srcset = source.fastGetAttribute(srcsetAttr);
</span><span class="cx">         if (srcset.isEmpty())
</span><span class="cx">             continue;
</span><del>-        if (source.hasAttribute(typeAttr)) {
-            String type = source.fastGetAttribute(typeAttr).string();
-            int indexOfSemicolon = type.find(';');
-            if (indexOfSemicolon &gt;= 0)
-                type.truncate(indexOfSemicolon);
</del><ins>+
+        auto&amp; typeAttribute = source.fastGetAttribute(typeAttr);
+        if (!typeAttribute.isNull()) {
+            String type = typeAttribute.string();
+            type.truncate(type.find(';'));
</ins><span class="cx">             type = stripLeadingAndTrailingHTMLSpaces(type);
</span><span class="cx">             if (!type.isEmpty() &amp;&amp; !MIMETypeRegistry::isSupportedImageMIMEType(type) &amp;&amp; !equalLettersIgnoringASCIICase(type, &quot;image/svg+xml&quot;))
</span><span class="cx">                 continue;
</span><span class="cx">         }
</span><del>-        MediaQueryEvaluator evaluator(document().printing() ? &quot;print&quot; : &quot;screen&quot;, document().frame(), document().documentElement() ? document().documentElement()-&gt;computedStyle() : nullptr);
-        bool evaluation = evaluator.evalCheckingViewportDependentResults(source.mediaQuerySet(), picture-&gt;viewportDependentResults());
</del><ins>+
+        auto* documentElement = document().documentElement();
+        MediaQueryEvaluator evaluator { document().printing() ? &quot;print&quot; : &quot;screen&quot;, document(), documentElement ? documentElement-&gt;computedStyle() : nullptr };
+        auto* queries = source.mediaQuerySet();
+        auto evaluation = !queries || evaluator.evaluate(*queries, picture-&gt;viewportDependentResults());
</ins><span class="cx">         if (picture-&gt;hasViewportDependentResults())
</span><span class="cx">             document().addViewportDependentPicture(*picture);
</span><span class="cx">         if (!evaluation)
</span><span class="cx">             continue;
</span><span class="cx"> 
</span><del>-        float sourceSize = parseSizesAttribute(source.fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
-        ImageCandidate candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), nullAtom, source.fastGetAttribute(srcsetAttr), sourceSize);
</del><ins>+        auto sourceSize = parseSizesAttribute(document(), source.fastGetAttribute(sizesAttr).string());
+        auto candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), nullAtom, srcset, sourceSize);
</ins><span class="cx">         if (!candidate.isEmpty())
</span><span class="cx">             return candidate;
</span><span class="cx">     }
</span><span class="lines">@@ -186,7 +190,7 @@
</span><span class="cx">     ImageCandidate candidate = bestFitSourceFromPictureElement();
</span><span class="cx">     if (candidate.isEmpty()) {
</span><span class="cx">         // If we don't have a &lt;picture&gt; or didn't find a source, then we use our own attributes.
</span><del>-        float sourceSize = parseSizesAttribute(fastGetAttribute(sizesAttr).string(), document().renderView(), document().frame());
</del><ins>+        float sourceSize = parseSizesAttribute(document(), fastGetAttribute(sizesAttr).string());
</ins><span class="cx">         candidate = bestFitSourceForImageAttributes(document().deviceScaleFactor(), fastGetAttribute(srcAttr), fastGetAttribute(srcsetAttr), sourceSize);
</span><span class="cx">     }
</span><span class="cx">     setBestFitURLAndDPRFromImageCandidate(candidate);
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLLinkElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -241,8 +241,7 @@
</span><span class="cx">             if (document().hasLivingRenderTree())
</span><span class="cx">                 documentStyle = Style::resolveForDocument(document());
</span><span class="cx">             auto media = MediaQuerySet::createAllowingDescriptionSyntax(m_media);
</span><del>-            MediaQueryEvaluator evaluator(document().frame()-&gt;view()-&gt;mediaType(), document().frame(), documentStyle ? &amp;*documentStyle : nullptr);
-            mediaQueryMatches = evaluator.eval(media.ptr());
</del><ins>+            mediaQueryMatches = MediaQueryEvaluator { document().frame()-&gt;view()-&gt;mediaType(), document(), documentStyle ? &amp;*documentStyle : nullptr }.evaluate(media.get());
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Don't hold up render tree construction and script execution on stylesheets
</span><span class="lines">@@ -361,7 +360,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    Ref&lt;StyleSheetContents&gt; styleSheet(StyleSheetContents::create(href, parserContext));
</del><ins>+    auto styleSheet = StyleSheetContents::create(href, parserContext);
</ins><span class="cx">     m_sheet = CSSStyleSheet::create(styleSheet.copyRef(), this);
</span><span class="cx">     m_sheet-&gt;setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(m_media));
</span><span class="cx">     m_sheet-&gt;setTitle(title());
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -4180,13 +4180,12 @@
</span><span class="cx">             goto check_again;
</span><span class="cx">         
</span><span class="cx">         if (source-&gt;fastHasAttribute(mediaAttr)) {
</span><del>-            MediaQueryEvaluator screenEval(&quot;screen&quot;, document().frame(), renderer() ? &amp;renderer()-&gt;style() : nullptr);
-            RefPtr&lt;MediaQuerySet&gt; media = source-&gt;mediaQuerySet();
</del><ins>+            auto media = source-&gt;mediaQuerySet();
</ins><span class="cx"> #if !LOG_DISABLED
</span><span class="cx">             if (shouldLog)
</span><span class="cx">                 LOG(Media, &quot;HTMLMediaElement::selectNextSourceChild(%p) - 'media' is %s&quot;, this, source-&gt;media().utf8().data());
</span><span class="cx"> #endif
</span><del>-            if (!screenEval.eval(media.get())) 
</del><ins>+            if (media &amp;&amp; !MediaQueryEvaluator { &quot;screen&quot;, document(), renderer() ? &amp;renderer()-&gt;style() : nullptr }.evaluate(*media))
</ins><span class="cx">                 goto check_again;
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLPictureElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLPictureElement.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLPictureElement.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/HTMLPictureElement.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -57,16 +57,16 @@
</span><span class="cx"> 
</span><span class="cx"> void HTMLPictureElement::sourcesChanged()
</span><span class="cx"> {
</span><del>-    for (auto&amp; imageElement : childrenOfType&lt;HTMLImageElement&gt;(*this))
-        imageElement.selectImageSource();
</del><ins>+    for (auto&amp; element : childrenOfType&lt;HTMLImageElement&gt;(*this))
+        element.selectImageSource();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool HTMLPictureElement::viewportChangeAffectedPicture()
</del><ins>+bool HTMLPictureElement::viewportChangeAffectedPicture() const
</ins><span class="cx"> {
</span><del>-    MediaQueryEvaluator evaluator(document().printing() ? &quot;print&quot; : &quot;screen&quot;, document().frame(), document().documentElement() ? document().documentElement()-&gt;computedStyle() : nullptr);
-    unsigned numResults = m_viewportDependentMediaQueryResults.size();
-    for (unsigned i = 0; i &lt; numResults; i++) {
-        if (evaluator.eval(&amp;m_viewportDependentMediaQueryResults[i]-&gt;m_expression) != m_viewportDependentMediaQueryResults[i]-&gt;m_result)
</del><ins>+    auto* documentElement = document().documentElement();
+    MediaQueryEvaluator evaluator { document().printing() ? &quot;print&quot; : &quot;screen&quot;, document(), documentElement ? documentElement-&gt;computedStyle() : nullptr };
+    for (auto&amp; result : m_viewportDependentMediaQueryResults) {
+        if (evaluator.evaluate(result.expression) != result.result)
</ins><span class="cx">             return true;
</span><span class="cx">     }
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLPictureElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLPictureElement.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLPictureElement.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/HTMLPictureElement.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef HTMLPictureElement_h
-#define HTMLPictureElement_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;HTMLElement.h&quot;
</span><span class="cx"> #include &quot;MediaQueryEvaluator.h&quot;
</span><span class="lines">@@ -34,28 +33,25 @@
</span><span class="cx"> class HTMLPictureElement final : public HTMLElement {
</span><span class="cx"> public:
</span><span class="cx">     static Ref&lt;HTMLPictureElement&gt; create(const QualifiedName&amp;, Document&amp;);
</span><del>-    ~HTMLPictureElement();
</del><ins>+    virtual ~HTMLPictureElement();
</ins><span class="cx"> 
</span><span class="cx">     void sourcesChanged();
</span><span class="cx"> 
</span><span class="cx">     void clearViewportDependentResults() { m_viewportDependentMediaQueryResults.clear(); }
</span><span class="cx">     bool hasViewportDependentResults() const { return m_viewportDependentMediaQueryResults.size(); }
</span><del>-    Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt;&amp; viewportDependentResults() { return m_viewportDependentMediaQueryResults; }
</del><ins>+    Vector&lt;MediaQueryResult&gt;&amp; viewportDependentResults() { return m_viewportDependentMediaQueryResults; }
</ins><span class="cx"> 
</span><del>-    void didMoveToNewDocument(Document* oldDocument);
-    
-    bool viewportChangeAffectedPicture();
</del><ins>+    bool viewportChangeAffectedPicture() const;
</ins><span class="cx"> 
</span><span class="cx">     WeakPtr&lt;HTMLPictureElement&gt; createWeakPtr() { return m_weakFactory.createWeakPtr(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     HTMLPictureElement(const QualifiedName&amp;, Document&amp;);
</span><del>-    
-    WeakPtrFactory&lt;HTMLPictureElement&gt; m_weakFactory { this };
-    Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt; m_viewportDependentMediaQueryResults;
</del><span class="cx"> 
</span><ins>+    void didMoveToNewDocument(Document* oldDocument) final;
+
+    WeakPtrFactory&lt;HTMLPictureElement&gt; m_weakFactory { this };
+    Vector&lt;MediaQueryResult&gt; m_viewportDependentMediaQueryResults;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // HTMLPictureElement_h
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLPreloadScannercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx">         }
</span><span class="cx">         
</span><span class="cx">         if (m_tagId == TagId::Source &amp;&amp; !pictureState.isEmpty() &amp;&amp; !pictureState.last() &amp;&amp; m_mediaMatched &amp;&amp; !m_srcSetAttribute.isEmpty()) {
</span><del>-            float sourceSize = parseSizesAttribute(m_sizesAttribute, document.renderView(), document.frame());
</del><ins>+            float sourceSize = parseSizesAttribute(document, m_sizesAttribute);
</ins><span class="cx">             ImageCandidate imageCandidate = bestFitSourceForImageAttributes(m_deviceScaleFactor, m_urlToLoad, m_srcSetAttribute, sourceSize);
</span><span class="cx">             if (!imageCandidate.isEmpty()) {
</span><span class="cx">                 pictureState.last() = true;
</span><span class="lines">@@ -128,7 +128,7 @@
</span><span class="cx">         
</span><span class="cx">         // Resolve between src and srcSet if we have them and the tag is img.
</span><span class="cx">         if (m_tagId == TagId::Img &amp;&amp; !m_srcSetAttribute.isEmpty()) {
</span><del>-            float sourceSize = parseSizesAttribute(m_sizesAttribute, document.renderView(), document.frame());
</del><ins>+            float sourceSize = parseSizesAttribute(document, m_sizesAttribute);
</ins><span class="cx">             ImageCandidate imageCandidate = bestFitSourceForImageAttributes(m_deviceScaleFactor, m_urlToLoad, m_srcSetAttribute, sourceSize);
</span><span class="cx">             setUrlToLoad(imageCandidate.string.toString(), true);
</span><span class="cx">         }
</span><span class="lines">@@ -198,10 +198,9 @@
</span><span class="cx">             }
</span><span class="cx">             if (match(attributeName, mediaAttr) &amp;&amp; m_mediaAttribute.isNull()) {
</span><span class="cx">                 m_mediaAttribute = attributeValue;
</span><del>-                Ref&lt;MediaQuerySet&gt; mediaSet = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
-                Vector&lt;std::unique_ptr&lt;MediaQueryResult&gt;&gt; viewportDependentMediaQueryResults;
-                MediaQueryEvaluator evaluator(document.printing() ? &quot;print&quot; : &quot;screen&quot;, document.frame(), document.documentElement() ? document.documentElement()-&gt;computedStyle() : nullptr);
-                m_mediaMatched = evaluator.evalCheckingViewportDependentResults(mediaSet.ptr(), viewportDependentMediaQueryResults);
</del><ins>+                auto mediaSet = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
+                auto* documentElement = document.documentElement();
+                m_mediaMatched = MediaQueryEvaluator { document.printing() ? &quot;print&quot; : &quot;screen&quot;, document, documentElement ? documentElement-&gt;computedStyle() : nullptr }.evaluate(mediaSet.get());
</ins><span class="cx">             }
</span><span class="cx">             break;
</span><span class="cx">         case TagId::Script:
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlparserHTMLResourcePreloadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -58,18 +58,17 @@
</span><span class="cx">         preload(WTFMove(request));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool mediaAttributeMatches(Frame* frame, const RenderStyle* renderStyle, const String&amp; attributeValue)
</del><ins>+static bool mediaAttributeMatches(Document&amp; document, const RenderStyle* renderStyle, const String&amp; attributeValue)
</ins><span class="cx"> {
</span><del>-    RefPtr&lt;MediaQuerySet&gt; mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
-    MediaQueryEvaluator mediaQueryEvaluator(&quot;screen&quot;, frame, renderStyle);
-    return mediaQueryEvaluator.eval(mediaQueries.get());
</del><ins>+    auto mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(attributeValue);
+    return MediaQueryEvaluator { &quot;screen&quot;, document, renderStyle }.evaluate(mediaQueries.get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void HTMLResourcePreloader::preload(std::unique_ptr&lt;PreloadRequest&gt; preload)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_document.frame());
</span><span class="cx">     ASSERT(m_document.renderView());
</span><del>-    if (!preload-&gt;media().isEmpty() &amp;&amp; !mediaAttributeMatches(m_document.frame(), &amp;m_document.renderView()-&gt;style(), preload-&gt;media()))
</del><ins>+    if (!preload-&gt;media().isEmpty() &amp;&amp; !mediaAttributeMatches(m_document, &amp;m_document.renderView()-&gt;style(), preload-&gt;media()))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     CachedResourceRequest request = preload-&gt;resourceRequest(m_document);
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -79,7 +79,6 @@
</span><span class="cx"> #include &quot;PageGroup.h&quot;
</span><span class="cx"> #include &quot;PageTransitionEvent.h&quot;
</span><span class="cx"> #include &quot;Performance.h&quot;
</span><del>-#include &quot;PlatformScreen.h&quot;
</del><span class="cx"> #include &quot;ResourceLoadInfo.h&quot;
</span><span class="cx"> #include &quot;RuntimeEnabledFeatures.h&quot;
</span><span class="cx"> #include &quot;ScheduledAction.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacEventHandlerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1175,10 +1175,8 @@
</span><span class="cx">     if (!page)
</span><span class="cx">         return m_lastKnownMousePosition;
</span><span class="cx"> 
</span><del>-    NSScreen *screen = screenForDisplayID(page-&gt;chrome().displayID());
-    IntSize autoscrollAdjustmentFactor = autoscrollAdjustmentFactorForScreenBoundaries(m_lastKnownMouseGlobalPosition, toUserSpace(screen.frame, nil));
-
-    return m_lastKnownMousePosition + autoscrollAdjustmentFactor;
</del><ins>+    auto frame = toUserSpace(screen(page-&gt;chrome().displayID()).frame, nil);
+    return m_lastKnownMousePosition + autoscrollAdjustmentFactorForScreenBoundaries(m_lastKnownMouseGlobalPosition, frame);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformPlatformScreenh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/PlatformScreen.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/PlatformScreen.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/PlatformScreen.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,11 +23,8 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef PlatformScreen_h
-#define PlatformScreen_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &lt;wtf/Vector.h&gt;
-
</del><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> OBJC_CLASS NSScreen;
</span><span class="cx"> OBJC_CLASS NSWindow;
</span><span class="lines">@@ -44,44 +41,44 @@
</span><span class="cx"> OBJC_CLASS UIScreen;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-typedef uint32_t PlatformDisplayID;
-
-typedef WTF::Vector&lt;char&gt; ColorProfile;
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-    class FloatRect;
-    class FloatSize;
-    class Widget;
</del><ins>+class FloatRect;
+class FloatSize;
+class Widget;
</ins><span class="cx"> 
</span><del>-    int screenDepth(Widget*);
-    int screenDepthPerComponent(Widget*);
-    bool screenIsMonochrome(Widget*);
</del><ins>+using PlatformDisplayID = uint32_t;
</ins><span class="cx"> 
</span><del>-    bool screenHasInvertedColors();
</del><ins>+int screenDepth(Widget*);
+int screenDepthPerComponent(Widget*);
+bool screenIsMonochrome(Widget*);
</ins><span class="cx"> 
</span><del>-    FloatRect screenRect(Widget*);
-    FloatRect screenAvailableRect(Widget*);
</del><ins>+bool screenHasInvertedColors();
</ins><span class="cx"> 
</span><del>-    WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* widget = nullptr);
</del><ins>+FloatRect screenRect(Widget*);
+FloatRect screenAvailableRect(Widget*);
</ins><span class="cx"> 
</span><ins>+WEBCORE_EXPORT bool screenSupportsExtendedColor(Widget* = nullptr);
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><del>-    NSScreen *screenForWindow(NSWindow *);
-    NSScreen *screenForDisplayID(PlatformDisplayID);
</del><span class="cx"> 
</span><del>-    WEBCORE_EXPORT FloatRect toUserSpace(const NSRect&amp;, NSWindow *destination);
-    WEBCORE_EXPORT NSRect toDeviceSpace(const FloatRect&amp;, NSWindow *source);
</del><ins>+NSScreen *screen(NSWindow *);
+NSScreen *screen(PlatformDisplayID);
</ins><span class="cx"> 
</span><del>-    NSPoint flipScreenPoint(const NSPoint&amp;, NSScreen *);
</del><ins>+WEBCORE_EXPORT FloatRect toUserSpace(const NSRect&amp;, NSWindow *destination);
+WEBCORE_EXPORT NSRect toDeviceSpace(const FloatRect&amp;, NSWindow *source);
+
+NSPoint flipScreenPoint(const NSPoint&amp;, NSScreen *);
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    float screenPPIFactor();
-    WEBCORE_EXPORT FloatSize screenSize();
-    WEBCORE_EXPORT FloatSize availableScreenSize();
-    WEBCORE_EXPORT float screenScaleFactor(UIScreen * = nullptr);
</del><ins>+
+float screenPPIFactor();
+WEBCORE_EXPORT FloatSize screenSize();
+WEBCORE_EXPORT FloatSize availableScreenSize();
+WEBCORE_EXPORT float screenScaleFactor(UIScreen * = nullptr);
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // PlatformScreen_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.cpp        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -34,8 +34,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> DisplayRefreshMonitorClient::DisplayRefreshMonitorClient()
</span><del>-    : m_scheduled(false)
-    , m_displayIDIsSet(false)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsDisplayRefreshMonitorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitorClient.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,18 +23,17 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef DisplayRefreshMonitorClient_h
-#define DisplayRefreshMonitorClient_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformScreen.h&quot;
</span><ins>+#include &lt;wtf/Forward.h&gt;
</ins><span class="cx"> #include &lt;wtf/Optional.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class DisplayRefreshMonitor;
</span><del>-class DisplayRefreshMonitorManager;
</del><span class="cx"> 
</span><span class="cx"> class DisplayRefreshMonitorClient {
</span><span class="cx"> public:
</span><span class="lines">@@ -46,13 +45,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RefPtr&lt;DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(PlatformDisplayID) const = 0;
</span><span class="cx"> 
</span><del>-    PlatformDisplayID displayID() const { return m_displayID; }
-    bool hasDisplayID() const { return m_displayIDIsSet; }
-    void setDisplayID(PlatformDisplayID displayID)
-    {
-        m_displayID = displayID;
-        m_displayIDIsSet = true;
-    }
</del><ins>+    PlatformDisplayID displayID() const { return m_displayID.value(); }
+    bool hasDisplayID() const { return !!m_displayID; }
+    void setDisplayID(PlatformDisplayID displayID) { m_displayID = displayID; }
</ins><span class="cx"> 
</span><span class="cx">     void setIsScheduled(bool isScheduled) { m_scheduled = isScheduled; }
</span><span class="cx">     bool isScheduled() const { return m_scheduled; }
</span><span class="lines">@@ -60,13 +55,10 @@
</span><span class="cx">     void fireDisplayRefreshIfNeeded(double timestamp);
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    bool m_scheduled;
-    bool m_displayIDIsSet;
-    PlatformDisplayID m_displayID;
</del><ins>+    bool m_scheduled { false };
+    Optional&lt;PlatformDisplayID&gt; m_displayID;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerUpdaterh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerUpdater.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef GraphicsLayerUpdater_h
-#define GraphicsLayerUpdater_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;DisplayRefreshMonitorClient.h&quot;
</span><span class="cx"> #include &quot;PlatformScreen.h&quot;
</span><span class="lines">@@ -68,5 +67,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // GraphicsLayerUpdater_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformimagedecodersImageDecoderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/image-decoders/ImageDecoder.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -26,8 +26,7 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef ImageDecoder_h
-#define ImageDecoder_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;IntRect.h&quot;
</span><span class="cx"> #include &quot;ImageSource.h&quot;
</span><span class="lines">@@ -41,6 +40,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+using ColorProfile = Vector&lt;char&gt;;
+
</ins><span class="cx">     // ImageFrame represents the decoded image data.  This buffer is what all
</span><span class="cx">     // decoders write a single frame into.
</span><span class="cx">     class ImageFrame {
</span><span class="lines">@@ -411,5 +412,3 @@
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformEventFactoryMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef PlatformEventFactoryMac_h
-#define PlatformEventFactoryMac_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;PlatformKeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;PlatformMouseEvent.h&quot;
</span><span class="lines">@@ -40,16 +39,15 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; defined(__OBJC__)
</span><del>-// FIXME: This doesn't really belong here.
-WEBCORE_EXPORT IntPoint globalPoint(const NSPoint&amp; windowPoint, NSWindow *);
</del><span class="cx"> 
</span><del>-// FIXME: WebKit2 has a lot of code copy/pasted from PlatformEventFactoryMac in WebEventFactory. It should be carefully shared with WebCore.
-WEBCORE_EXPORT int windowsKeyCodeForKeyEvent(NSEvent*);
-WEBCORE_EXPORT String keyIdentifierForKeyEvent(NSEvent*);
-WEBCORE_EXPORT double eventTimeStampSince1970(NSEvent*);
</del><ins>+// FIXME: This function doesn't really belong in this header.
+WEBCORE_EXPORT NSPoint globalPoint(const NSPoint&amp; windowPoint, NSWindow *);
</ins><span class="cx"> 
</span><ins>+// FIXME: WebKit2 has a lot of code copied and pasted from PlatformEventFactoryMac in WebEventFactory. More of it should be shared with WebCore.
+WEBCORE_EXPORT int windowsKeyCodeForKeyEvent(NSEvent *);
+WEBCORE_EXPORT String keyIdentifierForKeyEvent(NSEvent *);
+WEBCORE_EXPORT double eventTimeStampSince1970(NSEvent *);
+
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // PlatformEventFactoryMac_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformEventFactoryMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -38,15 +38,15 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-IntPoint globalPoint(const NSPoint&amp; windowPoint, NSWindow *window)
</del><ins>+NSPoint globalPoint(const NSPoint&amp; windowPoint, NSWindow *window)
</ins><span class="cx"> {
</span><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
</span><del>-    return IntPoint(flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window)));
</del><ins>+    return flipScreenPoint([window convertBaseToScreen:windowPoint], screen(window));
</ins><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static IntPoint globalPointForEvent(NSEvent *event)
</del><ins>+static NSPoint globalPointForEvent(NSEvent *event)
</ins><span class="cx"> {
</span><span class="cx">     switch ([event type]) {
</span><span class="cx"> #if defined(__LP64__) &amp;&amp; __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 101003
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx">             return globalPoint([event locationInWindow], [event window]);
</span><span class="cx">         default:
</span><del>-            return IntPoint();
</del><ins>+            return { 0, 0 };
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -485,7 +485,7 @@
</span><span class="cx"> 
</span><span class="cx">         // PlatformMouseEvent
</span><span class="cx">         m_position = pointForEvent(event, windowView);
</span><del>-        m_globalPosition = globalPointForEvent(event);
</del><ins>+        m_globalPosition = IntPoint(globalPointForEvent(event));
</ins><span class="cx">         m_button = mouseButtonForEvent(event);
</span><span class="cx">         m_clickCount = clickCountForEvent(event);
</span><span class="cx"> 
</span><span class="lines">@@ -514,14 +514,14 @@
</span><span class="cx">     PlatformWheelEventBuilder(NSEvent *event, NSView *windowView)
</span><span class="cx">     {
</span><span class="cx">         // PlatformEvent
</span><del>-        m_type                              = PlatformEvent::Wheel;
-        m_modifiers                         = modifiersForEvent(event);
-        m_timestamp                         = eventTimeStampSince1970(event);
</del><ins>+        m_type = PlatformEvent::Wheel;
+        m_modifiers = modifiersForEvent(event);
+        m_timestamp = eventTimeStampSince1970(event);
</ins><span class="cx"> 
</span><span class="cx">         // PlatformWheelEvent
</span><del>-        m_position                          = pointForEvent(event, windowView);
-        m_globalPosition                    = globalPointForEvent(event);
-        m_granularity                       = ScrollByPixelWheelEvent;
</del><ins>+        m_position = pointForEvent(event, windowView);
+        m_globalPosition = IntPoint(globalPointForEvent(event));
+        m_granularity = ScrollByPixelWheelEvent;
</ins><span class="cx"> 
</span><span class="cx">         BOOL continuous;
</span><span class="cx">         wkGetWheelEventDeltas(event, &amp;m_deltaX, &amp;m_deltaY, &amp;continuous);
</span><span class="lines">@@ -535,10 +535,10 @@
</span><span class="cx">             m_deltaY *= static_cast&lt;float&gt;(Scrollbar::pixelsPerLineStep());
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        m_phase                             = phaseForEvent(event);
-        m_momentumPhase                     = momentumPhaseForEvent(event);
-        m_hasPreciseScrollingDeltas         = continuous;
-        m_directionInvertedFromDevice       = [event isDirectionInvertedFromDevice];
</del><ins>+        m_phase = phaseForEvent(event);
+        m_momentumPhase = momentumPhaseForEvent(event);
+        m_hasPreciseScrollingDeltas = continuous;
+        m_directionInvertedFromDevice = [event isDirectionInvertedFromDevice];
</ins><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -553,23 +553,23 @@
</span><span class="cx">     PlatformKeyboardEventBuilder(NSEvent *event)
</span><span class="cx">     {
</span><span class="cx">         // PlatformEvent
</span><del>-        m_type                              = isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
-        m_modifiers                         = modifiersForEvent(event);
-        m_timestamp                         = eventTimeStampSince1970(event);
</del><ins>+        m_type = isKeyUpEvent(event) ? PlatformEvent::KeyUp : PlatformEvent::KeyDown;
+        m_modifiers = modifiersForEvent(event);
+        m_timestamp = eventTimeStampSince1970(event);
</ins><span class="cx"> 
</span><span class="cx">         // PlatformKeyboardEvent
</span><del>-        m_text                              = textFromEvent(event);
-        m_unmodifiedText                    = unmodifiedTextFromEvent(event);
-        m_keyIdentifier                     = keyIdentifierForKeyEvent(event);
-        m_windowsVirtualKeyCode             = windowsKeyCodeForKeyEvent(event);
-        m_nativeVirtualKeyCode              = [event keyCode];
-        m_macCharCode                       = wkGetNSEventKeyChar(event);
</del><ins>+        m_text = textFromEvent(event);
+        m_unmodifiedText = unmodifiedTextFromEvent(event);
+        m_keyIdentifier = keyIdentifierForKeyEvent(event);
+        m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event);
+        m_nativeVirtualKeyCode = [event keyCode];
+        m_macCharCode = wkGetNSEventKeyChar(event);
</ins><span class="cx"> #pragma clang diagnostic push
</span><span class="cx"> #pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
</span><del>-        m_autoRepeat                        = ([event type] != NSFlagsChanged) &amp;&amp; [event isARepeat];
</del><ins>+        m_autoRepeat = [event type] != NSFlagsChanged &amp;&amp; [event isARepeat];
</ins><span class="cx"> #pragma clang diagnostic pop
</span><del>-        m_isKeypad                          = isKeypadEvent(event);
-        m_isSystemKey                       = false; // SystemKey is always false on the Mac.
</del><ins>+        m_isKeypad = isKeypadEvent(event);
+        m_isSystemKey = false; // SystemKey is always false on the Mac.
</ins><span class="cx"> 
</span><span class="cx">         // Always use 13 for Enter/Return -- we don't want to use AppKit's different character for Enter.
</span><span class="cx">         if (m_windowsVirtualKeyCode == VK_RETURN) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPlatformScreenMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebCore/platform/mac/PlatformScreenMac.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #import &quot;FloatRect.h&quot;
</span><span class="cx"> #import &quot;FrameView.h&quot;
</span><span class="cx"> #import &quot;HostWindow.h&quot;
</span><del>-
</del><span class="cx"> #import &lt;ColorSync/ColorSync.h&gt;
</span><span class="cx"> 
</span><span class="cx"> extern &quot;C&quot; {
</span><span class="lines">@@ -40,102 +39,99 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static PlatformDisplayID displayIDFromScreen(NSScreen *screen)
-{
-    return (PlatformDisplayID)[[[screen deviceDescription] objectForKey:@&quot;NSScreenNumber&quot;] intValue];
-}
-
</del><span class="cx"> // These functions scale between screen and page coordinates because JavaScript/DOM operations
</span><span class="cx"> // assume that the screen and the page share the same coordinate system.
</span><span class="cx"> 
</span><del>-static PlatformDisplayID displayFromWidget(Widget* widget)
</del><ins>+static PlatformDisplayID displayID(NSScreen *screen)
</ins><span class="cx"> {
</span><ins>+    return [[[screen deviceDescription] objectForKey:@&quot;NSScreenNumber&quot;] intValue];
+}
+
+static PlatformDisplayID displayID(Widget* widget)
+{
</ins><span class="cx">     if (!widget)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    FrameView* view = widget-&gt;root();
</del><ins>+    auto* view = widget-&gt;root();
</ins><span class="cx">     if (!view)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    return view-&gt;hostWindow()-&gt;displayID();
</del><ins>+    auto* hostWindow = view-&gt;hostWindow();
+    if (!hostWindow)
+        return 0;
+
+    return hostWindow-&gt;displayID();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NSScreen *screenForWidget(Widget* widget, NSWindow *window)
</del><ins>+// Screen containing the menubar.
+static NSScreen *firstScreen()
</ins><span class="cx"> {
</span><del>-    // Widget is in an NSWindow, use its screen.
-    if (window)
-        return screenForWindow(window);
</del><ins>+    NSArray *screens = [NSScreen screens];
+    if (![screens count])
+        return nil;
+    return [screens objectAtIndex:0];
+}
</ins><span class="cx"> 
</span><del>-    // Didn't get an NSWindow; probably WebKit2. Try using the Widget's display ID.
-    if (NSScreen *screen = screenForDisplayID(displayFromWidget(widget)))
-        return screen;
</del><ins>+static NSWindow *window(Widget* widget)
+{
+    if (!widget)
+        return nil;
+    return widget-&gt;platformWidget().window;
+}
</ins><span class="cx"> 
</span><del>-    // Widget's window is offscreen, or no screens. Fall back to the first screen if available.
-    return screenForWindow(nil);
</del><ins>+static NSScreen *screen(Widget* widget)
+{
+    // If the widget is in a window, use that, otherwise use the display ID from the host window.
+    // First case is for when the NSWindow is in the same process, second case for when it's not.
+    if (auto screenFromWindow = window(widget).screen)
+        return screenFromWindow;
+    return screen(displayID(widget));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int screenDepth(Widget* widget)
</span><span class="cx"> {
</span><del>-    NSWindow *window = widget ? [widget-&gt;platformWidget() window] : nil;
-    NSScreen *screen = screenForWidget(widget, window);
-    return NSBitsPerPixelFromDepth(screen.depth);
</del><ins>+    return NSBitsPerPixelFromDepth(screen(widget).depth);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> int screenDepthPerComponent(Widget* widget)
</span><span class="cx"> {
</span><del>-    NSWindow *window = widget ? [widget-&gt;platformWidget() window] : nil;
-    NSScreen *screen = screenForWidget(widget, window);
-    return NSBitsPerSampleFromDepth(screen.depth);
</del><ins>+    return NSBitsPerSampleFromDepth(screen(widget).depth);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool screenIsMonochrome(Widget*)
</span><span class="cx"> {
</span><del>-    // At the moment this is a system-wide accessibility setting,
-    // so we don't need to check the screen we're using.
</del><ins>+    // This is a system-wide accessibility setting, same on all screens.
</ins><span class="cx">     return CGDisplayUsesForceToGray();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool screenHasInvertedColors()
</span><span class="cx"> {
</span><del>-    // At the moment this is a system-wide accessibility setting,
-    // so we don't need to check the screen we're using.
</del><ins>+    // This is a system-wide accessibility setting, same on all screens.
</ins><span class="cx">     return CGDisplayUsesInvertedPolarity();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatRect screenRect(Widget* widget)
</span><span class="cx"> {
</span><del>-    NSWindow *window = widget ? [widget-&gt;platformWidget() window] : nil;
-    NSScreen *screen = screenForWidget(widget, window);
-    return toUserSpace([screen frame], window);
</del><ins>+    return toUserSpace([screen(widget) frame], window(widget));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatRect screenAvailableRect(Widget* widget)
</span><span class="cx"> {
</span><del>-    NSWindow *window = widget ? [widget-&gt;platformWidget() window] : nil;
-    NSScreen *screen = screenForWidget(widget, window);
-    return toUserSpace([screen visibleFrame], window);
</del><ins>+    return toUserSpace([screen(widget) visibleFrame], window(widget));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-NSScreen *screenForWindow(NSWindow *window)
</del><ins>+NSScreen *screen(NSWindow *window)
</ins><span class="cx"> {
</span><del>-    NSScreen *screen = [window screen]; // nil if the window is off-screen
-    if (screen)
-        return screen;
-
-    NSArray *screens = [NSScreen screens];
-    if ([screens count] &gt; 0)
-        return [screens objectAtIndex:0]; // screen containing the menubar
-
-    return nil;
</del><ins>+    return [window screen] ?: firstScreen();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-NSScreen *screenForDisplayID(PlatformDisplayID displayID)
</del><ins>+NSScreen *screen(PlatformDisplayID displayID)
</ins><span class="cx"> {
</span><span class="cx">     for (NSScreen *screen in [NSScreen screens]) {
</span><del>-        if (displayIDFromScreen(screen) == displayID)
</del><ins>+        if (WebCore::displayID(screen) == displayID)
</ins><span class="cx">             return screen;
</span><span class="cx">     }
</span><del>-    return nil;
</del><ins>+    return firstScreen();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool screenSupportsExtendedColor(Widget* widget)
</span><span class="lines">@@ -147,19 +143,14 @@
</span><span class="cx">     if (!widget)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    NSWindow *window = [widget-&gt;platformWidget() window];
-    NSScreen *screen = screenForWidget(widget, window);
-    CGColorSpaceRef colorSpace = screen.colorSpace.CGColorSpace;
</del><ins>+    auto colorSpace = screen(widget).colorSpace.CGColorSpace;
</ins><span class="cx"> 
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101200
</span><span class="cx">     return CGColorSpaceIsWideGamutRGB(colorSpace);
</span><span class="cx"> #else
</span><del>-    bool isWideGamut = false;
-    RetainPtr&lt;CFDataRef&gt; iccData = adoptCF(CGColorSpaceCopyICCProfile(colorSpace));
-    RetainPtr&lt;ColorSyncProfileRef&gt; profile = adoptCF(ColorSyncProfileCreate(iccData.get(), NULL));
-    if (profile)
-        isWideGamut = ColorSyncProfileIsWideGamut(profile.get());
-    return isWideGamut;
</del><ins>+    auto iccData = adoptCF(CGColorSpaceCopyICCProfile(colorSpace));
+    auto profile = adoptCF(ColorSyncProfileCreate(iccData.get(), nullptr));
+    return profile &amp;&amp; ColorSyncProfileIsWideGamut(profile.get());
</ins><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="lines">@@ -167,14 +158,14 @@
</span><span class="cx"> FloatRect toUserSpace(const NSRect&amp; rect, NSWindow *destination)
</span><span class="cx"> {
</span><span class="cx">     FloatRect userRect = rect;
</span><del>-    userRect.setY(NSMaxY([screenForWindow(destination) frame]) - (userRect.y() + userRect.height())); // flip
</del><ins>+    userRect.setY(NSMaxY([screen(destination) frame]) - (userRect.y() + userRect.height())); // flip
</ins><span class="cx">     return userRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> NSRect toDeviceSpace(const FloatRect&amp; rect, NSWindow *source)
</span><span class="cx"> {
</span><span class="cx">     FloatRect deviceRect = rect;
</span><del>-    deviceRect.setY(NSMaxY([screenForWindow(source) frame]) - (deviceRect.y() + deviceRect.height())); // flip
</del><ins>+    deviceRect.setY(NSMaxY([screen(source) frame]) - (deviceRect.y() + deviceRect.height())); // flip
</ins><span class="cx">     return deviceRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-05-26  Darin Adler  &lt;darin@apple.com&gt;
+
+        Media queries and platform screen modernization and streamlining
+        https://bugs.webkit.org/show_bug.cgi?id=158067
+
+        Reviewed by Alex Christensen.
+
+        * WebView/WebFrame.mm:
+        (-[WebFrame _dragSourceEndedAt:operation:]): Updated to use the new version of
+        globalPoint, which returns an NSPoint.
+
</ins><span class="cx"> 2016-05-26  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Build fix
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebFramemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebFrame.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -976,7 +976,7 @@
</span><span class="cx">     if (!view)
</span><span class="cx">         return;
</span><span class="cx">     // FIXME: These are fake modifier keys here, but they should be real ones instead.
</span><del>-    PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view-&gt;platformWidget() window]),
</del><ins>+    PlatformMouseEvent event(IntPoint(windowLoc), IntPoint(globalPoint(windowLoc, [view-&gt;platformWidget() window])),
</ins><span class="cx">         LeftButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime(), WebCore::ForceAtClick);
</span><span class="cx">     _private-&gt;coreFrame-&gt;eventHandler().dragSourceEndedAt(event, (DragOperation)operation);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-05-26  Darin Adler  &lt;darin@apple.com&gt;
+
+        Media queries and platform screen modernization and streamlining
+        https://bugs.webkit.org/show_bug.cgi?id=158067
+
+        Reviewed by Alex Christensen.
+
+        * Shared/mac/WebEventFactory.mm:
+        (WebKit::screenForWindow): Deleted.
+        (WebKit::flipScreenPoint): Deleted.
+        (WebKit::globalPoint): Deleted.
+        (WebKit::globalPointForEvent): Use globalPoint function from WebCore so we don't need
+        copies of everything in here.
+
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::windowDidChangeScreen): Removed unneeded type cast.
+        (WebKit::WebViewImpl::draggedImage): Added type cast since globalPoint now returns an
+        NSPoint rather than an IntPoint.
+
+        * UIProcess/WebPageProxy.h: Use pragma once. Add a WebCore prefix to a use of
+        PlatformDisplayID, since that is now inside the WebCore namespace.
+        * WebProcess/WebCoreSupport/WebChromeClient.h: Ditto.
+        * WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h: Ditto.
+        * WebProcess/WebPage/DrawingArea.h: Ditto.
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h: Ditto.
+
</ins><span class="cx"> 2016-05-26  Gyuyoung Kim  &lt;gyuyoung.kim@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Purge PassRefPtr in Modules/battery
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacWebEventFactorymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/Shared/mac/WebEventFactory.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -137,34 +137,6 @@
</span><span class="cx"> #pragma clang diagnostic pop
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static NSScreen *screenForWindow(NSWindow *window)
-{
-    NSScreen *screen = [window screen]; // nil if the window is off-screen
-    if (screen)
-        return screen;
-    
-    NSArray *screens = [NSScreen screens];
-    if ([screens count] &gt; 0)
-        return [screens objectAtIndex:0]; // screen containing the menubar
-    
-    return nil;
-}
-
-static NSPoint flipScreenPoint(const NSPoint&amp; screenPoint, NSScreen *screen)
-{
-    NSPoint flippedPoint = screenPoint;
-    flippedPoint.y = NSMaxY([screen frame]) - flippedPoint.y;
-    return flippedPoint;
-}
-
-static NSPoint globalPoint(const NSPoint&amp; windowPoint, NSWindow *window)
-{
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-    return flipScreenPoint([window convertBaseToScreen:windowPoint], screenForWindow(window));
-#pragma clang diagnostic pop
-}
-
</del><span class="cx"> static NSPoint globalPointForEvent(NSEvent *event)
</span><span class="cx"> {
</span><span class="cx">     switch ([event type]) {
</span><span class="lines">@@ -187,7 +159,7 @@
</span><span class="cx">     case NSRightMouseUp:
</span><span class="cx">     case NSScrollWheel:
</span><span class="cx"> #pragma clang diagnostic pop
</span><del>-        return globalPoint([event locationInWindow], [event window]);
</del><ins>+        return WebCore::globalPoint([event locationInWindow], [event window]);
</ins><span class="cx">     default:
</span><span class="cx">         return NSZeroPoint;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -1089,7 +1089,7 @@
</span><span class="cx"> void WebViewImpl::windowDidChangeScreen()
</span><span class="cx"> {
</span><span class="cx">     NSWindow *window = m_targetWindowForMovePreparation ? m_targetWindowForMovePreparation : m_view.window;
</span><del>-    m_page-&gt;windowScreenDidChange((PlatformDisplayID)[[[[window screen] deviceDescription] objectForKey:@&quot;NSScreenNumber&quot;] intValue]);
</del><ins>+    m_page-&gt;windowScreenDidChange([[[[window screen] deviceDescription] objectForKey:@&quot;NSScreenNumber&quot;] intValue]);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebViewImpl::windowDidChangeLayerHosting()
</span><span class="lines">@@ -2778,7 +2778,7 @@
</span><span class="cx">     // Prevent queued mouseDragged events from coming after the drag and fake mouseUp event.
</span><span class="cx">     m_ignoresMouseDraggedEvents = true;
</span><span class="cx"> 
</span><del>-    m_page-&gt;dragEnded(WebCore::IntPoint(windowMouseLoc), WebCore::globalPoint(windowMouseLoc, m_view.window), operation);
</del><ins>+    m_page-&gt;dragEnded(WebCore::IntPoint(windowMouseLoc), WebCore::IntPoint(WebCore::globalPoint(windowMouseLoc, m_view.window)), operation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static WebCore::DragApplicationFlags applicationFlagsForDrag(NSView *view, id &lt;NSDraggingInfo&gt; draggingInfo)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebPageProxy_h
-#define WebPageProxy_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><span class="cx"> #include &quot;APISession.h&quot;
</span><span class="lines">@@ -666,7 +665,7 @@
</span><span class="cx">     float deviceScaleFactor() const;
</span><span class="cx">     void setIntrinsicDeviceScaleFactor(float);
</span><span class="cx">     void setCustomDeviceScaleFactor(float);
</span><del>-    void windowScreenDidChange(PlatformDisplayID);
</del><ins>+    void windowScreenDidChange(WebCore::PlatformDisplayID);
</ins><span class="cx"> 
</span><span class="cx">     void setUseFixedLayout(bool);
</span><span class="cx">     void setFixedLayoutSize(const WebCore::IntSize&amp;);
</span><span class="lines">@@ -1831,5 +1830,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // WebPageProxy_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -24,8 +24,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef WebChromeClient_h
-#define WebChromeClient_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &lt;WebCore/ChromeClient.h&gt;
</span><span class="lines">@@ -210,7 +209,7 @@
</span><span class="cx">     bool adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags) override;
</span><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-    RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(PlatformDisplayID) const override;
</del><ins>+    RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(WebCore::PlatformDisplayID) const override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     CompositingTriggerFlags allowedCompositingTriggers() const override
</span><span class="lines">@@ -346,5 +345,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // WebChromeClient_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCocoaRemoteLayerTreeDisplayRefreshMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/Cocoa/RemoteLayerTreeDisplayRefreshMonitor.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef RemoteLayerTreeDisplayRefreshMonitor_h
-#define RemoteLayerTreeDisplayRefreshMonitor_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx"> 
</span><span class="lines">@@ -35,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> class RemoteLayerTreeDisplayRefreshMonitor : public WebCore::DisplayRefreshMonitor {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;RemoteLayerTreeDisplayRefreshMonitor&gt; create(PlatformDisplayID displayID, RemoteLayerTreeDrawingArea&amp; drawingArea)
</del><ins>+    static Ref&lt;RemoteLayerTreeDisplayRefreshMonitor&gt; create(WebCore::PlatformDisplayID displayID, RemoteLayerTreeDrawingArea&amp; drawingArea)
</ins><span class="cx">     {
</span><span class="cx">         return adoptRef(*new RemoteLayerTreeDisplayRefreshMonitor(displayID, drawingArea));
</span><span class="cx">     }
</span><span class="lines">@@ -47,7 +46,7 @@
</span><span class="cx">     void didUpdateLayers();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    explicit RemoteLayerTreeDisplayRefreshMonitor(PlatformDisplayID, RemoteLayerTreeDrawingArea&amp;);
</del><ins>+    explicit RemoteLayerTreeDisplayRefreshMonitor(WebCore::PlatformDisplayID, RemoteLayerTreeDrawingArea&amp;);
</ins><span class="cx"> 
</span><span class="cx">     WeakPtr&lt;RemoteLayerTreeDrawingArea&gt; m_drawingArea;
</span><span class="cx"> };
</span><span class="lines">@@ -55,5 +54,3 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-
-#endif // RemoteLayerTreeDisplayRefreshMonitor_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef DrawingArea_h
-#define DrawingArea_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;DrawingAreaInfo.h&quot;
</span><span class="cx"> #include &quot;LayerTreeContext.h&quot;
</span><span class="lines">@@ -39,6 +38,7 @@
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #include &lt;wtf/TypeCasts.h&gt;
</span><ins>+#include &lt;wtf/Vector.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace IPC {
</span><span class="cx"> class Connection;
</span><span class="lines">@@ -111,7 +111,7 @@
</span><span class="cx">     virtual void scheduleCompositingLayerFlushImmediately() = 0;
</span><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-    virtual RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(PlatformDisplayID);
</del><ins>+    virtual RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(WebCore::PlatformDisplayID);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
</span><span class="lines">@@ -182,5 +182,3 @@
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebKit::ToValueTypeName) \
</span><span class="cx">     static bool isType(const WebKit::DrawingArea&amp; area) { return area.type() == WebKit::AreaType; } \
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span><del>-
-#endif // DrawingArea_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (201440 => 201441)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2016-05-26 23:53:25 UTC (rev 201440)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2016-05-27 00:05:24 UTC (rev 201441)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef RemoteLayerTreeDrawingArea_h
-#define RemoteLayerTreeDrawingArea_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><span class="cx"> #include &quot;DrawingArea.h&quot;
</span><span class="cx"> #include &quot;GraphicsLayerCARemote.h&quot;
</span><span class="lines">@@ -74,7 +73,7 @@
</span><span class="cx"> 
</span><span class="cx">     void addTransactionCallbackID(uint64_t callbackID) override;
</span><span class="cx"> 
</span><del>-    RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(PlatformDisplayID) override;
</del><ins>+    RefPtr&lt;WebCore::DisplayRefreshMonitor&gt; createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override;
</ins><span class="cx">     void willDestroyDisplayRefreshMonitor(WebCore::DisplayRefreshMonitor*);
</span><span class="cx"> 
</span><span class="cx">     bool shouldUseTiledBackingForFrameView(const WebCore::FrameView*) override;
</span><span class="lines">@@ -179,5 +178,3 @@
</span><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_DRAWING_AREA(RemoteLayerTreeDrawingArea, DrawingAreaTypeRemoteLayerTree)
</span><del>-
-#endif // RemoteLayerTreeDrawingArea_h
</del></span></pre>
</div>
</div>

</body>
</html>