WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-56482-20110317125443.patch (text/plain), 11.07 KB, created by
Robert Hogan
on 2011-03-17 05:54:48 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Robert Hogan
Created:
2011-03-17 05:54:48 PDT
Size:
11.07 KB
patch
obsolete
>Subversion Revision: 81046 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 782b8dace822ba4323f768ab45b7f6f3dabbd944..d75125edb5380ee14a5d00c9ed4e0b68adb2fb7d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,47 @@ >+2011-03-16 Robert Hogan <robert@webkit.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Make CSSMedia queries pass through Chrome and ChromeClient. >+ >+ Clients may want control over the information returned to CSS media queries, >+ particularly in cases where they are masking or manipulating similar information >+ provided to the Screen and Window DOM objects. >+ >+ So instead of querying the user's environment directly make the >+ CSS mediaquery evaluator pass the calls through Chrome and ChromeClient >+ so that ports can opt to delegate control over the returned values >+ to the client. >+ >+ See also https://trac.webkit.org/wiki/Fingerprinting#i.CSSMediaQueries >+ >+ https://bugs.webkit.org/show_bug.cgi?id=56482 >+ >+ No new tests - no new functionality. >+ >+ * css/MediaQueryEvaluator.cpp: >+ (WebCore::colorMediaFeatureEval): >+ (WebCore::monochromeMediaFeatureEval): >+ (WebCore::orientationMediaFeatureEval): >+ (WebCore::aspect_ratioMediaFeatureEval): >+ (WebCore::device_aspect_ratioMediaFeatureEval): >+ (WebCore::device_heightMediaFeatureEval): >+ (WebCore::device_widthMediaFeatureEval): >+ (WebCore::heightMediaFeatureEval): >+ (WebCore::widthMediaFeatureEval): >+ * page/Chrome.cpp: >+ (WebCore::Chrome::screenDepthPerComponent): >+ (WebCore::Chrome::screenIsMonochrome): >+ (WebCore::Chrome::screenIsLandscape): >+ (WebCore::Chrome::screenRect): >+ (WebCore::Chrome::screenAvailableRect): >+ * page/Chrome.h: >+ * page/ChromeClient.h: >+ (WebCore::ChromeClient::screenDepthPerComponent): >+ (WebCore::ChromeClient::screenIsMonochrome): >+ (WebCore::ChromeClient::screenRect): >+ (WebCore::ChromeClient::screenAvailableRect): >+ > 2011-03-11 David Hyatt <hyatt@apple.com> > > Reviewed by Simon Fraser. >diff --git a/Source/WebCore/css/MediaQueryEvaluator.cpp b/Source/WebCore/css/MediaQueryEvaluator.cpp >index fa2e0997be5d9dec408cb71c676cb3a4cd4e02ec..7110c41438f3e05304481293bc3caf4769dd850c 100644 >--- a/Source/WebCore/css/MediaQueryEvaluator.cpp >+++ b/Source/WebCore/css/MediaQueryEvaluator.cpp >@@ -219,7 +219,7 @@ static bool numberValue(CSSValue* value, float& result) > > static bool colorMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) > { >- int bitsPerComponent = screenDepthPerComponent(frame->page()->mainFrame()->view()); >+ int bitsPerComponent = frame->page()->chrome()->screenDepthPerComponent(); > float number; > if (value) > return numberValue(value, number) && compareValue(bitsPerComponent, static_cast<int>(number), op); >@@ -229,7 +229,7 @@ static bool colorMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, M > > static bool monochromeMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op) > { >- if (!screenIsMonochrome(frame->page()->mainFrame()->view())) { >+ if (!frame->page()->chrome()->screenIsMonochrome()) { > if (value) { > float number; > return numberValue(value, number) && compareValue(0, static_cast<int>(number), op); >@@ -246,10 +246,7 @@ static bool orientationMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fr > if (!value) > return false; > >- FrameView* view = frame->view(); >- int width = view->layoutWidth(); >- int height = view->layoutHeight(); >- if (width > height) // Square viewport is portrait >+ if (frame->page()->chrome()->screenIsLandscape()) > return "landscape" == static_cast<CSSPrimitiveValue*>(value)->getStringValue(); > return "portrait" == static_cast<CSSPrimitiveValue*>(value)->getStringValue(); > } >@@ -257,13 +254,11 @@ static bool orientationMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fr > static bool aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) > { > if (value) { >- FrameView* view = frame->view(); >- int width = view->layoutWidth(); >- int height = view->layoutHeight(); >+ FloatRect sg = frame->page()->chrome()->pageRect(); > int h = 0; > int v = 0; > if (parseAspectRatio(value, h, v)) >- return v != 0 && compareValue(width * v, height * h, op); >+ return v && compareValue(static_cast<int>(sg.width()) * v, static_cast<int>(sg.height()) * h, op); > return false; > } > >@@ -275,11 +270,11 @@ static bool aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* f > static bool device_aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op) > { > if (value) { >- FloatRect sg = screenRect(frame->page()->mainFrame()->view()); >+ FloatRect sg = frame->page()->chrome()->screenRect(); > int h = 0; > int v = 0; > if (parseAspectRatio(value, h, v)) >- return v != 0 && compareValue(static_cast<int>(sg.width()) * v, static_cast<int>(sg.height()) * h, op); >+ return v && compareValue(static_cast<int>(sg.width()) * v, static_cast<int>(sg.height()) * h, op); > return false; > } > >@@ -309,7 +304,7 @@ static bool gridMediaFeatureEval(CSSValue* value, RenderStyle*, Frame*, MediaFea > static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op) > { > if (value) { >- FloatRect sg = screenRect(frame->page()->mainFrame()->view()); >+ FloatRect sg = frame->page()->chrome()->screenRect(); > RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); > return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.height()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); > } >@@ -321,7 +316,7 @@ static bool device_heightMediaFeatureEval(CSSValue* value, RenderStyle* style, F > static bool device_widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* frame, MediaFeaturePrefix op) > { > if (value) { >- FloatRect sg = screenRect(frame->page()->mainFrame()->view()); >+ FloatRect sg = frame->page()->chrome()->screenRect(); > RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); > return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.width()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); > } >@@ -334,9 +329,10 @@ static bool heightMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* f > { > FrameView* view = frame->view(); > RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); >+ FloatRect sg = frame->page()->chrome()->pageRect(); > > if (value) >- return value->isPrimitiveValue() && compareValue(view->layoutHeight(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); >+ return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.height()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); > > return view->layoutHeight() != 0; > } >@@ -345,9 +341,10 @@ static bool widthMediaFeatureEval(CSSValue* value, RenderStyle* style, Frame* fr > { > FrameView* view = frame->view(); > RenderStyle* rootStyle = frame->document()->documentElement()->renderStyle(); >+ FloatRect sg = frame->page()->chrome()->pageRect(); > > if (value) >- return value->isPrimitiveValue() && compareValue(view->layoutWidth(), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); >+ return value->isPrimitiveValue() && compareValue(static_cast<int>(sg.width()), static_cast<CSSPrimitiveValue*>(value)->computeLengthInt(style, rootStyle), op); > > return view->layoutWidth() != 0; > } >diff --git a/Source/WebCore/page/Chrome.cpp b/Source/WebCore/page/Chrome.cpp >index 5881d5ea45871850ffaad331431477c5078caff7..1ec8c9308a3cd480e2078249b5c2ce95b88bd8cc 100644 >--- a/Source/WebCore/page/Chrome.cpp >+++ b/Source/WebCore/page/Chrome.cpp >@@ -27,6 +27,7 @@ > #include "FileList.h" > #include "FloatRect.h" > #include "Frame.h" >+#include "FrameView.h" > #include "FrameTree.h" > #include "Geolocation.h" > #include "HTMLFormElement.h" >@@ -36,6 +37,7 @@ > #include "InspectorInstrumentation.h" > #include "Page.h" > #include "PageGroupLoadDeferrer.h" >+#include "PlatformScreen.h" > #include "RenderObject.h" > #include "ResourceHandle.h" > #include "ScriptController.h" >@@ -109,6 +111,37 @@ PlatformPageClient Chrome::platformPageClient() const > return m_client->platformPageClient(); > } > >+int Chrome::screenDepthPerComponent() const >+{ >+ int bitsPerComponent = WebCore::screenDepthPerComponent(m_page->mainFrame()->view()); >+ return m_client->screenDepthPerComponent(bitsPerComponent); >+} >+ >+bool Chrome::screenIsMonochrome() const >+{ >+ bool isMonochrome = WebCore::screenIsMonochrome(m_page->mainFrame()->view()); >+ return m_client->screenIsMonochrome(isMonochrome); >+} >+ >+bool Chrome::screenIsLandscape() const >+{ >+ int width = pageRect().width(); >+ int height = pageRect().height(); >+ return (width > height); // Square viewport is portrait >+} >+ >+FloatRect Chrome::screenRect() const >+{ >+ FloatRect rect = WebCore::screenRect(m_page->mainFrame()->view()); >+ return m_client->screenRect(rect); >+} >+ >+FloatRect Chrome::screenAvailableRect() const >+{ >+ FloatRect rect = WebCore::screenAvailableRect(m_page->mainFrame()->view()); >+ return m_client->screenAvailableRect(rect); >+} >+ > void Chrome::contentsSizeChanged(Frame* frame, const IntSize& size) const > { > m_client->contentsSizeChanged(frame, size); >diff --git a/Source/WebCore/page/Chrome.h b/Source/WebCore/page/Chrome.h >index 9984a7cb981eb146df0c8f650ab57ac23b0da503..dec43cbcbcb3261bd71493c29d3201b90296f588 100644 >--- a/Source/WebCore/page/Chrome.h >+++ b/Source/WebCore/page/Chrome.h >@@ -81,6 +81,11 @@ namespace WebCore { > #if ENABLE(REQUEST_ANIMATION_FRAME) > virtual void scheduleAnimation(); > #endif >+ int screenDepthPerComponent() const; >+ bool screenIsMonochrome() const; >+ bool screenIsLandscape() const; >+ FloatRect screenRect() const; >+ FloatRect screenAvailableRect() const; > > void scrollRectIntoView(const IntRect&) const; > >diff --git a/Source/WebCore/page/ChromeClient.h b/Source/WebCore/page/ChromeClient.h >index fcce693d6b88f8af1a444175413ffa95332cb3e8..7d60a9842bf75617eb33c966765fb4b271997306 100644 >--- a/Source/WebCore/page/ChromeClient.h >+++ b/Source/WebCore/page/ChromeClient.h >@@ -80,6 +80,10 @@ namespace WebCore { > virtual FloatRect windowRect() = 0; > > virtual FloatRect pageRect() = 0; >+ int screenDepthPerComponent(int bitsPerComponent) { return bitsPerComponent; } >+ bool screenIsMonochrome(bool isMonochrome) { return isMonochrome; } >+ FloatRect screenRect(FloatRect rect) { return rect; } >+ FloatRect screenAvailableRect(FloatRect rect) { return rect; } > > virtual float scaleFactor() = 0; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 56482
:
85963
|
86050
|
86217