diff options
Diffstat (limited to 'WebCore')
28 files changed, 48 insertions, 282 deletions
diff --git a/WebCore/WebCorePrefixAndroid.h b/WebCore/WebCorePrefixAndroid.h index 1f4287f..c933562 100644 --- a/WebCore/WebCorePrefixAndroid.h +++ b/WebCore/WebCorePrefixAndroid.h @@ -68,23 +68,11 @@ typedef unsigned char flex_uint8_t; #define ANDROID_EXPOSE_COLUMN_GAP -// This change was made before we changed ListBoxes to operate the same way -// as drop down lists. -// FIXME: Check to make sure we can delete it. -#define ANDROID_NAVIGATE_LISTBOX - -// Allows us to get the rectangle of an <area> element so we can navigate to it -// This could be submitted back to webkit if anyone else wants to use the -// hit rectangles for navigation. -#define ANDROID_NAVIGATE_AREAMAPS - #define ANDROID_LAYOUT // Allows us to select all of the text in a <textarea> in onfocus #define ANDROID_SELECT_TEXT_AREAS -#define ANDROID_KEYBOARD_NAVIGATION -#define ANDROID_NO_BODY_INNER_HTML #define ANDROID_FIX // note: if uncomment ANDROID_INSTRUMENT here, you must also // uncomment it on line 31 of JavaScriptCore/kjs/config.h @@ -101,14 +89,6 @@ typedef unsigned char flex_uint8_t; // Unnecessary for us, since we handle scrolling outside of WebKit. #define ANDROID_SCROLL_FIX -// Fixes an issue where going back to a page that sets focus to a textfield -// results in restoring the selection rather than selecting all. -#define ANDROID_DO_NOT_RESTORE_PREVIOUS_SELECTION - -// Fix for issue 986508. May be possible to combine with -// ANDROID_DO_NOT_RESTORE_PREVIOUS_SELECTION -#define ANDROID_RESET_SELECTION - #define ANDROID_META_SUPPORT // Give public access to a private method in HTMLSelectElement so that @@ -131,7 +111,7 @@ typedef unsigned char flex_uint8_t; // Changes needed to support native plugins (npapi.h). If the change is generic, // it may be under a different #define (see: PLUGIN_PLATFORM_SETVALUE, -// PLUGIN_SCHEDULE_TIMER, ANDROID_PLUGIN_MAIN_THREAD_SCHEDULER_FIXES) +// PLUGIN_SCHEDULE_TIMER) #define ANDROID_PLUGINS // Prevent Webkit from drawing the selection in textfields/textareas, since we @@ -144,15 +124,6 @@ typedef unsigned char flex_uint8_t; // ResourceRequest. #define ANDROID_USER_GESTURE -// Inform webkit (Font.cpp) that we NEVER want to perform rounding hacks for -// text, since we always measure/draw in subpixel mode (performance) -#define ANDROID_NEVER_ROUND_FONT_METRICS - -// Add bool to GlyphBuffer as a drawing hint, marking buffers whose array of -// widths happen to exactly match the values returned from the font. This allows -// the drawing code to ignore the position array if they choose (performace) -#define ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - // Add support for the orientation window property #define ANDROID_ORIENTATION_SUPPORT @@ -164,12 +135,6 @@ typedef unsigned char flex_uint8_t; // Will submit this as a patch to apple #define PLUGIN_PLATFORM_SETVALUE -// This fixes a bug in PluginMainThreadScheduler: it is obviously -// missing a reset of m_callPending. This means that it never wakes up -// the main thread after the first time triggered. -// https://bugs.webkit.org/show_bug.cgi?id=21503 -#define ANDROID_PLUGIN_MAIN_THREAD_SCHEDULER_FIXES - // This enables logging the DOM tree, Render tree even for the release build #define ANDROID_DOM_LOGGING @@ -187,4 +152,3 @@ typedef unsigned char flex_uint8_t; // Enable dumping the display tree to a file (triggered in WebView.java) #define ANDROID_DUMP_DISPLAY_TREE - diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index cef9b7d..bcd54c1 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -182,16 +182,6 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce if (oldChild == newChild) // nothing to do return true; -#ifdef ANDROID_FIX - // if oldChild is null, it will cause crash in checkReplaceChild(). We - // should check null first. - // Fix Android bug, http://b/issue?id=847893 - if (!oldChild) { - ec = NOT_FOUND_ERR; - return false; - } -#endif - // Make sure replacing the old child with the new is ok checkReplaceChild(newChild.get(), oldChild, ec); if (ec) diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 3e866a6..c35177a 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -2510,19 +2510,6 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) if (m_inPageCache) return false; -#ifdef ANDROID_RESET_SELECTION - WebCore::Node* oldFocus = frame()->getCacheBuilder().currentFocus(); - if (oldFocus) { - if (oldFocus->hasTagName(WebCore::HTMLNames::inputTag)) { - WebCore::HTMLInputElement* input = static_cast<WebCore::HTMLInputElement*>(oldFocus); - if (input->isTextField()) - input->setSelectionRange(-1, -1); - } else if (oldFocus->hasTagName(WebCore::HTMLNames::textareaTag)) { - WebCore::HTMLTextAreaElement* textArea = static_cast<WebCore::HTMLTextAreaElement*>(oldFocus); - textArea->setSelectionRange(-1, -1); - } - } -#endif bool focusChangeBlocked = false; RefPtr<Node> oldFocusedNode = m_focusedNode; m_focusedNode = 0; diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index 3aae0b5..b9dc0fd 100644 --- a/WebCore/dom/Element.h +++ b/WebCore/dom/Element.h @@ -157,15 +157,7 @@ public: virtual bool isURLAttribute(Attribute*) const; virtual const QualifiedName& imageSourceAttributeName() const; virtual String target() const { return String(); } -#ifdef ANDROID_DO_NOT_RESTORE_PREVIOUS_SELECTION - // Set the default to not restore the previous selection, since - // we want the selection to cover the whole textfield. - // FIXME: Would it be a better fix to simply ignore the input - // value in the implementation? - virtual void focus(bool restorePreviousSelection = false); -#else virtual void focus(bool restorePreviousSelection = true); -#endif virtual void updateFocusAppearance(bool restorePreviousSelection); void blur(); diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 6a16b3c..214a19e 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -1876,8 +1876,8 @@ void Node::showTreeAndMark(const Node* markedNode1, const char* markedLabel1, co #else for (const Node* tmpNode = node; tmpNode && tmpNode != rootNode; tmpNode = tmpNode->parentNode()) fprintf(stderr, "\t"); -#endif node->showNode(); +#endif } } diff --git a/WebCore/history/HistoryItem.cpp b/WebCore/history/HistoryItem.cpp index d7cc311..d4e58e4 100644 --- a/WebCore/history/HistoryItem.cpp +++ b/WebCore/history/HistoryItem.cpp @@ -414,13 +414,6 @@ FormData* HistoryItem::formData() return m_formData.get(); } -#ifdef ANDROID_FIX -const FormData* HistoryItem::formData() const -{ - return m_formData.get(); -} -#endif - bool HistoryItem::isCurrentDocument(Document* doc) const { // FIXME: We should find a better way to check if this is the current document. diff --git a/WebCore/history/HistoryItem.h b/WebCore/history/HistoryItem.h index cc131dd..839f47d 100644 --- a/WebCore/history/HistoryItem.h +++ b/WebCore/history/HistoryItem.h @@ -109,9 +109,6 @@ public: bool isTargetItem() const; FormData* formData(); -#ifdef ANDROID_FIX - const FormData* formData() const; -#endif String formContentType() const; String formReferrer() const; String rssFeedReferrer() const; diff --git a/WebCore/html/HTMLAreaElement.cpp b/WebCore/html/HTMLAreaElement.cpp index 7c6d65f..a865122 100644 --- a/WebCore/html/HTMLAreaElement.cpp +++ b/WebCore/html/HTMLAreaElement.cpp @@ -29,10 +29,6 @@ #include "Length.h" #include "RenderObject.h" -#ifdef ANDROID_NAVIGATE_AREAMAPS -#include "RenderImage.h" -#endif - using namespace std; namespace WebCore { @@ -45,9 +41,6 @@ HTMLAreaElement::HTMLAreaElement(Document *doc) , m_coordsLen(0) , m_lastSize(-1, -1) , m_shape(Unknown) -#ifdef ANDROID_NAVIGATE_AREAMAPS - , m_map(0) -#endif { } @@ -231,15 +224,4 @@ void HTMLAreaElement::setTarget(const String& value) setAttribute(targetAttr, value); } -#ifdef ANDROID_NAVIGATE_AREAMAPS -IntRect HTMLAreaElement::getAreaRect() const -{ - if (m_map) { - if (isDefault()) - return m_map->absoluteBoundingBoxRect(); - return getRect(m_map); - } - return IntRect(); -} -#endif } diff --git a/WebCore/html/HTMLAreaElement.h b/WebCore/html/HTMLAreaElement.h index 2cce901..986116b 100644 --- a/WebCore/html/HTMLAreaElement.h +++ b/WebCore/html/HTMLAreaElement.h @@ -29,14 +29,6 @@ namespace WebCore { -#ifdef ANDROID_NAVIGATE_AREAMAPS - // in android, we have no pointer, so we can't access area elements - // via mapMouseEvent. instead, we store the RenderImage here so we - // can use it to find its dimensions to focus on it and draw a ring - // around it - class RenderImage; -#endif - class HitTestResult; class HTMLAreaElement : public HTMLAnchorElement { @@ -78,11 +70,6 @@ public: virtual String target() const; void setTarget(const String&); -#ifdef ANDROID_NAVIGATE_AREAMAPS - IntRect getAreaRect() const; - void setMap(RenderImage* map) { m_map = map; } -#endif - private: enum Shape { Default, Poly, Rect, Circle, Unknown }; Path getRegion(const IntSize&) const; @@ -91,9 +78,6 @@ private: int m_coordsLen; IntSize m_lastSize; Shape m_shape; -#ifdef ANDROID_NAVIGATE_AREAMAPS - RenderImage* m_map; -#endif }; } //namespace diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index 3f8a983..572a7a5 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -241,10 +241,6 @@ void HTMLElement::parseMappedAttribute(MappedAttribute *attr) String HTMLElement::innerHTML() const { -#ifdef ANDROID_NO_BODY_INNER_HTML - if (id()==bodyTag || id()==htmlTag) - return "fastinnerhtml!"; -#endif return createMarkup(this, ChildrenOnly); } diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index cebfb51..c5c55fd 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -58,7 +58,7 @@ #if USE(LOW_BANDWIDTH_DISPLAY) #include "FrameLoader.h" #endif -#ifdef ANDROID // multiple additions: see below +#ifdef ANDROID_ACCEPT_CHANGES_TO_FOCUSED_TEXTFIELDS #include "WebViewCore.h" #endif #include "TextIterator.h" @@ -197,7 +197,6 @@ bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const if (name().isEmpty()) return false; -#ifndef ANDROID_KEYBOARD_NAVIGATION // Never allow keyboard tabbing to leave you in the same radio group. Always // skip any other elements in the group. Node* currentFocusedNode = document()->focusedNode(); @@ -207,7 +206,6 @@ bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const focusedInput->name() == name()) return false; } -#endif // Allow keyboard focus if we're checked or if nothing in the group is checked. return checked() || !checkedRadioButtons(this).checkedButtonForGroup(name()); @@ -1297,11 +1295,6 @@ void HTMLInputElement::defaultEventHandler(Event* evt) clickElement = true; break; case RADIO: -#ifdef ANDROID_KEYBOARD_NAVIGATION -// allow enter to change state of radio - if (!checked()) - clickElement = true; -#endif break; // Don't do anything for enter on a radio button. } } else if (charCode == ' ') { @@ -1348,7 +1341,6 @@ void HTMLInputElement::defaultEventHandler(Event* evt) } } -#ifndef ANDROID_KEYBOARD_NAVIGATION // allow enter to change state of radio if (inputType() == RADIO && (key == "Up" || key == "Down" || key == "Left" || key == "Right")) { // Left and up mean "previous radio button". @@ -1384,7 +1376,6 @@ void HTMLInputElement::defaultEventHandler(Event* evt) } } } -#endif } if (evt->type() == eventNames().keyupEvent && evt->isKeyboardEvent()) { diff --git a/WebCore/html/HTMLSelectElement.cpp b/WebCore/html/HTMLSelectElement.cpp index 44e7fe4..e95bfd3 100644 --- a/WebCore/html/HTMLSelectElement.cpp +++ b/WebCore/html/HTMLSelectElement.cpp @@ -586,12 +586,10 @@ void HTMLSelectElement::dispatchFocusEvent() void HTMLSelectElement::dispatchBlurEvent() { -#ifndef ANDROID_NAVIGATE_LISTBOX // We only need to fire onChange here for menu lists, because we fire onChange for list boxes whenever the selection change is actually made. // This matches other browsers' behavior. if (usesMenuList()) menuListOnChange(); -#endif HTMLFormControlElementWithState::dispatchBlurEvent(); } diff --git a/WebCore/loader/CachedCSSStyleSheet.cpp b/WebCore/loader/CachedCSSStyleSheet.cpp index ace938b..9059f25 100644 --- a/WebCore/loader/CachedCSSStyleSheet.cpp +++ b/WebCore/loader/CachedCSSStyleSheet.cpp @@ -76,7 +76,7 @@ void CachedCSSStyleSheet::data(PassRefPtr<SharedBuffer> data, bool allDataReceiv if (m_data.get()) { m_sheet = m_decoder->decode(m_data->data(), encodedSize()); m_sheet += m_decoder->flush(); -#ifdef ANDROID_FIX +#ifdef ANDROID_FIX // FIXME Newer webkit makes decode temporary; remove on webkit update // report decoded size too setDecodedSize(m_sheet.length() * sizeof(UChar)); #endif diff --git a/WebCore/loader/CachedScript.cpp b/WebCore/loader/CachedScript.cpp index 9666eea..c8caea8 100644 --- a/WebCore/loader/CachedScript.cpp +++ b/WebCore/loader/CachedScript.cpp @@ -79,7 +79,7 @@ void CachedScript::data(PassRefPtr<SharedBuffer> data, bool allDataReceived) setEncodedSize(m_data.get() ? m_data->size() : 0); if (m_data.get()) m_script = m_encoding.decode(m_data->data(), encodedSize()); -#ifdef ANDROID_FIX +#ifdef ANDROID_FIX // FIXME Newer webkit calls setDecodedSize in CachedScript::script(); remove on webkit update // report decoded size too setDecodedSize(m_script.length() * sizeof(UChar)); #endif diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index a47fb08..72e57fe 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -1356,28 +1356,14 @@ void* IconDatabase::syncThreadMainLoop() bool didAnyWork = true; while (didAnyWork) { -#ifdef ANDROID_FIX - // We should write the pending icons to the database before trying - // to read any requested icons to ensure that a requested icon has - // the correct data. bool didWrite = writeToDatabase(); if (shouldStopThreadActivity()) break; - - didAnyWork = readFromDatabase(); - if (shouldStopThreadActivity()) - break; -#else + didAnyWork = readFromDatabase(); if (shouldStopThreadActivity()) break; - - bool didWrite = writeToDatabase(); - if (shouldStopThreadActivity()) - break; -#endif - - + // Prune unretained icons after the first time we sync anything out to the database // This way, pruning won't be the only operation we perform to the database by itself // We also don't want to bother doing this if the thread should be terminating (the user is quitting) diff --git a/WebCore/page/android/DragControllerAndroid.cpp b/WebCore/page/android/DragControllerAndroid.cpp index a56411d..eee0cdd 100644 --- a/WebCore/page/android/DragControllerAndroid.cpp +++ b/WebCore/page/android/DragControllerAndroid.cpp @@ -42,7 +42,7 @@ DragOperation DragController::dragOperation(DragData* dragData) { //FIXME: This logic is incomplete ASSERT(0); - if (dragData->containsURL()) + if (dragData->containsURL()) return DragOperationCopy; return DragOperationNone; diff --git a/WebCore/page/android/EventHandlerAndroid.cpp b/WebCore/page/android/EventHandlerAndroid.cpp index aa522a3..e594482 100644 --- a/WebCore/page/android/EventHandlerAndroid.cpp +++ b/WebCore/page/android/EventHandlerAndroid.cpp @@ -42,8 +42,6 @@ namespace WebCore { -// using namespace EventNames; - unsigned EventHandler::s_accessKeyModifiers = PlatformKeyboardEvent::AltKey; bool EventHandler::tabsToAllControls(KeyboardEvent* ) const @@ -86,10 +84,10 @@ bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const return false; } -// This function is called for mouse events by FrameView::handleMousePressEvent() -// It is used to ensure that events are sync. correctly between frames, for example +// This function is called for mouse events by FrameView::handleMousePressEvent(). +// It is used to ensure that events are sync'ed correctly between frames. For example // if the user presses down in one frame and up in another frame, this function will -// return true if that is the case, and pass the event to the correct frame +// returns true, and pass the event to the correct frame. bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& event, Frame* subframe, HitTestResult* hoveredNode) { @@ -97,8 +95,8 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& eve return false; } -// This is called to route Wheel Events to child widgets when they are a RenderWidget -// as the parent usually gets Wheel Event. Don't have a mouse with a wheel to confirm +// This is called to route wheel events to child widgets when they are RenderWidget +// as the parent usually gets wheel event. Don't have a mouse with a wheel to confirm // the operation of this function. bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& , Widget* widget) { @@ -127,6 +125,6 @@ class Clipboard : public RefCounted<Clipboard> {}; PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { return PassRefPtr<Clipboard>(NULL); } - // new as of SVN change 36269, Sept 8, 2008 +// new as of SVN change 36269, Sept 8, 2008 const double EventHandler::TextDragDelay = 0.0; } diff --git a/WebCore/page/android/InspectorControllerAndroid.cpp b/WebCore/page/android/InspectorControllerAndroid.cpp index c3b88b7..befcf4a 100644 --- a/WebCore/page/android/InspectorControllerAndroid.cpp +++ b/WebCore/page/android/InspectorControllerAndroid.cpp @@ -21,13 +21,12 @@ #include "Node.h" #include "Profile.h" -/* // This stub file was created to avoid building and linking in all the // Inspector codebase. If you would like to enable the Inspector, do the // following steps: -// 1. Replace this file in WebCore/Makefile.android with the common +// 1. Replace this file in WebCore/Android.mk with the common // implementation, ie page/InsepctorController.cpp -// 2. Add the JS API files to JavaScriptCore/Makefile.android: +// 2. Add the JS API files to JavaScriptCore/Android.mk: // ? API/JSBase.cpp \ // API/JSCallbackConstructor.cpp \ // API/JSCallbackFunction.cpp \ @@ -37,14 +36,13 @@ // API/JSObjectRef.cpp \ // API/JSStringRef.cpp \ // API/JSValueRef.cpp -// 3. Add the following LOCAL_C_INCLUDES to JavaScriptCore/Makefile.android: +// 3. Add the following LOCAL_C_INCLUDES to JavaScriptCore/Android.mk: // ?$(LOCAL_PATH)/API \ // $(LOCAL_PATH)/ForwardingHeaders \ // $(LOCAL_PATH)/../../WebKit \ // 4. Rebuild WebKit // -// Note, for a functional Inspector, you must implement InspectorClientAndroid -*/ +// Note, for a functional Inspector, you must implement InspectorClientAndroid. namespace WebCore { @@ -54,8 +52,11 @@ struct InspectorResource : public RefCounted<InspectorResource> { struct InspectorDatabaseResource : public RefCounted<InspectorDatabaseResource> { }; -InspectorController::InspectorController(Page*, InspectorClient*) : - m_startProfiling(this, NULL) {} +InspectorController::InspectorController(Page*, InspectorClient*) + : m_startProfiling(this, NULL) +{ +} + InspectorController::~InspectorController() {} void InspectorController::windowScriptObjectAvailable() {} diff --git a/WebCore/platform/android/KeyEventAndroid.cpp b/WebCore/platform/android/KeyEventAndroid.cpp index 6a59e58..302f6fe 100644 --- a/WebCore/platform/android/KeyEventAndroid.cpp +++ b/WebCore/platform/android/KeyEventAndroid.cpp @@ -205,13 +205,13 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(int keyCode, UChar32 unichar, , m_keyIdentifier(keyIdentifierForAndroidKeyCode(keyCode)) , m_autoRepeat(repeatCount > 0) , m_windowsVirtualKeyCode(windowsKeyCodeForKeyEvent(keyCode)) + , m_nativeVirtualKeyCode(keyCode) , m_isKeypad(false) , m_shiftKey((mods & ShiftKey) != 0) , m_ctrlKey((mods & CtrlKey) != 0) , m_altKey((mods & AltKey) != 0) , m_metaKey((mods & MetaKey) != 0) // added for android - , m_nativeVirtualKeyCode(keyCode) , m_repeatCount(repeatCount) , m_unichar(unichar) { diff --git a/WebCore/platform/graphics/Font.cpp b/WebCore/platform/graphics/Font.cpp index a78d27b..138e322 100644 --- a/WebCore/platform/graphics/Font.cpp +++ b/WebCore/platform/graphics/Font.cpp @@ -417,9 +417,6 @@ void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const Fl WidthIterator it(this, run); it.advance(from); float beforeWidth = it.m_runWidthSoFar; -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - bool adjustedWidths = -#endif it.advance(to, &glyphBuffer); // We couldn't generate any glyphs for the run. Give up. @@ -432,9 +429,6 @@ void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const Fl float finalRoundingWidth = it.m_finalRoundingWidth; it.advance(run.length()); startX += finalRoundingWidth + it.m_runWidthSoFar - afterWidth; -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - adjustedWidths = true; // give up on simple/fast case -#endif } else startX += beforeWidth; @@ -443,11 +437,6 @@ void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const Fl for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end) glyphBuffer.swap(i, end); -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - // mark the GlyphBuffer as having adjusted widths or not - // used by drawGlyph as an optimization hint - glyphBuffer.setHasAdjustedWidths(adjustedWidths); -#endif // Calculate the starting point of the glyphs to be displayed by adding // all the advances up to the first glyph. FloatPoint startPoint(startX, point.y()); diff --git a/WebCore/platform/graphics/GlyphBuffer.h b/WebCore/platform/graphics/GlyphBuffer.h index 110b3c2..18957d5 100644 --- a/WebCore/platform/graphics/GlyphBuffer.h +++ b/WebCore/platform/graphics/GlyphBuffer.h @@ -61,10 +61,6 @@ typedef FloatSize GlyphBufferAdvance; class GlyphBuffer { public: -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - GlyphBuffer() : m_hasAdjustedWidths(true) {} -#endif - bool isEmpty() const { return m_fontData.isEmpty(); } int size() const { return m_fontData.size(); } @@ -159,18 +155,6 @@ public: #endif } -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - void setHasAdjustedWidths(bool adjustedWidths) { - m_hasAdjustedWidths = adjustedWidths; - } - /** Returns true in the general case, which means that one or more of the - glyphs may have a width or height that has been changed from the raw - value returned by the font. If this returns false, then the drawing - code can use that as a hint if it means it can draw the run faster. - */ - bool hasAdjustedWidths() const { return m_hasAdjustedWidths; } -#endif - void add(Glyph glyph, const SimpleFontData* font, GlyphBufferAdvance advance) { m_fontData.append(font); @@ -192,12 +176,6 @@ private: #if PLATFORM(WIN) Vector<FloatSize, 2048> m_offsets; #endif -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - // defaults to true for general case. Set to false sometimes in - // drawSimpleText as a hint to drawGlphs that the widths are exactly those - // from the font (i.e. no tweaks for rounding or CSS styling - bool m_hasAdjustedWidths; -#endif }; } diff --git a/WebCore/platform/graphics/WidthIterator.cpp b/WebCore/platform/graphics/WidthIterator.cpp index a66b234..a16d739 100644 --- a/WebCore/platform/graphics/WidthIterator.cpp +++ b/WebCore/platform/graphics/WidthIterator.cpp @@ -65,13 +65,7 @@ WidthIterator::WidthIterator(const Font* font, const TextRun& run) } } -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS -#define SIGNAL_ADJUSTED_WIDTHS() adjustedWidths = true -bool WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) -#else -#define SIGNAL_ADJUSTED_WIDTHS() void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) -#endif { if (offset > m_end) offset = m_end; @@ -85,9 +79,6 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) float runWidthSoFar = m_runWidthSoFar; float lastRoundingWidth = m_finalRoundingWidth; -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - bool adjustedWidths = false; -#endif while (currentCharacter < offset) { UChar32 c = *cp; unsigned clusterLength = 1; @@ -129,26 +120,21 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) if (c == '\t' && m_run.allowTabs()) { float tabWidth = m_font->tabWidth(); width = tabWidth - fmodf(m_run.xPos() + runWidthSoFar, tabWidth); - SIGNAL_ADJUSTED_WIDTHS(); } else { width = fontData->widthForGlyph(glyph); -#ifndef ANDROID_NEVER_ROUND_FONT_METRICS // We special case spaces in two ways when applying word rounding. // First, we round spaces to an adjusted width in all fonts. // Second, in fixed-pitch fonts we ensure that all characters that // match the width of the space character have the same width as the space character. if (width == fontData->m_spaceWidth && (fontData->m_treatAsFixedPitch || glyph == fontData->m_spaceGlyph) && m_run.applyWordRounding()) { width = fontData->m_adjustedSpaceWidth; - SIGNAL_ADJUSTED_WIDTHS(); } -#endif } if (hasExtraSpacing) { // Account for letter-spacing. if (width && m_font->letterSpacing()) { width += m_font->letterSpacing(); - SIGNAL_ADJUSTED_WIDTHS(); } if (Font::treatAsSpace(c)) { @@ -163,14 +149,12 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) width += m_padPerSpace; m_padding -= m_padPerSpace; } - SIGNAL_ADJUSTED_WIDTHS(); } // Account for word spacing. // We apply additional space between "words" by adding width to the space character. if (currentCharacter != 0 && !Font::treatAsSpace(cp[-1]) && m_font->wordSpacing()) { width += m_font->wordSpacing(); - SIGNAL_ADJUSTED_WIDTHS(); } } } @@ -186,12 +170,10 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) float oldWidth = width; -#ifndef ANDROID_NEVER_ROUND_FONT_METRICS // Force characters that are used to determine word boundaries for the rounding hack // to be integer width, so following words will start on an integer boundary. if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(c)) { width = ceilf(width); - SIGNAL_ADJUSTED_WIDTHS(); } // Check to see if the next character is a "rounding hack character", if so, adjust @@ -200,9 +182,7 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) || (m_run.applyRunRounding() && currentCharacter >= m_end)) { float totalWidth = runWidthSoFar + width; width += ceilf(totalWidth) - totalWidth; - SIGNAL_ADJUSTED_WIDTHS(); } -#endif runWidthSoFar += width; @@ -215,10 +195,6 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer) m_currentCharacter = currentCharacter; m_runWidthSoFar = runWidthSoFar; m_finalRoundingWidth = lastRoundingWidth; - -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - return adjustedWidths; -#endif } bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer) diff --git a/WebCore/platform/graphics/WidthIterator.h b/WebCore/platform/graphics/WidthIterator.h index a0eb26d..5706d1e 100644 --- a/WebCore/platform/graphics/WidthIterator.h +++ b/WebCore/platform/graphics/WidthIterator.h @@ -33,11 +33,7 @@ class TextRun; struct WidthIterator { WidthIterator(const Font*, const TextRun&); -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - bool advance(int to, GlyphBuffer* = 0); -#else void advance(int to, GlyphBuffer* = 0); -#endif bool advanceOneCharacter(float& width, GlyphBuffer* = 0); const Font* m_font; diff --git a/WebCore/platform/graphics/android/AffineTransformAndroid.cpp b/WebCore/platform/graphics/android/AffineTransformAndroid.cpp index 6c5abae..712dea5 100644 --- a/WebCore/platform/graphics/android/AffineTransformAndroid.cpp +++ b/WebCore/platform/graphics/android/AffineTransformAndroid.cpp @@ -195,8 +195,7 @@ bool AffineTransform::operator==(const AffineTransform &m2) const AffineTransform &AffineTransform::operator*= (const AffineTransform &m2) { - // is this the correct order??? - m_transform.setConcat(m_transform, m2.m_transform); + m_transform.setConcat(m2.m_transform, m_transform); return *this; } @@ -204,8 +203,7 @@ AffineTransform AffineTransform::operator* (const AffineTransform &m2) { AffineTransform cat; - // is this the correct order??? - cat.m_transform.setConcat(m_transform, m2.m_transform); + cat.m_transform.setConcat(m2.m_transform, m_transform); return cat; } diff --git a/WebCore/platform/graphics/android/FontAndroid.cpp b/WebCore/platform/graphics/android/FontAndroid.cpp index d53c3ea..569e8db 100644 --- a/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/WebCore/platform/graphics/android/FontAndroid.cpp @@ -107,35 +107,31 @@ static bool setupForText(SkPaint* paint, GraphicsContext* gc, void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const { - SkPaint paint; + SkASSERT(sizeof(GlyphBufferGlyph) == sizeof(uint16_t)); // compile-time assert + SkPaint paint; if (!setupForText(&paint, gc, font)) { return; } - SkCanvas* canvas = gc->platformContext()->mCanvas; - - SkASSERT(sizeof(GlyphBufferGlyph) == sizeof(uint16_t)); // compile-time assert - - const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from); SkScalar x = SkFloatToScalar(point.x()); SkScalar y = SkFloatToScalar(point.y()); + const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from); + const GlyphBufferAdvance* adv = glyphBuffer.advances(from); + SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); + SkPoint* pos = storage.get(); + + /* We need an array of [x,y,x,y,x,y,...], but webkit is giving us + point.xy + [width, height, width, height, ...], so we have to convert + */ + for (int i = 0; i < numGlyphs; i++) { + pos[i].set(x, y); + x += SkFloatToScalar(adv[i].width()); + y += SkFloatToScalar(adv[i].height()); + } -#ifdef ANDROID_GLYPHBUFFER_HAS_ADJUSTED_WIDTHS - if (glyphBuffer.hasAdjustedWidths()) { - const GlyphBufferAdvance* adv = glyphBuffer.advances(from); - SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); - SkPoint* pos = storage.get(); - - for (int i = 0; i < numGlyphs; i++) { - pos[i].set(x, y); - x += SkFloatToScalar(adv[i].width()); - y += SkFloatToScalar(adv[i].height()); - } - canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint); - } else -#endif - canvas->drawText(glyphs, numGlyphs << 1, x, y, paint); + SkCanvas* canvas = gc->platformContext()->mCanvas; + canvas->drawPosText(glyphs, numGlyphs * sizeof(*glyphs), pos, paint); } FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& point, int h, int, int) const diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 3a25990..604c407 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -39,9 +39,6 @@ #ifdef ANDROID_LAYOUT #include "Settings.h" #endif -#ifdef ANDROID_NAVIGATE_AREAMAPS -#include "HTMLAreaElement.h" -#endif #include "SystemTime.h" @@ -188,11 +185,6 @@ RenderImage::RenderImage(Node* node) RenderImage::~RenderImage() { -#ifdef ANDROID_NAVIGATE_AREAMAPS - // Set area elements' RenderImage to null, so they do not reference - // the deleted RenderImage. - setAreaElements(NULL); -#endif if (m_cachedImage) m_cachedImage->removeClient(this); RenderImageScaleObserver::imageDestroyed(this); @@ -598,18 +590,4 @@ Image* RenderImage::nullImage() return Image::nullImage(); } -#ifdef ANDROID_NAVIGATE_AREAMAPS -void RenderImage::setAreaElements(RenderImage* image) -{ - HTMLMapElement* map = imageMap(); - if (map) { - for (Node* current = map->firstChild(); current; current = current->traverseNextNode(map)) { - if (current->hasTagName(WebCore::HTMLNames::areaTag)) { - HTMLAreaElement* area = static_cast<HTMLAreaElement*>(current); - area->setMap(image); - } - } - } -} -#endif } // namespace WebCore diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h index 15d7aa1..477fdeb 100644 --- a/WebCore/rendering/RenderImage.h +++ b/WebCore/rendering/RenderImage.h @@ -71,15 +71,6 @@ public: void highQualityRepaintTimerFired(Timer<RenderImage>*); -#ifdef ANDROID_NAVIGATE_AREAMAPS - // If this RenderImage has an imagemap, set its area elements to point to it so they - // can know its bounds for focus navigation and drawing the focus ring. - void setImageForAreaElements() { setAreaElements(this); } -private: - // Helper function, also used to set the area elements to have no RenderImage in the - // destructor, so they do not reference the deleted image. - void setAreaElements(RenderImage* image); -#endif protected: virtual Image* image(int w = 0, int h = 0) { return m_cachedImage ? m_cachedImage->image() : nullImage(); } virtual bool errorOccurred() const { return m_cachedImage && m_cachedImage->errorOccurred(); } diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 8384a98..56fb7df 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -533,7 +533,12 @@ int RenderObject::offsetTop() const RenderObject* offsetPar = offsetParent(); if (!offsetPar) return 0; +#ifdef ANDROID_FIX + // This is to fix https://bugs.webkit.org/show_bug.cgi?id=23178. + int y = yPos() - borderTopExtra() + offsetPar->borderTopExtra() - offsetPar->borderTop(); +#else int y = yPos() - borderTopExtra() - offsetPar->borderTop(); +#endif if (!isPositioned()) { if (isRelPositioned()) y += static_cast<const RenderBox*>(this)->relativePositionOffsetY(); |