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

Unified Diff: Source/core/css/ViewportStyle.h

Issue 78963008: Moved remaining legacy viewport tests to unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/ViewportStyle.h
diff --git a/Source/core/css/ViewportStyle.h b/Source/core/css/ViewportStyle.h
index 903ad0fe81c180def8cb398c337f5fc8e1224d4e..44d42d5dc81a6a92af1362d79d52c3e930dbb674 100644
--- a/Source/core/css/ViewportStyle.h
+++ b/Source/core/css/ViewportStyle.h
@@ -28,11 +28,36 @@
#include "wtf/text/WTFString.h"
+namespace blink {
+namespace FrameTestHelpers {
+class ReplaceViewportUAStylesheet;
+}
+}
+
namespace WebCore {
class ViewportStyle {
public:
- static String viewportStyleSheet();
+ static String viewportStyleSheet()
+ {
+ if (!styleOverrideString().isEmpty())
+ return styleOverrideString();
+
+ return platformStyleSheet();
+ }
+
+private:
+ // Implemented in platform-dependent files to return the viewport style to
+ // use on specific platforms.
+ static String platformStyleSheet();
+
+ // Allows tests to override the platform specific stylesheet
+ friend class blink::FrameTestHelpers::ReplaceViewportUAStylesheet;
+ static String& styleOverrideString()
+ {
+ static String &styleString = *new String();
+ return styleString;
+ }
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698