1 /*
   2  * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
   3  */
   4 #include "config.h"
   5 
   6 #include <wtf/PassRefPtr.h>
   7 #if USE(JAVA_UNICODE)
   8 #include <wtf/unicode/java/UnicodeJava.h>
   9 #elif USE(ICU_UNICODE)
  10 #include <wtf/unicode/icu/UnicodeIcu.h>
  11 #endif
  12 
  13 #include "Clipboard.h" // WebKit BUG: must be included from Editor.h
  14 #include "ClipboardJava.h"
  15 #include "CookieStorage.h"
  16 #include "Color.h"
  17 #include "ChromiumBridge.h"
  18 #include "DragData.h"
  19 #include "DragImage.h"
  20 #include "Editor.h"
  21 #include "EventHandler.h"
  22 #include "EventLoop.h"
  23 #include "Font.h"
  24 #include "Frame.h"
  25 #include "FrameView.h"
  26 #include "GraphicsContext.h"
  27 #include "ImageBuffer.h"
  28 //#include "JNIUtilityPrivate.h"
  29 #include "KURL.h" // WebKit BUG: must be included from Pasteboard.h
  30 #include "Language.h"
  31 #include "NotImplemented.h"
  32 #include "RenderObject.h"
  33 #include "ResourceHandle.h"
  34 #include "SharedBuffer.h" // WebKit BUG: must be included from ResourceHandle.h
  35 #include "SSLKeyGenerator.h"
  36 #include "SearchPopupMenuJava.h"
  37 #include "SmartReplace.h"
  38 
  39 
  40 
  41 // WebCore/svg
  42 /*
  43 #include "SVGPaintServer.h"
  44 #include "SVGPaintServerGradient.h"
  45 #include "SVGPaintServerPattern.h"
  46 #include "SVGPaintServerSolid.h"
  47 #include "SVGResourceClipper.h"
  48 #include "SVGResourceFilter.h"
  49 #include "SVGResourceMasker.h"
  50 */
  51 
  52 
  53 
  54 namespace WebCore
  55 {
  56 
  57 //----- copy from editing\qt\SmartReplaceQt.cpp ---------//
  58 
  59 #if USE(JAVA_UNICODE)
  60 bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
  61 {
  62     if (WTF::Unicode::Java::isSpaceChar(uint32_t(c)))
  63         return true;
  64     if (!isPreviousCharacter && WTF::Unicode::isPunct(c))
  65         return true;
  66 
  67     if ((c >= 0x1100 && c <= (0x1100 + 256))          // Hangul Jamo (0x1100 - 0x11FF)
  68         || (c >= 0x2E80 && c <= (0x2E80 + 352))       // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
  69         || (c >= 0x2FF0 && c <= (0x2FF0 + 464))       // Ideograph Deseriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
  70         || (c >= 0x3200 && c <= (0x3200 + 29392))     // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
  71         || (c >= 0xAC00 && c <= (0xAC00 + 11183))     // Hangul Syllables (0xAC00 - 0xD7AF)
  72         || (c >= 0xF900 && c <= (0xF900 + 352))       // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
  73         || (c >= 0xFE30 && c <= (0xFE30 + 32))        // CJK Compatibility From (0xFE30 - 0xFE4F)
  74         || (c >= 0xFF00 && c <= (0xFF00 + 240))       // Half/Full Width Form (0xFF00 - 0xFFEF)
  75         || (c >= 0x20000 && c <= (0x20000 + 0xA6D7))  // CJK Ideograph Exntension B
  76         || (c >= 0x2F800 && c <= (0x2F800 + 0x021E))) // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
  77        return true;
  78 
  79     const char prev[] = "([\"\'#$/-`{\0";
  80     const char next[] = ")].,;:?\'!\"%*-/}\0";
  81     const char* str = (isPreviousCharacter) ? prev : next;
  82     for (int i = 0; i < strlen(str); ++i) {
  83         if (str[i] == c)
  84           return true;
  85     }
  86 
  87     return false;
  88 }
  89 #endif
  90 
  91 // ---- CookieStorage.h ---- //
  92 void setCookieStoragePrivateBrowsingEnabled(bool)
  93 {
  94     notImplemented();
  95 }
  96 
  97 
  98 // ---- WebCore/editing stubs ---- //
  99 
 100 // ---- Editor.h ---- //
 101 
 102 PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy, Frame* frame)
 103 {
 104     return ClipboardJava::create(policy, Clipboard::CopyAndPaste, DataObjectJava::create(), frame);
 105 }
 106 
 107 //WTF::PassRefPtr<JSC::Bindings::Instance>
 108 //                    ScriptController::createScriptInstanceForWidget(Widget *)
 109 //{
 110 //    notImplemented();
 111 //    return 0;
 112 //}
 113 
 114 // ---- SSLKeyGenerator.h ---- //
 115 
 116 void getSupportedKeySizes(Vector<String>&)
 117 {
 118     notImplemented();
 119 }
 120 
 121 String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &)
 122 {
 123     notImplemented();
 124     return String("signedPublicKeyAndChallengeString");
 125 }
 126 
 127 // ---- SearchPopupMenuJava.h ---- //
 128 
 129 SearchPopupMenuJava::SearchPopupMenuJava(PopupMenuClient* client)
 130     : m_popup(adoptRef(new PopupMenuJava(client)))
 131 {
 132 }
 133 
 134 PopupMenu* SearchPopupMenuJava::popupMenu()
 135 {
 136     return m_popup.get();
 137 }
 138 
 139 bool SearchPopupMenuJava::enabled()
 140 {
 141     return false;
 142 }
 143 
 144 void SearchPopupMenuJava::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems)
 145 {
 146     notImplemented();
 147 }
 148 
 149 void SearchPopupMenuJava::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems)
 150 {
 151     notImplemented();
 152 }
 153 
 154 
 155 // ---- WebCore/page stubs ---- //
 156 
 157 // ---- Frame.h ---- //
 158 
 159 struct ScopedState {
 160     ScopedState(Frame* theFrame, RenderObject* theRenderer)
 161         : frame(theFrame)
 162         , renderer(theRenderer)
 163         , paintBehavior(frame->view()->paintBehavior())
 164         , backgroundColor(frame->view()->baseBackgroundColor())
 165     {
 166     }
 167 
 168     ~ScopedState()
 169     {
 170         if (renderer)
 171             renderer->updateDragState(false);
 172         frame->view()->setPaintBehavior(paintBehavior);
 173         frame->view()->setBaseBackgroundColor(backgroundColor);
 174         frame->view()->setNodeToDraw(0);
 175     }
 176 
 177     Frame* frame;
 178     RenderObject* renderer;
 179     PaintBehavior paintBehavior;
 180     Color backgroundColor;
 181 };
 182 
 183 // ---- WebCore/platform/graphics stubs ---- //
 184 
 185 // ---- Color.h ---- //
 186 
 187 Color focusRingColor()
 188 {
 189     notImplemented();
 190     return Color();
 191 }
 192 
 193 
 194 // SharedBuffer
 195 PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& filePath) {
 196     notImplemented();
 197     return adoptRef(new SharedBuffer);
 198 }
 199 
 200 // SVG
 201 /*
 202 void SVGPaintServer::renderPath(GraphicsContext*&, RenderObject const*,
 203         SVGPaintTargetType) const
 204 {
 205     notImplemented();
 206 }
 207 
 208 void SVGPaintServer::teardown(GraphicsContext*&, RenderObject const*,
 209         SVGPaintTargetType, bool) const
 210 {
 211     notImplemented();
 212 }
 213 
 214 void SVGPaintServer::draw(GraphicsContext*&, RenderObject const*,
 215         SVGPaintTargetType) const
 216 {
 217     notImplemented();
 218 }
 219 
 220 bool SVGPaintServerGradient::setup(GraphicsContext*&, RenderObject const*,
 221         SVGPaintTargetType, bool) const
 222 {
 223     notImplemented();
 224     return false;
 225 }
 226 
 227 void SVGResourceMasker::applyMask(GraphicsContext*, FloatRect const&)
 228 {
 229     notImplemented();
 230 }
 231 
 232 void SVGResourceClipper::applyClip(GraphicsContext*, FloatRect const&) const
 233 {
 234     notImplemented();
 235 }
 236 
 237 bool SVGPaintServerPattern::setup(GraphicsContext*&, RenderObject const*,
 238         SVGPaintTargetType, bool) const
 239 {
 240     notImplemented();
 241     return false;
 242 }
 243 
 244 bool SVGPaintServerSolid::setup(GraphicsContext*&, RenderObject const*,
 245         SVGPaintTargetType, bool) const
 246 {
 247     notImplemented();
 248     return false;
 249 }
 250 
 251 SVGResourceFilterPlatformData* SVGResourceFilter::createPlatformData(void)
 252 {
 253     notImplemented();
 254     return new SVGResourceFilterPlatformData();
 255 }
 256 
 257 void SVGResourceFilter::applyFilter(GraphicsContext*&, FloatRect const &)
 258 {
 259     notImplemented();
 260 }
 261 
 262 void SVGResourceFilter::prepareFilter(GraphicsContext*&, FloatRect const &)
 263 {
 264     notImplemented();
 265 }
 266 
 267 */
 268 // RenderPath
 269 /*
 270 bool RenderPath::strokeContains(FloatPoint const&, bool) const
 271 {
 272     notImplemented();
 273     return false;
 274 }
 275 
 276 FloatRect RenderPath::strokeBBox() const
 277 {
 278     notImplemented();
 279     return FloatRect(0, 0, 0, 0);
 280 }
 281 
 282 */
 283 //bool SVGTransformDistance::isZero()
 284 //}
 285 
 286 bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const
 287 {
 288     notImplemented();
 289     return false;
 290 }
 291 
 292 } // namespace WebCore