summaryrefslogtreecommitdiff
path: root/Source/WebCore/page/WindowFeatures.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/page/WindowFeatures.h')
-rw-r--r--Source/WebCore/page/WindowFeatures.h66
1 files changed, 44 insertions, 22 deletions
diff --git a/Source/WebCore/page/WindowFeatures.h b/Source/WebCore/page/WindowFeatures.h
index 0cb6d9ff9..43a0b1ba2 100644
--- a/Source/WebCore/page/WindowFeatures.h
+++ b/Source/WebCore/page/WindowFeatures.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2007, 2010, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2007, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -29,9 +29,7 @@
#ifndef WindowFeatures_h
#define WindowFeatures_h
-#include <functional>
-#include <wtf/Optional.h>
-#include <wtf/Vector.h>
+#include <wtf/HashMap.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -39,28 +37,52 @@ namespace WebCore {
class FloatRect;
struct WindowFeatures {
- Optional<float> x;
- Optional<float> y;
- Optional<float> width;
- Optional<float> height;
+ WindowFeatures()
+ : xSet(false)
+ , ySet(false)
+ , widthSet(false)
+ , heightSet(false)
+ , menuBarVisible(true)
+ , statusBarVisible(true)
+ , toolBarVisible(true)
+ , locationBarVisible(true)
+ , scrollbarsVisible(true)
+ , resizable(true)
+ , fullscreen(false)
+ , dialog(false)
+ {
+ }
+ explicit WindowFeatures(const String& windowFeaturesString);
+ WindowFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect);
- bool menuBarVisible { true };
- bool statusBarVisible { true };
- bool toolBarVisible { true };
- bool locationBarVisible { true };
- bool scrollbarsVisible { true };
- bool resizable { true };
+ float x;
+ bool xSet;
+ float y;
+ bool ySet;
+ float width;
+ bool widthSet;
+ float height;
+ bool heightSet;
- bool fullscreen { false };
- bool dialog { false };
+ bool menuBarVisible;
+ bool statusBarVisible;
+ bool toolBarVisible;
+ bool locationBarVisible;
+ bool scrollbarsVisible;
+ bool resizable;
- Vector<String> additionalFeatures;
-};
+ bool fullscreen;
+ bool dialog;
-WindowFeatures parseWindowFeatures(StringView windowFeaturesString);
-WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect);
+ Vector<String> additionalFeatures;
-void processFeaturesString(StringView features, std::function<void(StringView type, StringView value)> callback);
+private:
+ typedef HashMap<String, String> DialogFeaturesMap;
+ static void parseDialogFeatures(const String&, HashMap<String, String>&);
+ static bool boolFeature(const DialogFeaturesMap&, const char* key, bool defaultValue = false);
+ static float floatFeature(const DialogFeaturesMap&, const char* key, float min, float max, float defaultValue);
+ void setWindowFeature(const String& keyString, const String& valueString);
+};
} // namespace WebCore