1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #include "config.h"
  27 
  28 #include "CookieStorage.h"
  29 #include "Color.h"
  30 #include "ChromiumBridge.h"
  31 #include "DragData.h"
  32 #include "DragImage.h"
  33 #include "Editor.h"
  34 #include "EventHandler.h"
  35 #include "EventLoop.h"
  36 #include "Font.h"
  37 #include "Frame.h"
  38 #include "FrameView.h"
  39 #include "GraphicsContext.h"
  40 #include "ImageBuffer.h"
  41 #include "NotImplemented.h"
  42 #include "RenderObject.h"
  43 #include "ResourceHandle.h"
  44 #include "SSLKeyGenerator.h"
  45 #include "SearchPopupMenuJava.h"
  46 #include "SmartReplace.h"
  47 
  48 namespace WebCore
  49 {
  50 
  51 //----- copy from editing\qt\SmartReplaceQt.cpp ---------//
  52 
  53 #if USE(JAVA_UNICODE)
  54 bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
  55 {
  56     if (WTF::Unicode::Java::isSpaceChar(uint32_t(c)))
  57         return true;
  58     if (!isPreviousCharacter && WTF::Unicode::isPunct(c))
  59         return true;
  60 
  61     if ((c >= 0x1100 && c <= (0x1100 + 256))          // Hangul Jamo (0x1100 - 0x11FF)
  62         || (c >= 0x2E80 && c <= (0x2E80 + 352))       // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
  63         || (c >= 0x2FF0 && c <= (0x2FF0 + 464))       // Ideograph Deseriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
  64         || (c >= 0x3200 && c <= (0x3200 + 29392))     // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
  65         || (c >= 0xAC00 && c <= (0xAC00 + 11183))     // Hangul Syllables (0xAC00 - 0xD7AF)
  66         || (c >= 0xF900 && c <= (0xF900 + 352))       // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
  67         || (c >= 0xFE30 && c <= (0xFE30 + 32))        // CJK Compatibility From (0xFE30 - 0xFE4F)
  68         || (c >= 0xFF00 && c <= (0xFF00 + 240))       // Half/Full Width Form (0xFF00 - 0xFFEF)
  69         || (c >= 0x20000 && c <= (0x20000 + 0xA6D7))  // CJK Ideograph Exntension B
  70         || (c >= 0x2F800 && c <= (0x2F800 + 0x021E))) // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
  71        return true;
  72 
  73     const char prev[] = "([\"\'#$/-`{\0";
  74     const char next[] = ")].,;:?\'!\"%*-/}\0";
  75     const char* str = (isPreviousCharacter) ? prev : next;
  76     for (int i = 0; i < strlen(str); ++i) {
  77         if (str[i] == c)
  78           return true;
  79     }
  80 
  81     return false;
  82 }
  83 #endif
  84 
  85 // ---- CookieStorage.h ---- //
  86 void setCookieStoragePrivateBrowsingEnabled(bool)
  87 {
  88     notImplemented();
  89 }
  90 
  91 
  92 void getSupportedKeySizes(Vector<String>&)
  93 {
  94     notImplemented();
  95 }
  96 
  97 String signedPublicKeyAndChallengeString(unsigned, const String&, const URL&)
  98 {
  99     notImplemented();
 100     return String("signedPublicKeyAndChallengeString");
 101 }
 102 
 103 // ---- SearchPopupMenuJava.h ---- //
 104 
 105 SearchPopupMenuJava::SearchPopupMenuJava(PopupMenuClient* client)
 106     : m_popup(adoptRef(new PopupMenuJava(client)))
 107 {
 108 }
 109 
 110 PopupMenu* SearchPopupMenuJava::popupMenu()
 111 {
 112     return m_popup.get();
 113 }
 114 
 115 bool SearchPopupMenuJava::enabled()
 116 {
 117     return false;
 118 }
 119 
 120 void SearchPopupMenuJava::saveRecentSearches(const AtomicString&, const Vector<RecentSearch>&)
 121 {
 122     notImplemented();
 123 }
 124 
 125 void SearchPopupMenuJava::loadRecentSearches(const AtomicString&, Vector<RecentSearch>&)
 126 {
 127     notImplemented();
 128 }
 129 
 130 
 131 // ---- WebCore/page stubs ---- //
 132 
 133 // ---- Frame.h ---- //
 134 
 135 struct ScopedState {
 136     ScopedState(Frame* theFrame, RenderObject* theRenderer)
 137         : frame(theFrame)
 138         , renderer(theRenderer)
 139         , paintBehavior(frame->view()->paintBehavior())
 140         , backgroundColor(frame->view()->baseBackgroundColor())
 141     {
 142     }
 143 
 144     ~ScopedState()
 145     {
 146         if (renderer)
 147             renderer->updateDragState(false);
 148         frame->view()->setPaintBehavior(paintBehavior);
 149         frame->view()->setBaseBackgroundColor(backgroundColor);
 150         frame->view()->setNodeToDraw(0);
 151     }
 152 
 153     Frame* frame;
 154     RenderObject* renderer;
 155     PaintBehavior paintBehavior;
 156     Color backgroundColor;
 157 };
 158 
 159 // ---- WebCore/platform/graphics stubs ---- //
 160 
 161 // ---- Color.h ---- //
 162 
 163 Color focusRingColor()
 164 {
 165     notImplemented();
 166     return Color();
 167 }
 168 
 169 bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const
 170 {
 171     notImplemented();
 172     return false;
 173 }
 174 
 175 } // namespace WebCore