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.h71
1 files changed, 23 insertions, 48 deletions
diff --git a/Source/WebCore/page/WindowFeatures.h b/Source/WebCore/page/WindowFeatures.h
index 43a0b1ba2..d46a75a02 100644
--- a/Source/WebCore/page/WindowFeatures.h
+++ b/Source/WebCore/page/WindowFeatures.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2007, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2007, 2010, 2016 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 Computer, Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple 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.
*
@@ -26,10 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WindowFeatures_h
-#define WindowFeatures_h
+#pragma once
-#include <wtf/HashMap.h>
+#include <functional>
+#include <wtf/Optional.h>
+#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
@@ -37,53 +38,27 @@ namespace WebCore {
class FloatRect;
struct WindowFeatures {
- 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);
+ std::optional<float> x;
+ std::optional<float> y;
+ std::optional<float> width;
+ std::optional<float> height;
- float x;
- bool xSet;
- float y;
- bool ySet;
- float width;
- bool widthSet;
- float height;
- bool heightSet;
+ bool menuBarVisible { true };
+ bool statusBarVisible { true };
+ bool toolBarVisible { true };
+ bool locationBarVisible { true };
+ bool scrollbarsVisible { true };
+ bool resizable { true };
- bool menuBarVisible;
- bool statusBarVisible;
- bool toolBarVisible;
- bool locationBarVisible;
- bool scrollbarsVisible;
- bool resizable;
-
- bool fullscreen;
- bool dialog;
+ bool fullscreen { false };
+ bool dialog { false };
Vector<String> additionalFeatures;
-
-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
+WindowFeatures parseWindowFeatures(StringView windowFeaturesString);
+WindowFeatures parseDialogFeatures(const String& dialogFeaturesString, const FloatRect& screenAvailableRect);
-#endif // WindowFeatures_h
+void processFeaturesString(StringView features, std::function<void(StringView type, StringView value)> callback);
+
+} // namespace WebCore