=== WebCore-146.1 === 2004-06-18 Vicki Murley - merge this change from HEAD 2004-06-18 Trey Matteson 3702053 - DHTML dragging destination can't control the cursor (by setting the drop operation) Fallout from security work, but an easy fix. Reviewed by Darin * kwq/KWQClipboard.mm: (KWQClipboard::setDropEffect): Allow dest side to set dropEffect. 2004-06-18 Vicki Murley - merge this change from HEAD 2004-06-18 Darin Adler Reviewed by John. - re-fixed show expert preferences notes in xcode causes crash (in EllipsisBox code) * khtml/rendering/render_block.cpp: (khtml::RenderBlock::paintEllipsisBoxes): Check !isInlineFlow rather than checking hasMarkupTruncation. Otherwise, we break plain old non-markup truncation. 2004-06-18 Vicki Murley - merge this change from HEAD 2004-06-18 Darin Adler Reviewed by John. - fixed show expert preferences notes in xcode causes crash (in EllipsisBox code) * khtml/rendering/render_block.cpp: (khtml::RenderBlock::paintEllipsisBoxes): Only walk the ellipsis list if hasMarkupTruncation is true. === Safari-146 === 2004-06-17 Richard Williamson Fixed setting the canvas or parent to display:none and updating the causes a nil-deref Ensured that we have a renderer before rendering. Reviewed by John. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): 2004-06-17 David Hyatt Fix for 3674601, "Read More..." links should trail articles in Emerson. Reviewed by darin * khtml/rendering/bidi.cpp: (khtml::RenderBlock::layoutInlineChildren): (khtml::RenderBlock::deleteEllipsisLineBoxes): (khtml::RenderBlock::checkLinesForTextOverflow): * khtml/rendering/render_block.cpp: (khtml:::RenderFlow): (khtml::RenderBlock::paintEllipsisBoxes): (khtml::RenderBlock::nodeAtPoint): (khtml::shouldCheckLines): (khtml::getLineAtIndex): (khtml::getHeightForLineCount): (khtml::RenderBlock::lineAtIndex): (khtml::RenderBlock::lineCount): (khtml::RenderBlock::heightForLineCount): (khtml::RenderBlock::clearTruncation): * khtml/rendering/render_block.h: (khtml::RenderBlock::setHasMarkupTruncation): (khtml::RenderBlock::hasMarkupTruncation): * khtml/rendering/render_flexbox.cpp: (khtml::RenderFlexibleBox::layoutVerticalBox): * khtml/rendering/render_line.cpp: (khtml::EllipsisBox::m_str): (khtml::InlineBox::adjustPosition): (khtml::InlineFlowBox::adjustPosition): (khtml::InlineFlowBox::clearTruncation): (khtml::EllipsisBox::paint): (khtml::EllipsisBox::nodeAtPoint): (khtml::RootInlineBox::clearTruncation): (khtml::RootInlineBox::placeEllipsis): (khtml::RootInlineBox::paintEllipsisBox): (khtml::RootInlineBox::hitTestEllipsisBox): (khtml::RootInlineBox::adjustPosition): (khtml::RootInlineBox::childRemoved): * khtml/rendering/render_line.h: (khtml::InlineBox::clearTruncation): * khtml/rendering/render_text.cpp: * khtml/rendering/render_text.h: (khtml::InlineTextBox::clearTruncation): 2004-06-17 Trey Matteson 3698514 - coordinates in ondragstart and ondrag events are wrong This part fixes the ondragstart coords. We salt away the window-based mouseDown location, since we need that when we dispatch the ondragstart event. Previously we were errantly using a mouseDown point that had already been converted to view coords, and then the dispatch converted it again. Reviewed by Maciej. * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): Use window based mouse event coords to dispatch event. (KWQKHTMLPart::mouseDown): Save window based mouse event coords . 2004-06-16 David Hyatt Fix for 3596620, implement a subset of CSS3 text truncation for Emerson. Reviewed by mjs * khtml/rendering/bidi.cpp: (khtml::RenderBlock::checkLinesForTextOverflow): * khtml/rendering/font.cpp: (Font::checkSelectionPoint): * khtml/rendering/font.h: * khtml/rendering/render_block.cpp: (khtml::RenderBlock::paintObject): (khtml::RenderBlock::paintFloats): (khtml::RenderBlock::paintEllipsisBoxes): * khtml/rendering/render_block.h: * khtml/rendering/render_line.cpp: (InlineBox::canAccommodateEllipsis): (InlineBox::placeEllipsisBox): (InlineFlowBox::paintDecorations): (InlineFlowBox::placeEllipsisBox): (EllipsisBox::paint): (RootInlineBox::placeEllipsis): (RootInlineBox::placeEllipsisBox): * khtml/rendering/render_line.h: (khtml::EllipsisBox::m_str): (khtml::RootInlineBox::ellipsisBox): * khtml/rendering/render_text.cpp: (InlineTextBox::placeEllipsisBox): (InlineTextBox::paintDecoration): (InlineTextBox::offsetForPosition): (RenderText::positionForCoordinates): (RenderText::paint): * khtml/rendering/render_text.h: * kwq/KWQFontMetrics.h: * kwq/KWQFontMetrics.mm: (QFontMetrics::checkSelectionPoint): * kwq/WebCoreTextRenderer.h: === WebCore-145.1 === 2004-06-16 Maciej Stachowiak Reviewed by John. REGRESSION (144.2-TOT) Selection highlight does not draw * khtml/rendering/render_canvas.cpp: (RenderCanvas::setSelection): === Safari-145 === 2004-06-16 Richard Williamson Fixed 3695730: Added support for embeds[], much like applets[], to allow access to a plugin's exported interface. Reviewed by Chris. * khtml/dom/html_document.cpp: (HTMLDocument::embeds): * khtml/dom/html_document.h: * khtml/ecma/kjs_dom.cpp: (KJS::getRuntimeObject): * khtml/ecma/kjs_html.cpp: (KJS::HTMLDocument::tryGet): (KJS::HTMLElement::tryGet): (KJS::HTMLCollection::tryGet): (KJS::HTMLCollection::getNamedItems): * khtml/ecma/kjs_html.h: (KJS::HTMLDocument::): * khtml/ecma/kjs_html.lut.h: (KJS::): * khtml/html/html_miscimpl.cpp: (HTMLCollectionImpl::calcLength): (HTMLCollectionImpl::getItem): (HTMLCollectionImpl::getNamedItem): * khtml/html/html_miscimpl.h: (DOM::HTMLCollectionImpl::): * khtml/html/html_objectimpl.cpp: (HTMLEmbedElementImpl::getEmbedInstance): * khtml/html/html_objectimpl.h: * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::getEmbedInstanceForView): 2004-06-15 Maciej Stachowiak Reviewed by Dave. : (can't enable selection inside parent where it is disabled via CSS) * khtml/css/cssparser.cpp: (CSSParser::parseValue): * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty): * khtml/rendering/render_object.cpp: (RenderObject::shouldSelect): * khtml/rendering/render_style.h: (khtml::): (khtml::RenderStyle::userSelect): (khtml::RenderStyle::setUserSelect): (khtml::RenderStyle::initialUserSelect): 2004-06-15 David Hyatt Initial impl of the EllipsisBox. This code just gets the box created and gets it placed vertically. The next stage will be to position the box horizontally as well. Reviewed by trey * khtml/rendering/bidi.cpp: (khtml::RenderBlock::checkLinesForTextOverflow): * khtml/rendering/render_line.cpp: (RootInlineBox::placeEllipsis): * khtml/rendering/render_line.h: (khtml::EllipsisBox::m_str): 2004-06-15 David Hyatt Implement canAccommodateEllipsis. The basic idea is that everything on a line will allow an ellipsis to be drawn on top of it unless it's a replaced element. Then, if the replaced element overlaps, the ellipsis won't be allowed. Reviewed by john * khtml/rendering/bidi.cpp: (khtml::RenderBlock::checkLinesForTextOverflow): * khtml/rendering/render_line.cpp: (InlineBox::closestLeafChildForXPos): (InlineBox::canAccommodateEllipsis): (InlineFlowBox::canAccommodateEllipsis): (RootInlineBox::canAccommodateEllipsis): * khtml/rendering/render_line.h: 2004-06-15 Vicki Murley - added a few layout tests, rdar://3694510 * layout-tests/editing/deleting/delete-image-004-expected.txt: Added. * layout-tests/editing/deleting/delete-image-004.html: Added. * layout-tests/editing/selection/extend-by-character-006-expected.txt: Added. * layout-tests/editing/selection/extend-by-character-006.html: Added. 2004-06-15 Trey Matteson Dragging tweak: We pass the mouse down coords instead of the latest mouse drag coords to the ondragstart event. This makes it easy for the client to figure the correct drag image offset, whereas the mouse drag location is next to useless for that. Reviewed by Louch * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): 2004-06-15 Maciej Stachowiak Reviewed by Darin. : (Safari does not support onselectstart event handler) * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): (DOMNode::putValue): * khtml/ecma/kjs_dom.h: (KJS::DOMNode::): * khtml/ecma/kjs_dom.lut.h: (KJS::): * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): * khtml/misc/htmlattrs.c: (hash_attr): (findAttr): * khtml/misc/htmlattrs.h: * khtml/misc/htmlattrs.in: * khtml/rendering/render_object.cpp: (RenderObject::shouldSelect): * khtml/xml/dom2_eventsimpl.cpp: (EventImpl::typeToId): (EventImpl::idToType): * khtml/xml/dom2_eventsimpl.h: (DOM::EventImpl::): 2004-06-15 Maciej Stachowiak Reviewed by Darin. Fix crash with last checkin. * khtml/ecma/kjs_binding.cpp: (ScriptInterpreter::domObjectsPerDocument): check the same property we want to initialize. 2004-06-15 Maciej Stachowiak Reviewed by Darin. : (properties not shared for JS wrappers of same DOM object, accessed from different frames) * khtml/ecma/kjs_binding.cpp: (ScriptInterpreter::domObjects): (ScriptInterpreter::domObjectsPerDocument): (ScriptInterpreter::ScriptInterpreter): (ScriptInterpreter::forgetDOMObject): (ScriptInterpreter::getDOMObjectForDocument): (ScriptInterpreter::putDOMObjectForDocument): (ScriptInterpreter::deleteDOMObjectsForDocument): (ScriptInterpreter::mark): (ScriptInterpreter::forgetDOMObjectsForDocument): (ScriptInterpreter::updateDOMObjectDocument): * khtml/ecma/kjs_binding.h: (KJS::ScriptInterpreter::getDOMObject): (KJS::ScriptInterpreter::putDOMObject): (KJS::ScriptInterpreter::deleteDOMObject): 2004-06-15 Darin Adler - rolled out Ken's fix for assertion failure in AppendNodeCommandImpl::doApply due to non-0 exception code trying to insert a DIV markup string (it was making most layout tests fail) * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::checkAddChild): Rolled check back in. 2004-06-15 David Hyatt Add a truncation variable to text run boxes that will eventually be used to know how to cut out some of the glyphs when rendering. Reviewed by darin * khtml/rendering/render_text.cpp: (RenderText::clearTextOverflowTruncation): * khtml/rendering/render_text.h: (khtml::InlineTextBox:::InlineRunBox): (khtml::InlineTextBox::clearTruncation): 2004-06-14 Darin Adler Reviewed by Maciej. - fixed some things for GC that Patrick missed, or that happened after the branch * kwq/DOM-CSS.mm: (-[DOMStyleSheet finalize]): Added. (-[DOMStyleSheetList finalize]): Added. (-[DOMCSSStyleSheet finalize]): Added. (-[DOMMediaList finalize]): Added. (-[DOMCSSRuleList finalize]): Added. (-[DOMCSSRule finalize]): Added. (-[DOMCSSStyleDeclaration finalize]): Added. (-[DOMCSSValue finalize]): Added. (-[DOMRGBColor finalize]): Added. (-[DOMRect finalize]): Added. (-[DOMCounter finalize]): Added. * kwq/DOM.mm: (-[DOMObject finalize]): Added. (-[DOMNode finalize]): Added. (-[DOMNamedNodeMap finalize]): Added. (-[DOMNodeList finalize]): Added. (-[DOMImplementation finalize]): Added. (-[DOMRange finalize]): Added. (-[DOMNodeFilter finalize]): Added. (-[DOMNodeIterator finalize]): Added. (-[DOMTreeWalker dealloc]): Removed unneeded nil check. (-[DOMTreeWalker finalize]): Added. * kwq/DOMHTML.mm: (-[DOMHTMLCollection finalize]): Added. (-[DOMHTMLOptionsCollection finalize]): Added. * kwq/KWQClipboard.mm: (KWQClipboard::KWQClipboard): Use KWQRetain instead of retain. (KWQClipboard::~KWQClipboard): Use KWQRelease instead of release. * kwq/KWQEditCommand.mm: (-[KWQEditCommand finalize]): Added. * kwq/KWQFont.mm: (QFont::~QFont): Use KWQRelease instead of release. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::keyEvent): Use KWQRetain instead of retain, and KWQRelease instead of release. (KWQKHTMLPart::mouseDown): Use KWQRetain instead of retain, and KWQRelease instead of release. (KWQKHTMLPart::mouseDragged): Use KWQRetain instead of retain, and KWQRelease instead of release. (KWQKHTMLPart::mouseUp): Use KWQRetain instead of retain, and KWQRelease instead of release. (KWQKHTMLPart::mouseMoved): Use KWQRetain instead of retain, and KWQRelease instead of release. (KWQKHTMLPart::sendContextMenuEvent): Use KWQRetain instead of retain, and KWQRelease instead of release. * kwq/KWQPageState.mm: (-[KWQPageState finalize]): Added. Filed about the fact that this is not right. * kwq/KWQTimer.mm: (-[KWQSingleShotTimerTarget finalize]): Added. * kwq/WebCoreBridge.mm: (-[WebCoreBridge finalize]): Added. Filed about the fact that this is not right. 2004-06-15 David Hyatt Initial work on text truncation. Working top-down, I think I've made all the changes I will need to bidi.cpp and to the block code itself. The rest of the code can be concentrated in the render_line and render_text files. Reviewed by darin * khtml/rendering/bidi.cpp: (khtml::RenderBlock::layoutInlineChildren): (khtml::RenderBlock::findNextLineBreak): (khtml::RenderBlock::deleteEllipsisLineBoxes): (khtml::RenderBlock::checkLinesForTextOverflow): * khtml/rendering/render_block.h: * khtml/rendering/render_line.cpp: (RootInlineBox::detach): (RootInlineBox::detachEllipsisBox): (RootInlineBox::canAccommodateEllipsis): (RootInlineBox::placeEllipsis): * khtml/rendering/render_line.h: (khtml::RootInlineBox::RootInlineBox): * khtml/rendering/render_text.cpp: (RenderText::clearTextOverflowTruncation): * khtml/rendering/render_text.h: 2004-06-14 Trey Matteson 3692690 - REGRESSION: canceling drag from WebView cause link to load Just need to take extra care to cancel any click handling in all cases once we're committed to doing the drag. Reviewed by Darin. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): Call invalidateClick once we're past the hysteresis point, and definitely going to try to start a drag and drop. 2004-06-14 Darin Adler - fixed crash on boot * kwq/KWQFoundationExtras.h: (KWQRetainNSRelease): Fixed return value of this method; was uninitialized. 2004-06-14 Trey Matteson Dashboard wants access to pastboard data during the drag gesture. We address this need be allowing docs that are local files to access the pasteboard data during a drag, while other pages can only get at the types list until the drop happens. This is deemed safe because local files already have such broad super powers. Reviewed by Maciej. * kwq/KWQKURL.h: * kwq/KWQKURL.mm: (KURL::isLocalFile): Implement this QT method to look for the file scheme. * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragOperationForDraggingInfo:]): Use more relaxed clipboard security for local file pages. (-[WebCoreBridge dragExitedWithDraggingInfo:]): Ditto. 2004-06-14 Darin Adler Reviewed by me, code changes by Patrick Beard. - fixed : (WebKit should adopt GC changes and compile with GC enabled) * WebCore.pbproj/project.pbxproj: Added KWQFoundationExtras.h. * kwq/KWQFoundationExtras.h: Added. (KWQRetain): Cover for CFRetain that is tolerant of nil. (KWQRelease): Cover for CFRelease that is tolerant of nil. (KWQRetainNSRelease): Combination of a CFRetain and an -[NSObject release] that is tolerant of nil. Also includes a declaration of finalize so we can call [super finalize] without warnings on Panther. * kwq/DOM.mm: (ObjCNodeFilterCondition::ObjCNodeFilterCondition): Use CFRetain instead of retain. (ObjCNodeFilterCondition::~ObjCNodeFilterCondition): Use CFRelease instead of release. * kwq/KWQComboBox.mm: (QComboBox::~QComboBox): Use KWQRelease instead of release. (QComboBox::setFont): Use KWQRelease instead of release. (QComboBox::labelFont): Use KWQRetain instead of retain. * kwq/KWQCursor.mm: (QCursor::QCursor): Use KWQRetain instead of retain. (QCursor::~QCursor): Use KWQRelease instead of release. (QCursor::operator=): More of the same. * kwq/KWQFileButton.mm: (KWQFileButton::KWQFileButton): Use KWQRetainNSRelease to retain a newly-allocated object. (KWQFileButton::~KWQFileButton): Use CFRelease instead of release. * kwq/KWQFont.mm: (QFont::QFont): Use KWQRetain instead of retain. (QFont::operator=): More of the same. (QFont::setFamily): Use KWQRelease instead of release. (QFont::setFirstFamily): Use KWQRelease instead of release. (QFont::setPixelSize): Use KWQRelease instead of release. (QFont::setWeight): Use KWQRelease instead of release. (QFont::setItalic): Use KWQRelease instead of release. (QFont::getNSFont): Use KWQRetain instead of retain. * kwq/KWQFontMetrics.mm: (QFontMetricsPrivate::~QFontMetricsPrivate): Use KWQRelease instead of release. (QFontMetricsPrivate::getRenderer): Use KWQRetain instead of retain. (QFontMetricsPrivate::setFont): Use KWQRelease instead of release. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::~KWQKHTMLPart): Use KWQRelease instead of release. (KWQKHTMLPart::clearRecordedFormValues): Use KWQRelease instead of release. (KWQKHTMLPart::recordFormValue): Use KWQRetainNSRelease and use KWQRetain instead of retain. (KWQKHTMLPart::windowScriptObject): Use KWQRetainNSRelease. * kwq/KWQKJobClasses.mm: (KIO::TransferJobPrivate::TransferJobPrivate): Use KWQRetainNSRelease. (KIO::TransferJobPrivate::~TransferJobPrivate): Use KWQRelease instead of release. (KIO::TransferJob::setLoader): More of the same. * kwq/KWQLoader.mm: (KWQRetainResponse): Use KWQRetain instead of retain. (KWQReleaseResponse): Use KWQRelease instead of release. * kwq/KWQPainter.mm: (QPainterPrivate::~QPainterPrivate): Use KWQRelease instead of release. (QPainter::_updateRenderer): More of the same. (QPainter::initFocusRing): Use KWQRetainNSRelease. (QPainter::clearFocusRing): Use KWQRelease instead of release. * kwq/KWQPixmap.mm: (QPixmap::QPixmap): Use KWQRetain instead of retain. (QPixmap::~QPixmap): Use KWQRelease instead of release. (QPixmap::receivedData): Use KWQRetain instead of retain. (QPixmap::resize): Use KWQRetainNSRelease and use KWQRelease instead of release. (QPixmap::operator=): More of the same. * kwq/KWQRegion.mm: (QRegion::QRegion): Use KWQRetain instead of retain. (QRegion::~QRegion): Use KWQRelease instead of release. (QRegion::operator=): More of the same. * kwq/KWQTimer.mm: (QTimer::start): Use KWQRetain instead of retain. (QTimer::stop): Use KWQRelease instead of release. (QTimer::fire): Use KWQRelease instead of release. * kwq/KWQWidget.mm: (QWidget::QWidget): Use KWQRetain instead of retain. (QWidget::~QWidget): Use KWQRelease instead of release. (QWidget::setView): More of the same. * kwq/WebCoreSettings.mm: (-[WebCoreSettings finalize]): Delete the storage here, as well as in dealloc. 2004-06-14 Maciej Stachowiak Reviewed by Trey. : (Safari should use CG calls for circle drawing for better performance) * kwq/KWQPainter.mm: (QPainter::drawEllipse): Use CG calls instead of NS calls for faster circle drawing. (QPainter::drawArc): Ditto. 2004-06-14 Ken Kocienda Reviewed by Vicki Fix for this bug: Crash deleting text out of iChat's profile (an editable Webview) * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::isFocusable): Added null-check of parent node before deref'ing it. 2004-06-14 Trey Matteson Two tweaks to recently added "drag" pseudo-class, as suggested by Dave. The class is renamed to "-khtml-drag", and we update layout when using it, instead of only updating styles. Reviewed by hyatt. * khtml/css/css_base.cpp: (CSSSelector::extractPseudoType): * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::snapshotDragImage): 2004-06-13 Trey Matteson Support for DHTML cut/copy/paste. We now support oncut, oncopy, onpaste. The events are sent to the first node in the selection, or else the body. Current holes are that we do not send events for operations in text fields or text areas (because it is hard to get the right hooks into the AppKit). We also send onbeforecut, onbeforecopy, onbeforepaste before the other events, which isn't really WinIE compatible, but is close. WinIE uses these to enable cut/paste menu items in its UI. DB doesn't need this for now. Reviewed by Chris * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Boilerplate for new events (DOMNode::putValue): Boilerplate for new events * khtml/ecma/kjs_dom.h: (KJS::DOMNode::): Boilerplate for new events * khtml/ecma/kjs_dom.lut.h: * khtml/ecma/kjs_events.cpp: (DOMEvent::DOMEvent): "dataTransfer" and "clipboardData" properties are conditionally defined on DOMEvent, depending on if the event is a dragging or clipboard event. (DOMMouseEvent::mark): Pass mark along to any clipboard object we have. (DOMEvent::getValueProperty): Return "dataTransfer" or "clipboardData". (DOMMouseEvent::getValueProperty): Returning "dataTransfer" now handled by the superclass. * khtml/ecma/kjs_events.h: (KJS::DOMEvent::): (KJS::DOMMouseEvent::DOMMouseEvent): (KJS::DOMMouseEvent::): (KJS::DOMMouseEvent::toMouseEvent): * khtml/ecma/kjs_events.lut.h: * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Boilerplate for new events * khtml/misc/htmlattrs.c: * khtml/misc/htmlattrs.h: * khtml/misc/htmlattrs.in: Boilerplate for new events * khtml/xml/dom2_eventsimpl.cpp: (EventImpl::typeToId): Boilerplate for new events (EventImpl::idToType): Boilerplate for new events (EventImpl::isDragEvent): New utility (EventImpl::isClipboardEvent): New utility (MouseEventImpl::isDragEvent): New utility (ClipboardEventImpl::ClipboardEventImpl): ref optional clipboard (ClipboardEventImpl::~ClipboardEventImpl): deref optional clipboard (ClipboardEventImpl::isClipboardEvent): New utility * khtml/xml/dom2_eventsimpl.h: (DOM::EventImpl::): Boilerplate for new events (DOM::ClipboardEventImpl::clipboard): * kwq/KWQClipboard.h: Monkey business so this file is includable in C++. * kwq/KWQClipboard.mm: * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::dispatchCPPEvent): Send one of the new events. (KWQKHTMLPart::tryCut): Declare pasteboard types, send cut events. (KWQKHTMLPart::tryCopy): Declare pasteboard types, send copy events. (KWQKHTMLPart::tryPaste): Send paste events. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge tryDHTMLCut]): Pass through to part (-[WebCoreBridge tryDHTMLCopy]): Ditto (-[WebCoreBridge tryDHTMLPaste]): Ditto 2004-06-14 Trey Matteson A new CSS pseudo-class ".drag" is added. Analogous to the "hover" class, this class determines styles used while an element is generating a drag image. Reviewed by hyatt. * khtml/css/css_base.cpp: (CSSSelector::extractPseudoType): Boilerplate for adding new class. * khtml/css/css_base.h: Boilerplate for adding new class. * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::checkOneSelector): Match new class against elements being dragged. * khtml/css/cssstyleselector.h: (khtml::StyleSelector::): Boilerplate for adding new class. * khtml/rendering/render_object.cpp: (RenderObject::RenderObject): Init new member. (RenderObject::isDragging): Return whether this object is being dragged. (RenderObject::updateDragState): Paint us an all children with a new dragged state. * khtml/rendering/render_object.h: * khtml/rendering/render_style.h: Boilerplate for adding new class. (khtml::RenderStyle::NonInheritedFlags::operator==): (khtml::RenderStyle::setBitDefaults): (khtml::RenderStyle::affectedByDragRules): (khtml::RenderStyle::setAffectedByDragRules): * kwq/KWQClipboard.mm: (KWQClipboard::dragNSImage): Method rename. * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::snapshotDragImage): Mark the element as being dragged before we snapshot it, so new style class will apply. 2004-06-14 Ken Kocienda Reviewed by me Added a few more editing-related layout tests. * layout-tests/editing/inserting/insert-3654864-fix-expected.txt: Added. * layout-tests/editing/inserting/insert-3654864-fix.html: Added. * layout-tests/editing/inserting/insert-3659587-fix-expected.txt: Added. * layout-tests/editing/inserting/insert-3659587-fix.html: Added. * layout-tests/editing/inserting/insert-after-delete-001-expected.txt: Added. * layout-tests/editing/inserting/insert-after-delete-001.html: Added. * layout-tests/editing/inserting/insert-br-case1-expected.txt: Added. * layout-tests/editing/inserting/insert-br-case1.html: Added. * layout-tests/editing/inserting/insert-br-case2-expected.txt: Added. * layout-tests/editing/inserting/insert-br-case2.html: Added. * layout-tests/editing/inserting/insert-br-case3-expected.txt: Added. * layout-tests/editing/inserting/insert-br-case3.html: Added. 2004-06-14 Ken Kocienda Reviewed by me Regarding the bug below, removing some tests since we have removed the execCommand("paste") feature, at least for now. : (JavaScript execCommand("paste") presents security issues) * layout-tests/editing/pasteboard/copy-paste-text-001-expected.txt: Removed. * layout-tests/editing/pasteboard/copy-paste-text-001.html: Removed. * layout-tests/editing/pasteboard/cut-paste-text-002-expected.txt: Removed. * layout-tests/editing/pasteboard/cut-paste-text-002.html: Removed. 2004-06-14 Ken Kocienda Reviewed by Darin Fix for this bug: assertion failure in AppendNodeCommandImpl::doApply due to non-0 exception code trying to insert a DIV markup string * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::checkAddChild): This function was being too strict in disallowing certain nodes to be added as other child nodes, applying rules we typically use for parsing. However, those parsing rules are primarily for dealing with "bad" HTML, and should not be applied to programmatic DOM operations. The fix involves removing calls to childAllowed(). 2004-06-12 Trey Matteson The drag image may be updated during a DHTML drag. This includes updating from a Timer instead of a drag event handler. In addition, an arbitrary element can be set as the one to snapshot for the drag image. Reviewed by John * khtml/ecma/kjs_events.cpp: (ClipboardProtoFunc::tryCall): setDragImage accepts a node. Previously, it had to be an Image object. * khtml/rendering/render_object.cpp: (RenderObject::paintingRootRect): Also returns top element's rect. * khtml/rendering/render_object.h: * khtml/xml/dom2_eventsimpl.h: * kwq/KWQClipboard.h: New security mode where image is still writable, but pasteboard is not. (KWQClipboard::): (KWQClipboard::setDragHasStarted): * kwq/KWQClipboard.mm: (KWQClipboard::KWQClipboard): Part may be passed. Needed in the source case to generate an image from an element. (KWQClipboard::setAccessPolicy): New, replaces former becomeNumb method which wasn't flexible enough. (KWQClipboard::accessPolicy): New getter. (KWQClipboard::dragImage): No change, diff confusion. (KWQClipboard::setDragImage): Call new helper, below. (KWQClipboard::dragImageElement): New, return any element set. (KWQClipboard::setDragImageElement): New, call new helper. (KWQClipboard::setDragImage): New helper, set the image via either a pixmap or an element to snapshot, pushes the result to WebKit if we've already started the drag. (KWQClipboard::dragNSImage): Generate an NSImage and mouse offset, no matter how the drag image was set (Image or element). * kwq/KWQKHTMLPart.h: A single clipboard is kept over the life of a source drag instead of making one for each event. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::KWQKHTMLPart): Init clipboard. (KWQKHTMLPart::~KWQKHTMLPart): Free clipboard. (KWQKHTMLPart::freeClipboard): New helper. (KWQKHTMLPart::dispatchDragSrcEvent): Most code moved to caller. (KWQKHTMLPart::khtmlMouseMoveEvent): Make clipboard for this drag session. Init clipboard to make an image from the dragSource element. Mark the drag as having started. (KWQKHTMLPart::dragSourceMovedTo): Clipboard will update WK with any new drag image, so we don't need to. (KWQKHTMLPart::dragSourceEndedAt): Ditto. (KWQKHTMLPart::elementImage): Also return element rect. * kwq/WebCoreBridge.h: Glue moved to WebCoreGraphicsBridge. * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragOperationForDraggingInfo:]): Use new method. (-[WebCoreBridge dragExitedWithDraggingInfo:]): Ditto (-[WebCoreBridge concludeDragForDraggingInfo:]): Ditto * kwq/WebCoreGraphicsBridge.h: * kwq/WebCoreGraphicsBridge.m: (-[WebCoreGraphicsBridge setDraggingImage:at:]): Glue moved from WebBridge 2004-06-11 Chris Blumenberg Support for WebKit drag & drop API. Reviewed by trey. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge _positionForPoint:]): new (-[WebCoreBridge moveDragCaretToPoint:]): call _positionForPoint (-[WebCoreBridge editableDOMRangeForPoint:]): new 2004-06-11 Darin Adler Reviewed by Dave. - fixed : (REGRESSION: Stuck "Loading" when logging into Google's Gmail on newer versions of Safari) * khtml/html/html_baseimpl.cpp: (HTMLFrameElementImpl::parseHTMLAttribute): Call through to base class for ATTR_ID so the "has ID" bit gets set. * khtml/html/html_imageimpl.cpp: (HTMLImageElementImpl::parseHTMLAttribute): Move ATTR_COMPOSITE code up and out of the way so it doesn't screw up ATTR_ID parsing. (HTMLMapElementImpl::parseHTMLAttribute): Call through to base class for ATTR_ID so the "has ID" bit gets set. * khtml/html/html_objectimpl.cpp: (HTMLAppletElementImpl::parseHTMLAttribute): Remove ATTR_ID case; not needed. (HTMLParamElementImpl::parseHTMLAttribute): Call through to base class for ATTR_ID so the "has ID" bit gets set. 2004-06-11 Ken Kocienda Reviewed by Hyatt Fix for this bug: : "when typing in Blot, bold style does not carry over to next line after pressing 'return'" Did some work to improve the insert newline command. The refinement is to insert the newline at the upstream position of the caret, ensuring that the newline takes on the appropriate style, and does not let the caret "escape" from an element that is conferring style. * khtml/editing/htmlediting_impl.cpp: (khtml::InputNewlineCommandImpl::insertNodeAfterPosition): New helper. Adds smarts about adding newlines when the selection is a caret in a block. (khtml::InputNewlineCommandImpl::insertNodeBeforePosition): Ditto. (khtml::InputNewlineCommandImpl::doApply): Simplified cases. One case in the code could not happen. * khtml/editing/htmlediting_impl.h: Fix for this bug: : "Pasting content at start of line places it at end of previous line" (khtml::InputTextCommandImpl::prepareForTextInsertion): Simple code mistake. Content was indeed being added to the line before. Fixed to add new content after the line break. 2004-07-10 Trey Matteson Prep work for latest delegate API for dragging. In addition, I also straightened out all the cases of DHTML setting a drag image or setting pasteboard data, and how that would override WebKit's default behavior (which follows how WinIE does things). Reviewed by Chris. * khtml/rendering/render_object.cpp: (RenderObject::draggableNode): Obey new params for whether a DHTML or UserAgent (i.e., WebKit) drag source is allowed. * khtml/rendering/render_object.h: * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::dispatchDragSrcEvent): Setting pasteboard data was moved out of here, now caller's responsibility. (KWQKHTMLPart::khtmlMouseMoveEvent): Ask bridge for allowable drag actions (DHTML vs UA). Only send drag events if DHTML is allowed. Only generate a drag image if the source is a DHTML element. Note whether event handler set any pasteboard data, and pass that fact to WebKit. (KWQKHTMLPart::dragSourceMovedTo): Only send drag events if DHTML is allowed. (KWQKHTMLPart::dragSourceEndedAt): Only send drag events if DHTML is allowed. * kwq/WebCoreBridge.h: 2004-06-11 Ken Kocienda Reviewed by Trey Lay some groundwork for better testing of inserting newlines. Layout tests that use this new code will be coming soon. * khtml/editing/jsediting.cpp: Add commands for bold and inserting newlines. * layout-tests/editing/editing.js: Added new insertNewline command. which calls through to TypingCommand::insertNewline. There was no way to get to this command from JS before this addition. 2004-06-11 Ken Kocienda Reviewed by Darin Javascript execCommand system wants to use case-insensitive QDict. The interface for QDict offers this feature, but it was never implemented. Now it is. * kwq/KWQDictImpl.h: Declare bool to store case-sensitive bit. * kwq/KWQDictImpl.mm: (KWQDictImpl::KWQDictImpl): No longer drops caseSensitive on the floor; stores it in instance variable. (KWQDictImpl::insert): Make lowercase version of key for operation, if necessary. (KWQDictImpl::remove): Ditto. (KWQDictImpl::find): Ditto. (KWQDictIteratorImpl::currentStringKey): Whitespace cleanup. === Safari-144 === 2004-06-10 Ken Kocienda Reviewed by Darin Fix for this bug: : "Style changes do not work across blocks" Now, applying styles works across blocks. I did quite a bit of internal redsign on the member functions of this class to make this work. As a bonus, from an architectural standpoint, all style changes are now done "in place". There is no more copying of content in order to perform style changes. * khtml/editing/htmlediting_impl.cpp: (khtml::ApplyStyleCommandImpl::doApply): (khtml::ApplyStyleCommandImpl::removeHTMLStyleNode): (khtml::ApplyStyleCommandImpl::removeCSSStyle): (khtml::ApplyStyleCommandImpl::removeStyle): (khtml::ApplyStyleCommandImpl::nodeFullySelected): (khtml::ApplyStyleCommandImpl::splitTextAtStartIfNeeded): (khtml::ApplyStyleCommandImpl::splitTextAtEndIfNeeded): (khtml::ApplyStyleCommandImpl::surroundNodeRangeWithElement): (khtml::ApplyStyleCommandImpl::applyStyleIfNeeded): (khtml::ApplyStyleCommandImpl::positionInsertionPoint): * khtml/editing/htmlediting_impl.h: 2004-06-10 Darin Adler Reviewed by Ken. - filled out execCommand a lot more - fixed : (execCommand italic is not implemented) - fixed : (execCommand bold is not implemented) - fixed : (Make queryCommandIndeterm work as specified in the Javascript execCommand Compatibility Plan) - fixed : (Make queryCommandState work as specified in the Javascript execCommand Compatibility Plan) - fixed : (Make queryCommandValue work as specified in the Javascript execCommand Compatibility Plan) * khtml/editing/jsediting.cpp: (DOM::JSEditor::queryCommandIndeterm): Changed to use KHTMLPart::TriState instead of CommandState. (DOM::JSEditor::queryCommandState): Ditto. (execStyleChange): Changed to use KHTMLPart::applyStyle. (stateStyle): Used KHTMLPart::selectionHasStyle for this. (selectionStartHasStyle): Use KHTMLPart::selectionStartHasStyle for this. (valueStyle): Used KHTMLPart::selectionStartStylePropertyValue for this. (execBold): Implemented toggling, using selectionStartHasStyle. (execItalic): Implemented toggling, using selectionStartHasStyle. (execPrint): Implemented. (enabledRedo): Implemented, using canRedo. (enabledUndo): Implemented, using canUndo. (stateNone): Renamed from stateNo. (valueBackColor): Implemented, using valueStyle. (valueFontName): Implemented, using valueStyle. (valueFontSize): Implemented, using valueStyle. (valueForeColor): Implemented, using valueStyle. (valueFontSize): Implemented, using valueStyle. * khtml/khtml_part.h: Added editing operations. * khtml/khtml_part.cpp: (KHTMLPart::copyToPasteboard): Added. (KHTMLPart::cutToPasteboard): Added. (KHTMLPart::redo): Added. (KHTMLPart::undo): Added. (KHTMLPart::applyStyle): Added. (updateState): Added. (KHTMLPart::selectionHasStyle): Added. (KHTMLPart::selectionStartHasStyle): Added. (KHTMLPart::selectionStartStylePropertyValue): Added. (KHTMLPart::selectionComputedStyle): Added. (KHTMLPart::print): Added. * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Call print() on plain old part, not KWQ(part). * kwq/KWQKHTMLPart.h: Removed print(), added _haveUndoRedoOperations. * kwq/KWQKHTMLPart.mm: (KHTMLPart::print): Moved from KWQKHTMLPart to KHTMLPart. (KWQKHTMLPart::registerCommandForUndo): Moved code here from bridge. (KWQKHTMLPart::registerCommandForRedo): Moved code here from bridge. (KWQKHTMLPart::clearUndoRedoOperations): Moved code here from bridge. (KWQKHTMLPart::issueUndoCommand): Moved code here from bridge. (KWQKHTMLPart::issueRedoCommand): Moved code here from bridge. (KWQKHTMLPart::issuePasteCommand): Moved code here from bridge. (KHTMLPart::canUndo): Added. (KHTMLPart::canRedo): Added. * kwq/WebCoreBridge.h: Added undoManager, removed undo-related methods. * kwq/WebCoreBridge.mm: (-[WebCoreBridge applyStyle:]): Changed to call KHTMLPart::applyStyle. * WebCore.pbproj/.cvsignore: Updated for new Xcode files. 2004-06-09 Maciej Stachowiak Reviewed by Dave. : Blot scrolls to the top every time you type * khtml/xml/dom_selection.cpp: (DOM::Selection::getRepaintRect): If the caret position is invalid, recompute it. 2004-06-09 David Hyatt Fix for 3607091, implement a style that prevents zoom and min font size from taking effect. The name of the new style is "-apple-text-size-adjust" with values of "none" and "auto." The default is "auto." Reviewed by mjs * khtml/css/cssparser.cpp: (CSSParser::parseValue): * khtml/css/cssproperties.c: (hash_prop): (findProp): * khtml/css/cssproperties.h: * khtml/css/cssproperties.in: * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::styleForElement): (khtml::CSSStyleSelector::pseudoStyleForElement): (khtml::CSSStyleSelector::applyDeclarations): (khtml::CSSStyleSelector::applyProperty): (khtml::CSSStyleSelector::checkForTextSizeAdjust): * khtml/css/cssstyleselector.h: * khtml/rendering/render_style.cpp: (textSizeAdjust): (StyleCSS3InheritedData): (StyleCSS3InheritedData::operator==): (RenderStyle::diff): * khtml/rendering/render_style.h: (khtml::RenderStyle::lineClamp): (khtml::RenderStyle::textSizeAdjust): (khtml::RenderStyle::setTextSizeAdjust): (khtml::RenderStyle::initialTextSizeAdjust): 2004-06-09 David Hyatt Implement parsing and setting of the text-overflow CSS3 property. Reviewed by kocienda * khtml/css/cssparser.cpp: (CSSParser::parseValue): * khtml/css/cssproperties.c: (hash_prop): (findProp): * khtml/css/cssproperties.h: * khtml/css/cssproperties.in: * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty): * khtml/css/cssvalues.c: (hash_val): (findValue): * khtml/css/cssvalues.h: * khtml/css/cssvalues.in: * khtml/rendering/render_style.cpp: (textOverflow): (StyleCSS3NonInheritedData::operator==): (RenderStyle::diff): * khtml/rendering/render_style.h: (khtml::RenderStyle::textOverflow): (khtml::RenderStyle::setTextOverflow): (khtml::RenderStyle::initialTextOverflow): 2004-06-09 David Hyatt Fix for 3678031, implement better flexing for Emerson headers. This involved adding support for max-width: intrinsic, fixing the box layout algorithm to properly deal with max-widths, and implementing support for baseline alignment so that boxes can be aligned vertically along their interior baselines. Reviewed by kocienda * khtml/css/cssparser.cpp: (CSSParser::parseValue): (CSSParser::parseShadow): * khtml/css/cssparser.h: * khtml/css/cssproperties.c: (hash_prop): (findProp): * khtml/css/cssproperties.h: * khtml/css/cssproperties.in: * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty): * khtml/css/cssvalues.c: (hash_val): (findValue): * khtml/css/cssvalues.h: * khtml/css/cssvalues.in: * khtml/misc/khtmllayout.h: (khtml::): * khtml/rendering/render_block.cpp: (khtml::RenderBlock::baselinePosition): (khtml::RenderBlock::getBaselineOfFirstLineBox): * khtml/rendering/render_block.h: * khtml/rendering/render_box.cpp: (RenderBox::RenderBox): (RenderBox::overrideWidth): (RenderBox::overrideHeight): (RenderBox::calcWidth): (RenderBox::calcHeight): * khtml/rendering/render_box.h: (khtml::RenderBox::overrideSize): (khtml::RenderBox::setOverrideSize): * khtml/rendering/render_flexbox.cpp: (khtml::RenderFlexibleBox::calcMinMaxWidth): (khtml::RenderFlexibleBox::layoutBlock): (khtml::RenderFlexibleBox::layoutHorizontalBox): (khtml::RenderFlexibleBox::layoutVerticalBox): (khtml::RenderFlexibleBox::placeChild): (khtml::RenderFlexibleBox::allowedChildFlex): * khtml/rendering/render_flexbox.h: * khtml/rendering/render_image.cpp: (RenderImage::isWidthSpecified): (RenderImage::isHeightSpecified): * khtml/rendering/render_object.h: (khtml::RenderObject::getBaselineOfFirstLineBox): (khtml::RenderObject::overrideSize): (khtml::RenderObject::overrideWidth): (khtml::RenderObject::overrideHeight): (khtml::RenderObject::setOverrideSize): * khtml/rendering/render_style.cpp: (StyleFlexibleBoxData::StyleFlexibleBoxData): (StyleFlexibleBoxData::operator==): (ShadowData::operator==): * khtml/rendering/render_style.h: (khtml::RenderStyle::boxPack): (khtml::RenderStyle::setBoxPack): * khtml/rendering/table_layout.cpp: (AutoTableLayout::layout): 2004-06-09 Richard Williamson Added support for drawing un-rasterized transformed PDFs. Reviewed by John. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): 2004-06-09 Darin Adler Reviewed by Ken. - implemented still more execCommand commands * khtml/editing/jsediting.cpp: Added a lot more commands, and reformatted a bit. 2004-06-08 Darin Adler Reviewed by Maciej. - implemented a bunch more execCommand commands - fixed : (JavaScript execCommand("paste") presents security issues) - fixed : (Make queryCommandEnabled work as specified in the Javascript execCommand Compatibility Plan) - fixed : (Make queryCommandSupported work as specified in the Javascript execCommand Compatibility Plan) - about half of : (execCommand italic is not implemented) - about half of : (execCommand bold is not implemented) * khtml/editing/jsediting.h: Made constructor inline. Deleted a few unneeded member functions that are now just private functions inside jsediting.cpp. * khtml/editing/jsediting.cpp: (commandImp): Changed this around, so the dictionary is a static local to this function, and initialized with C++ "first time initialization" rule. (DOM::JSEditor::execCommand): Got rid of special case for 0 for function pointer and added const. (DOM::JSEditor::queryCommandEnabled): Ditto. (DOM::JSEditor::queryCommandIndeterm): Got rid of special case for 0 for function pointer, added const, and use a common three-state state function rather than a separate "indeterm" function. (DOM::JSEditor::queryCommandState): Ditto. (DOM::JSEditor::queryCommandValue): More of the same. (execNotImplemented): Added. Used for unimplemented commands; there are only a few left. (execCopy): Renamed. (execCut): Renamed. (execDelete): Renamed. (execInsertText): Renamed. (execPaste): Renamed, and disabled. (execRedo): Renamed. (execSelectAll): Renamed. (execUndo): Renamed. (execStyleChange): Added. Helper function for commands that are style changes. (execBold): Added. (execItalic): Added. (execJustifyCenter): Added. (execJustifyFull): Added. (execJustifyLeft): Added. (execJustifyRight): Added. (execSubscript): Added. (execSuperscript): Added. (execUnselect): Added. (stateNotImplemented): Added. Used for unimplemented state queries; there are a few left. (noState): Added. (valueNotImplemented): Added. Used for unimplemented value queries; there are a few left. (nullStringValue): Added. (createCommandDictionary): Changed the initDict function into this function. Added implementations for many commands and condensed format so it's easier to work with. 2004-06-08 Darin Adler Reviewed by Vicki. - our part of fix to : (REGRESSION (Tiger): titles on pop-ups menus are truncated and show ellipses) * kwq/KWQComboBox.mm: (QComboBox::QComboBox): Call setLineBreakMode:NSLineBreakByClipping. In the current version of Tiger I am using, this is not implemented yet. - a couple of other unrelated changes * khtml/rendering/render_form.cpp: (RenderTextArea::calcMinMaxWidth): Put a little more code inside the APPLE_CHANGES ifdef. * kwq/KWQTextEdit.h: Remove unused setTabStopWidth function, and make empty setTextFormat function an inline for slightly smaller code size. * kwq/KWQTextEdit.mm: Ditto. * kwq/KWQTextField.mm: Update copyright date. 2004-06-08 Trey Matteson A DHTML drag source can now change the dragging image during the drag. Currently it may only be set to a static image. Reviewed by John * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::dragSourceMovedTo): If the ondrag event handler set an image, pass it to WebKit. * kwq/WebCoreBridge.h: 2004-06-08 Ken Kocienda Reviewed by Hyatt Changes to the selection state for these tests as a result of my previous checkin. The changes are minor to a couple of offsets. I looked at the changes and approve them. * layout-tests/editing/deleting/delete-block-contents-001-expected.txt * layout-tests/editing/deleting/delete-block-contents-002-expected.txt * layout-tests/editing/deleting/delete-block-contents-003-expected.txt 2004-06-08 Ken Kocienda Reviewed by Hyatt Fix for this bug: : "Hitting delete key with start of block selected does not merge content with preceding block" Selections that span blocks now work correctly for deleting the selection and inserting over the selection. The largest part of the change is adding a new field to the RemoveNodeAndPruneCommand and its impl version. This was done since the starting block for a multi-block selection should always be preserved when deleting, and this was a convenient way to express this using the code structure already in place. * khtml/editing/htmlediting.cpp: (khtml::RemoveNodeAndPruneCommand::RemoveNodeAndPruneCommand): Modify this command to take two nodes: the node to remove and a node to stop at when pruning back up the tree. (khtml::RemoveNodeAndPruneCommand::pruneNode): New accessor, replaces old node() accessor. (khtml::RemoveNodeAndPruneCommand::stopNode): New accessor for additional feature described above. * khtml/editing/htmlediting.h: * khtml/editing/htmlediting_impl.cpp: (khtml::shouldPruneNode): blow flow renderers can now be deleted, but not if they are a rootEditableElement. (khtml::CompositeEditCommandImpl::removeNodeAndPrune): Pass new stopNode param and change the name of the existing node argument to pruneNode to distinguish it. (khtml::DeleteSelectionCommandImpl::doApply): Pass the block containing the start of the selection to removeNodeAndPrune in each case. Also, add one little loop to move all the content from the block containing the end of the selection if that block is different than the start block. (khtml::RemoveNodeAndPruneCommandImpl::RemoveNodeAndPruneCommandImpl): Implement the pruneNode/stopNode design already described. (khtml::RemoveNodeAndPruneCommandImpl::~RemoveNodeAndPruneCommandImpl): Manage the lifecycle of stopNode. (khtml::RemoveNodeAndPruneCommandImpl::doApply): Add a check to stop at the stop node while pruning. * khtml/editing/htmlediting_impl.h: (khtml::RemoveNodeAndPruneCommandImpl::pruneNode): New accessor. (khtml::RemoveNodeAndPruneCommandImpl::stopNode): Ditto. 2004-06-07 Trey Matteson Clipboard access during DHTML dragging is made secure. Reviewed by John. * kwq/KWQClipboard.h: (KWQClipboard::): * kwq/KWQClipboard.mm: (KWQClipboard::KWQClipboard): Init new policy and changeCount members. (KWQClipboard::becomeNumb): Set policy to numb. (KWQClipboard::clearData): Check policy. (KWQClipboard::clearAllData): Check policy. (KWQClipboard::getData): Check policy and changeCount. (KWQClipboard::setData): Check policy. (KWQClipboard::types): Check policy and ChangeCount. (KWQClipboard::setDragLocation): Check policy. (KWQClipboard::setDragImage): Check policy. (KWQClipboard::setDropEffect): Check policy. (KWQClipboard::setEffectAllowed): Check policy. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::dispatchDragSrcEvent): Set policy when creating clipboard, and numb-ify it when we're done. * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragOperationForDraggingInfo:]): Set policy when creating clipboard, and numb-ify it when we're done. (-[WebCoreBridge dragExitedWithDraggingInfo:]): Ditto (-[WebCoreBridge concludeDragForDraggingInfo:]): Ditto 2004-06-08 Ken Kocienda Reviewed by me * khtml/editing/jsediting.cpp: (DOM::EditorCommand::): Stray capital letter in "selectAll" command static initializer prevented the command from ever working since the command strings are lower-cased when trying to find a match, but not when they are inserted into the dictionary. This is a one character change to make the string "selectall" in the initializer. 2004-06-07 Trey Matteson WebCore will now generate a default drag image when an element serves as a drag source. The basic idea is the image contains the element and all its children. As for the implementation, instead of adding a new paintAction I added a new field to the paintInfo struct, "paintingRoot". If this field is set, painting will only paint that root's descendants. Some code also moved from the bridge to the part, to be available within WebCore. Reviewed by hyatt. * khtml/rendering/render_block.cpp: (khtml::RenderBlock::paintObject): Pass along paintingRoot to kids. (khtml::RenderBlock::paintFloats): Pass along paintingRoot to kids. * khtml/rendering/render_box.cpp: (RenderBox::paintBoxDecorations): Test paintingRoot before painting. * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint): Test paintingRoot before painting. * khtml/rendering/render_flow.cpp: (RenderFlow::paintLineBoxBackgroundBorder): Test paintingRoot before painting. (RenderFlow::paintLineBoxDecorations): Test paintingRoot before painting. * khtml/rendering/render_image.cpp: (RenderImage::paint): Test paintingRoot before painting. * khtml/rendering/render_inline.cpp: (RenderInline::paint): Pass along paintingRoot to kids. * khtml/rendering/render_layer.cpp: (RenderLayer::paint): Pass along paintingRoot to kids. (RenderLayer:: paintLayer): Pass along paintingRoot to kids. Test if we are within the paintingRoot to decide whether to pass the root to our renderer. * khtml/rendering/render_layer.h: * khtml/rendering/render_object.cpp: (RenderObject::hasAncestor): New utility. (RenderObject::absoluteBoundingBoxRect): Helper for paintingRootRect (RenderObject::addAbsoluteRectForLayer): Helper for paintingRootRect (RenderObject::paintingRootRect): Return rect that will be painted if we are the painting root. (RenderObject::draggableNode): Add test to avoid rare NULL ptr crash. * khtml/rendering/render_object.h: (khtml::RenderObject::PaintInfo::PaintInfo): Add paintingRoot field. (khtml::RenderObject::paintingRootForChildren): New utility. Return the current paintingRoot, or nil if we are the root (so kids draw normally). (khtml::RenderObject::shouldPaintWithinRoot): New utility. We can paint if we are the paintingRoot, or no root is set. * khtml/rendering/render_replaced.cpp: (RenderReplaced::shouldPaint): Pass along paintingRoot to kids. * khtml/rendering/render_table.cpp: (RenderTable::paint): Pass along paintingRoot to kids. * khtml/rendering/render_text.cpp: (RenderText::paint): Test paintingRoot before painting. * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::KWQKHTMLPart): Init new _elementToDraw member. (KWQKHTMLPart::paint): Generalized to handle cases of painting selection or a given element. (KWQKHTMLPart::khtmlMouseMoveEvent): Make a default image if dragSrc didn't provide one. (KWQKHTMLPart::selectionRect): Moved from bridge. (KWQKHTMLPart::visibleSelectionRect): Ditto. (KWQKHTMLPart::imageFromRect): Newly factored code, from bridge. (KWQKHTMLPart::selectionImage): Moved from bridge, wrapper around imageFromRect. (KWQKHTMLPart::elementImage): New method, wrapper around imageFromRect. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge drawRect:withPainter:]): Just call part to draw. (-[WebCoreBridge visibleSelectionRect]): Guts moved to part. (-[WebCoreBridge selectionImage]): Ditto. 2004-06-07 Darin Adler Reviewed by Chris. - fixed : (setTimeout fails when additional parameters are used and timeout function is a string) * khtml/ecma/kjs_window.cpp: (WindowFunc::tryCall): Ignore excess arguments instead of rejecting the argument list for window.scrollBy, scroll, scrollTo, moveBy, moveTo, resizeBy, resizeTo, and setTimeout (when the timeout is a string rather than an object). - did a refinement of JSEditor to be slightly more efficient, and not have to edit both the .cpp file and the .h when adding more implementation * khtml/khtml_part.h: Hack so we can get to the docImpl and xmlDocImpl without being a friend. * khtml/editing/jsediting.h: Simplified a bit. * khtml/editing/jsediting.cpp: Redid to use a table, and simplified a bit. 2004-06-07 Ken Kocienda Reviewed by Hyatt Fix for this bug: : "Typing style does not work yet" Did the final hook-up of support that has landed in the tree in the recent past as part of ongoing style-application work. For the most part, this patch modifies the InputNewlineCommandImpl and InputTextCommandImpl commands to insert a styling span when there is a typing style active. * khtml/editing/htmlediting_impl.cpp: (khtml::CompositeEditCommandImpl::createTypingStyleElement): Helper shared by the two commands modified. (khtml::InputNewlineCommandImpl::doApply): Create a styling span if the part has a typing style. Maintain a nodeToInsert local variable, which is either the break to insert or a styling span containing the break. Also, remove some utterly bogus derefs. They are just plain wrong. (khtml::InputTextCommandImpl::InputTextCommandImpl): Don't need to keep m_insertedTextNode. The composite commands this command uses will keep track of that object's lifetime. We do not need to do that here. (khtml::InputTextCommandImpl::~InputTextCommandImpl): No longer need to deref obsolete m_insertedTextNode. (khtml::InputTextCommandImpl::prepareForTextInsertion): Handle the case where a styling span needs to be added. (khtml::TypingCommandImpl::insertText): Create a new InputTextCommand when there is an active typping style. * khtml/editing/htmlediting_impl.h: Declare createTypingStyleElement helper. Remove m_insertedTextNode from InputTextCommandImpl. * kwq/WebCoreBridge.mm: (-[WebCoreBridge applyStyle:]): Swicth on the state of the selection, calling setTypingStyle when a caret and ApplyStyleCommand when a range. 2004-06-07 Darin Adler Reviewed by Ken. * khtml/editing/jsediting.h: Elide some unnecessary namespace prefixes. * khtml/editing/jsediting.cpp: Make typed constants instead of macros. (DOM::JSEditor::commandDict): Elide unnecessary namespace prefix. (DOM::JSEditor::execCommand): Remove xxxNotImplemented functions; just return false instead. (DOM::JSEditor::queryCommandEnabled): Ditto. (DOM::JSEditor::queryCommandIndeterm): Ditto. (DOM::JSEditor::queryCommandState): Ditto. (DOM::JSEditor::queryCommandSupported): Ditto. (DOM::JSEditor::queryCommandValue): Ditto. 2004-06-05 Trey Matteson As agreed with Hyatt and Louch, do not post incoming dragging events to text nodes. Reviewed by Maciej * khtml/khtmlview.cpp: (KHTMLView::updateDragAndDrop): For any drag target that is a text node, use its parent instead. 2004-06-03 Trey Matteson DHTML dragging uses the Cocoa NSDragOperation on both the source and dest ends. In addition, I caught a prime gaffe where I had used "dropAllowed" instead of "effectAllowed" for that particular WinIE property. That is renamed throughout. Reviewed by rjw * khtml/ecma/kjs_events.cpp: (stringOrUndefined): New little helper. (Clipboard::getValueProperty): Return Undefined if dropEffect or effectAllowed are not set. (Clipboard::putValue): Rename. * khtml/ecma/kjs_events.h: (KJS::Clipboard::): Rename. * khtml/ecma/kjs_events.lut.h: * khtml/xml/dom2_eventsimpl.h: Rename. * kwq/KWQClipboard.h: Rename, add access to Cocoa drag op. * kwq/KWQClipboard.mm: (KWQClipboard::dropEffect): These 4 just moved in the file. (KWQClipboard::setDropEffect): (KWQClipboard::effectAllowed): (KWQClipboard::setEffectAllowed): (cocoaOpFromIEOp): Convert from an IE operation string to a Cocoa DragOp (IEOpFromCocoaOp): and vice-versa (KWQClipboard::sourceOperation): Return effectAllowed, converted to a NSDragOp (KWQClipboard::destinationOperation): Return dropEffect, converted to a NSDragOp (KWQClipboard::setSourceOperation): Set effectAllowed, using a Cocoa value (KWQClipboard::setDestinationOperation): Set dropEffect, using a Cocoa value * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::dispatchDragSrcEvent): Return the drag op specified by the source element. (KWQKHTMLPart::khtmlMouseMoveEvent): Pass our drag op up to WebKit. (KWQKHTMLPart::dragSourceMovedTo): Pass NULL for new arg. (KWQKHTMLPart::dragSourceEndedAt): Ditto * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragOperationForDraggingInfo:]): Set the incoming dragOp onto the clipboard so DHTML can access it. In addition, validate whatever op DHTML returns so we play well with Cocoa. 2004-06-04 David Hyatt Add support for auto values in flex transitions. Add support for mapping the back end values to front end values. Next it's time to actually try to use this stuff in render_flexbox. Reviewed by darin * khtml/css/css_valueimpl.cpp: (length): * khtml/css/css_valueimpl.h: (DOM::FlexGroupTransitionValueImpl::isAuto): * khtml/css/cssparser.cpp: (FlexGroupTransitionParseContext::length): (FlexGroupTransitionParseContext::commitAutoValue): (FlexGroupTransitionParseContext::commitValue): (CSSParser::parseFlexGroupTransition): * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty): * khtml/rendering/render_style.cpp: (FlexGroupTransitionData::operator==): * khtml/rendering/render_style.h: (khtml::FlexGroupTransitionData::next): (khtml::FlexGroupTransitionData::isAuto): === Safari-143 === 2004-06-04 Kevin Decker Reviewed by Dave. - kwq/KWQKHTMLPart.mm: addMessagetoConsole places sourceURL in the dictionary - khtml/xml/dom_docimpl.cpp: right now, we don't have a way to get a url, so we leave this blank - khtml/ecma/kjs_window.cpp: still need to get the real line number and sourceURL - khtml/ecma/kjs_proxy.cpp: now passing the sourceURL to addMessageToConsole - khtml/ecma/kjs_events.cpp: still need to grab an accurate line number and sourceURL * khtml/ecma/kjs_events.cpp: (JSEventListener::handleEvent): (JSLazyEventListener::handleEvent): * khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::evaluate): * khtml/ecma/kjs_window.cpp: (Window::isSafeScript): (ScheduledAction::execute): * khtml/xml/dom_docimpl.cpp: (DocumentImpl::open): * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::addMessageToConsole): 2004-06-04 Ken Kocienda Reviewed by Hyatt Fix a comical little bug where the style-applying code did not take into account deleting content from the start of a block. After the deletion, the caret is placed in the node before the deleted content and so inserting a styled fragment after the deletion position works great. The problem is that if the selectionis at the start of a block, there is no "position before the deletion" and the caret is placed in the new first child of the block. Inserting the styled content after this node is just plain wrong. Now, this case is handled correctly, and the styled content is inserted in the proper position. * khtml/editing/htmlediting_impl.cpp: (khtml::ApplyStyleCommandImpl::insertFragment): 2004-06-04 Ken Kocienda Reviewed by Hyatt * khtml/rendering/bidi.cpp: (khtml::RenderBlock::layoutInlineChildren): Only add additional line height in for root editable elements. This helps to keep layout from deviating too much from the intended page layout, but still gives an empty document a line in which it can blink the caret. 2004-06-04 Ken Kocienda Reviewed by Hyatt Made some progress on this set of related bugs: : "Make execCommand work as specified in the Javascript execCommand Compatibility Plan" : "Make queryCommandEnabled work as specified in the Javascript execCommand Compatibility Plan" : "Make queryCommandIndeterm work as specified in the Javascript execCommand Compatibility Plan" : "Make queryCommandState work as specified in the Javascript execCommand Compatibility Plan" : "Make queryCommandSupported work as specified in the Javascript execCommand Compatibility Plan" : "Make queryCommandValue work as specified in the Javascript execCommand Compatibility Plan" I did several things to move the ahead with the plan: 1. The latter five methods did not appear in the tree at all. Now they do, although 2. I removed the implementation for these editing methods from dom_docimpl.cpp, and moved them out to new js_editing.cpp/js_editing.h files. The remaining code in dom_docimpl.cpp is glue to call over to the new JSEditor object defined in the new files. 3. For a couple of the command implementations in js_editing.cpp, I made a stab at returning sensible values. For others, I just return place-holder values. I have added some comments to describe what has been done and what still needs to be done. * WebCore.pbproj/project.pbxproj: * khtml/dom/dom_doc.cpp: Add call-overs for these methods. (DOM::Document::queryCommandEnabled): (DOM::Document::queryCommandIndeterm): (DOM::Document::queryCommandState): (DOM::Document::queryCommandSupported): (DOM::Document::queryCommandValue): * khtml/dom/dom_doc.h: * khtml/ecma/kjs_dom.cpp: Add queryCommandXXX terminology. (DOMDocumentProtoFunc::tryCall): * khtml/ecma/kjs_dom.h: (KJS::DOMDocument::): * khtml/ecma/kjs_dom.lut.h: (KJS::): * khtml/editing/jsediting.cpp: Added. This file implements the guts of editing-related JS methods. (DOM::execCommandNotImplemented): (DOM::queryBoolNotImplemented): (DOM::queryValueNotImplemented): (DOM::JSEditor::commandDict): (DOM::JSEditor::JSEditor): (DOM::JSEditor::~JSEditor): (DOM::JSEditor::commandIdentifier): (DOM::JSEditor::addCommand): (DOM::JSEditor::initDict): (DOM::JSEditor::execCommand): (DOM::JSEditor::queryCommandEnabled): (DOM::JSEditor::queryCommandIndeterm): (DOM::JSEditor::queryCommandState): (DOM::JSEditor::queryCommandSupported): (DOM::JSEditor::queryCommandValue): (DOM::JSEditor::execCommandCopy): (DOM::JSEditor::execCommandCut): (DOM::JSEditor::execCommandDelete): (DOM::JSEditor::execCommandInsertText): (DOM::JSEditor::execCommandPaste): (DOM::JSEditor::execCommandRedo): (DOM::JSEditor::execCommandSelectAll): (DOM::JSEditor::execCommandUndo): (DOM::JSEditor::enabledIfPartNotNull): (DOM::JSEditor::enabledIfSelectionNotEmpty): (DOM::JSEditor::enabledIfSelectionIsRange): (DOM::JSEditor::commandSupported): * khtml/editing/jsediting.h: Added. (DOM::JSEditor::CommandIdentifier::CommandIdentifier): (DOM::JSEditor::document): (DOM::JSEditor::part): * khtml/xml/dom_docimpl.cpp: Rework JS editing support into glue that calls over into new JSEditor object. (DocumentImpl::DocumentImpl): (DocumentImpl::~DocumentImpl): (DocumentImpl::jsEditor): (DocumentImpl::execCommand): (DocumentImpl::queryCommandEnabled): (DocumentImpl::queryCommandIndeterm): (DocumentImpl::queryCommandState): (DocumentImpl::queryCommandSupported): (DocumentImpl::queryCommandValue): * khtml/xml/dom_docimpl.h: 2004-06-03 Richard Williamson Added setCompositeOperation method to Context2D. Actually pass composite operation to drawPixmap (instead of 1). Reviewed by jay lo. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): * kwq/KWQPainter.h: * kwq/KWQPainter.mm: (QPainter::compositeOperatorFromString): (QPainter::drawPixmap): 2004-06-03 David Hyatt Add support for box-flex-group-transition (whew!), a new property that is going to enable some incredibly complicated flexing layouts in HTML. This is Stage 1 - wire up the CSS property and make it get parsed into front-end data. Nobody actually looks at this data yet. Reviewed by darin * khtml/css/css_valueimpl.cpp: (CSSInheritedValueImpl::cssText): (ShadowValueImpl::cssText): (length): (FlexGroupTransitionValueImpl::~FlexGroupTransitionValueImpl): (FlexGroupTransitionValueImpl::cssText): * khtml/css/css_valueimpl.h: (DOM::FlexGroupTransitionValueImpl::cssValueType): * khtml/css/cssparser.cpp: (CSSParser::parseValue): (CSSParser::parseShadow): (FlexGroupTransitionParseContext::length): (FlexGroupTransitionParseContext::~FlexGroupTransitionParseContext): (FlexGroupTransitionParseContext::failed): (FlexGroupTransitionParseContext::allowGroup): (FlexGroupTransitionParseContext::commitGroup): (FlexGroupTransitionParseContext::commitSlash): (FlexGroupTransitionParseContext::commitLength): (FlexGroupTransitionParseContext::commitValue): (CSSParser::parseFlexGroupTransition): * khtml/css/cssparser.h: * khtml/css/cssproperties.c: (hash_prop): (findProp): * khtml/css/cssproperties.h: * khtml/css/cssproperties.in: * khtml/rendering/render_style.cpp: (StyleFlexibleBoxData::StyleFlexibleBoxData): (StyleFlexibleBoxData::operator==): (StyleFlexibleBoxData::transitionDataEquivalent): (StyleCSS3InheritedData::operator==): (StyleCSS3InheritedData::shadowDataEquivalent): (ShadowData::operator==): (RenderStyle::setBoxFlexGroupTransition): (length): (FlexGroupTransitionData::operator==): * khtml/rendering/render_style.h: (khtml::FlexGroupTransitionData::next): (khtml::FlexGroupTransitionData::~FlexGroupTransitionData): (khtml::FlexGroupTransitionData::operator!=): (khtml::StyleFlexibleBoxData::~StyleFlexibleBoxData): (khtml::RenderStyle::boxFlexGroupTransition): 2004-06-03 Richard Williamson Add extra sanity check to Image parameter of drawImage... Reviewed by Hyatt. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): 2004-06-02 David Hyatt Fix for 3673931, negative margins on objects that dodge floats not handled correctly. Reviewed by darin * khtml/rendering/render_block.cpp: (khtml::RenderBlock::layoutBlockChildren): 2004-06-03 Ken Kocienda Reviewed by Hyatt Fix for layout regression I caused when fixing: : "REGRESSION: text placed on pasteboard by WebKit is offset by one character" Extra height is added to empty blocks that are editable, so we can click to place the caret in them. This extra height was erroneously being added to non-editable blocks as a result of my earlier change. After looking at this and doing some code review, there are the following changes: Change away from "containingBlock" terminology in the NodeImpl class. The operation we are doing in NodeImpl is not the same as what is done in CSS when it uses the term "containingBlock" so: containingBlock changes to enclosingBlockFlowElement, and rootEditableBlock changes to rootEditableElement The vast majority of changes here are to make these name changes. The other significant piece of work, and the fix for the regression, is to change bidi.cpp to only include this extra line height if a block is empty and is content-editable. * khtml/editing/htmlediting_impl.cpp: (khtml::leadingWhitespacePosition): (khtml::trailingWhitespacePosition): (khtml::DeleteSelectionCommandImpl::doApply): (khtml::InputNewlineCommandImpl::doApply): (khtml::RemoveNodeAndPruneCommandImpl::doApply): (khtml::TypingCommandImpl::issueCommandForDeleteKey): * khtml/rendering/bidi.cpp: (khtml::RenderBlock::layoutInlineChildren): * khtml/xml/dom_docimpl.cpp: (DocumentImpl::relinquishesEditingFocus): (DocumentImpl::acceptsEditingFocus): * khtml/xml/dom_nodeimpl.cpp: * khtml/xml/dom_nodeimpl.h: * khtml/xml/dom_position.cpp: (DOM::Position::equivalentLeafPosition): (DOM::Position::previousCharacterPosition): (DOM::Position::nextCharacterPosition): (DOM::Position::previousLinePosition): (DOM::Position::nextLinePosition): (DOM::Position::equivalentUpstreamPosition): (DOM::Position::equivalentDownstreamPosition): (DOM::Position::atStartOfRootEditableElement): (DOM::Position::inRenderedContent): (DOM::Position::rendersOnSameLine): (DOM::Position::rendersInDifferentPosition): (DOM::Position::isLastRenderedPositionInEditableBlock): (DOM::Position::inFirstEditableInRootEditableElement): (DOM::Position::inLastEditableInRootEditableElement): (DOM::Position::inFirstEditableInContainingEditableBlock): (DOM::Position::inLastEditableInContainingEditableBlock): * khtml/xml/dom_position.h: * khtml/xml/dom_selection.cpp: (DOM::Selection::moveToRenderedContent): 2004-06-02 Trey Matteson Added types property to JS clipboard object. Reviewed by Richard. * khtml/ecma/kjs_events.cpp: (Clipboard::getValueProperty): Create JS array for strings coming from the clipboard impl. * khtml/ecma/kjs_events.h: (KJS::Clipboard::): * khtml/ecma/kjs_events.lut.h: * kwq/KWQClipboard.mm: (MIMETypeFromCocoaType): New helper routine to map types. (KWQClipboard::types): Implement based on NSPasteboard's types. 2004-06-02 Richard Williamson Corrected typo ID_IMG should have been ID_CANVAS when checking for the canvas composite operator. Reviewed by Ken. * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint): 2004-06-02 Richard Williamson Correctly size the if margins, borders, or padding is added. Reviewed by Trey. * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::createDrawingContext): 2004-06-01 Trey Matteson First cut at the source side of DHTML dragging. Following IE, new events are added: ondragstart, ondrag, ondragend. The recently added CSS property -khtml-user-drag can be used to make an element draggable. event.dataTransfer.setDragImage(ImageObject,x,y) can be used from ondragstart to set a static image for the dragImage. x,y is the location of the mouse within the image from the upper right corner. clipboard methods setdata and cleardata are implemented. Reviewed by hyatt. * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): Boilerplate for new events (DOMNode::putValue): Boilerplate for new events * khtml/ecma/kjs_dom.h: (KJS::DOMNode::): Boilerplate for new events * khtml/ecma/kjs_dom.lut.h: * khtml/ecma/kjs_events.cpp: (DOMMouseEvent::getValueProperty): Return undefined for clipboard when its not a drag event. (ClipboardProtoFunc::tryCall): setDragImage glue to clipboard routine. * khtml/ecma/kjs_events.h: (KJS::Clipboard::): * khtml/ecma/kjs_events.lut.h: * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Boilerplate for new events * khtml/khtml_part.cpp: (KHTMLPart::shouldDragAutoNode): Empty impl of new method, where UA determines draggability for events with -khtml-user-drag=auto * khtml/khtml_part.h: * khtml/misc/htmlattrs.c: * khtml/misc/htmlattrs.h: * khtml/misc/htmlattrs.in: Boilerplate for new events * khtml/rendering/render_object.cpp: (RenderObject::draggableNode): Find the node or parent node which might be dragged. * khtml/rendering/render_object.h: * khtml/xml/dom2_eventsimpl.cpp: (EventImpl::typeToId): Boilerplate for new events (EventImpl::idToType): Boilerplate for new events * khtml/xml/dom2_eventsimpl.h: (DOM::EventImpl::): Boilerplate for new events * kwq/KWQClipboard.h: * kwq/KWQClipboard.mm: (KWQClipboard::clearData): Implemented to call NSPasteboard (KWQClipboard::clearAllData): ditto (KWQClipboard::getData): fix corner case that came up testing (KWQClipboard::setData): Implemented to call NSPasteboard (KWQClipboard::dragLocation): Simple setter/getters (KWQClipboard::setDragLocation): (KWQClipboard::dragImage): (KWQClipboard::setDragImage): (KWQClipboard::dragNSImage): * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::KWQKHTMLPart): init new member var (KWQKHTMLPart::dragHysteresisExceeded): Hysteresis moved here from WebKit (KWQKHTMLPart::dispatchDragSrcEvent): Send a dragging event to the current dragSource (KWQKHTMLPart::khtmlMouseMoveEvent): Initiate dragging, now including consulting DHTML, hysteresis and sending ondragstart. (KWQKHTMLPart::dragSourceMovedTo): simple passthrough (KWQKHTMLPart::dragSourceEndedAt): simple passthrough (KWQKHTMLPart::mouseDown): salt away _mouseDownX, _mouseDownY (KWQKHTMLPart::shouldDragAutoNode): Called for -khtml-user-drag=auto. We just call out to WebKit. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragSourceMovedTo:]): New glue to drive new dragging events. (-[WebCoreBridge dragSourceEndedAt:operation:]): 2004-06-02 Ken Kocienda Reviewed by me Finish off name change from previous check-in by changing dom_edititerator file names to dom_positioniterator. Files copied and renamed in repository. Includes updated as needed. * ForwardingHeaders/xml/dom_edititerator.h: Removed. * ForwardingHeaders/xml/dom_positioniterator.h: Added. * WebCore.pbproj/project.pbxproj: * khtml/editing/htmlediting_impl.cpp: * khtml/xml/dom_edititerator.cpp: Removed. * khtml/xml/dom_edititerator.h: Removed. * khtml/xml/dom_position.cpp: * khtml/xml/dom_positioniterator.cpp: Added. (DOM::PositionIterator::peekPrevious): (DOM::PositionIterator::peekNext): (DOM::PositionIterator::atStart): (DOM::PositionIterator::atEnd): * khtml/xml/dom_positioniterator.h: Added. (DOM::PositionIterator::PositionIterator): (DOM::PositionIterator::current): (DOM::PositionIterator::previous): (DOM::PositionIterator::next): (DOM::PositionIterator::setPosition): (DOM::PositionIterator::isEmpty): * khtml/xml/dom_selection.cpp: 2004-06-02 Ken Kocienda Reviewed by Darin Probable fix for this bug: : "REGRESSION: text placed on pasteboard by WebKit is offset by one character" I could not reproduce the bug myself, which is why I call the fix as probable. Darin and I did some code inspection and found some problems with the equivalentUpstreamPosition and equivalentDownstreamPosition functions on DOM::Position and how these functions dealt with changing from editable to non-editable content. As a result of these discoveries, I went over this code and the helpers and functions which support them, and made some corrections and simplifications. The big changes are as follows: 1. Rename EditIterator class to PositionIterator. This class needs to run code for selections in non-editable content, so the name change is appropriate. 2. Change containingEditableBlock to containingBlock. It turns out that none of the editing code relies on the distinction between editable blocks and non-editable blocks. The important distinction is the block boundary. The notion of rootEditableBlock remains. * khtml/editing/htmlediting_impl.cpp: (khtml::DeleteCollapsibleWhitespaceCommandImpl::deleteWhitespace): PositionIterator name change. (khtml::DeleteSelectionCommandImpl::joinTextNodesWithSameStyle): Ditto. (khtml::DeleteSelectionCommandImpl::containsOnlyWhitespace): Ditto. (khtml::DeleteSelectionCommandImpl::doApply): Ditto. (khtml::InputNewlineCommandImpl::doApply): Ditto. (khtml::RemoveNodeAndPruneCommandImpl::doApply): Ditto. * khtml/rendering/bidi.cpp: (khtml::RenderBlock::layoutInlineChildren): Ditto. * khtml/xml/dom_edititerator.cpp: (DOM::PositionIterator::peekPrevious): Call for previousLeafNode instead of previousEditable. Editable check is not appropriate as this class is used for non-editable content. (DOM::PositionIterator::peekNext): Call nextLeafNode instead of nextEditable, as above. (DOM::PositionIterator::atStart): Call for previousLeafNode instead of previousEditable, as above. (DOM::PositionIterator::atEnd): Call nextLeafNode instead of nextEditable, as above. * khtml/xml/dom_edititerator.h: (DOM::PositionIterator::PositionIterator): PositionIterator name change. Remove unused and unneeded constructors. * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::previousEditable): Simplify. Rely on previousLeafNode as a helper. (NodeImpl::nextEditable): Ditto, but rely on nextLeafNode. (NodeImpl::previousLeafNode): Remove tree-walking code. Rely on traversePreviousNode as a helper. (NodeImpl::nextLeafNode): Ditto, but rely on traverseNextNode. (NodeImpl::containingBlock): Renamed replacement for containingEditableBlock. (NodeImpl::inSameContainingEditableBlock): Call renamed containingBlock. * khtml/xml/dom_nodeimpl.h: * khtml/xml/dom_position.cpp: (DOM::Position::previousCharacterPosition): Various name changes, as described above. (DOM::Position::nextCharacterPosition): Ditto. (DOM::Position::previousWordPosition): Ditto. (DOM::Position::nextWordPosition): Ditto. (DOM::Position::previousLinePosition): Ditto. (DOM::Position::nextLinePosition): Ditto. (DOM::Position::equivalentUpstreamPosition): Remove bogus check for editable node in loop. Perform improved block-crossing check at start of loop which works for editable and non-editable content. This is the crux of the fix for the bug. (DOM::Position::equivalentDownstreamPosition): Ditto. (DOM::Position::inRenderedContent): Various name changes, as described above. (DOM::Position::rendersOnSameLine): Ditto. (DOM::Position::rendersInDifferentPosition): Ditto. (DOM::Position::isFirstRenderedPositionOnLine): Ditto. (DOM::Position::isLastRenderedPositionOnLine): Ditto. (DOM::Position::isLastRenderedPositionInEditableBlock): Ditto. (DOM::Position::inFirstEditableInRootEditableBlock): Ditto. (DOM::Position::inLastEditableInRootEditableBlock): Ditto. (DOM::Position::inFirstEditableInContainingEditableBlock): Ditto. (DOM::Position::inLastEditableInContainingEditableBlock): Ditto. 2004-06-01 Richard Williamson Fixed deployment build warning. * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint): 2004-06-01 Richard Williamson Added support for composite attribute to Added support for drawImage and drawImageFromRect to , i.e.: Reviewed by Trey. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): (Context2D::Context2D): * khtml/ecma/kjs_html.h: * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::paint): * kwq/KWQPainter.h: * kwq/KWQPainter.mm: (QPainter::getCompositeOperation): (QPainter::setCompositeOperation): (QPainter::drawPixmap): (QPainter::drawTiledPixmap): * kwq/KWQPixmap.h: * kwq/KWQPixmap.mm: (QPixmap::flushRasterCache): * kwq/WebCoreImageRenderer.h: * kwq/WebCoreImageRendererFactory.h: 2004-06-01 Ken Kocienda Reviewed by Darin Fix for these bugs: : "Text styles have hard-coded values making bold the only supported text style" : "HTML Editing: Font panel doesn't work" * khtml/css/css_valueimpl.cpp: (FontFamilyValueImpl::cssText): Added implementation for this subclass. Returns parsedFontName. * khtml/css/css_valueimpl.h: Declare cssText() on FontFamilyValueImpl. (DOM::CSSProperty::value): * khtml/editing/htmlediting.cpp: (khtml::ApplyStyleCommand::ApplyStyleCommand): Changed signature to take a CSSStyleDeclarationImpl. (khtml::ApplyStyleCommand::style): Added accessor. * khtml/editing/htmlediting.h: Changed constructor signature to take a CSSStyleDeclarationImpl. * khtml/editing/htmlediting_impl.cpp: (khtml::styleSpanClassString): Added helper to return attribute used to tag spans we add to apply styles. (khtml::ApplyStyleCommandImpl::ApplyStyleCommandImpl): Ref style passed in. (khtml::ApplyStyleCommandImpl::~ApplyStyleCommandImpl): Deref style passed in. (khtml::ApplyStyleCommandImpl::doApply): m_removingStyle is obsolete. Removed. (khtml::ApplyStyleCommandImpl::isHTMLStyleNode): Now checks all properties in the object's declaration. (khtml::ApplyStyleCommandImpl::removeCSSStyle): Again, now is multi-property-savvy. Will now remove an empty span if we added it. (khtml::ApplyStyleCommandImpl::currentlyHasStyle): Replaced, bold-only code with code that can handle all styles. (khtml::ApplyStyleCommandImpl::computeStyleChange): Helper which helps to determine whether we want to apply HTML-style markup for bold and italic, and gathers up all style changes that need to be done. (khtml::ApplyStyleCommandImpl::positionInsertionPoint): Added comment explaining possible optimization that might be done in the future. (khtml::ApplyStyleCommandImpl::applyStyleIfNeeded): Significant reworking; now handles applying multiple styles. (khtml::ApplyStyleCommandImpl::cloneSelection): Assert fragment has at least one child. Don't want to work on empty fragments. (khtml::ApplyStyleCommandImpl::surroundContentsWithElement): New helper. (khtml::RemoveCSSPropertyCommandImpl::~RemoveCSSPropertyCommandImpl): Juggle asserts and lifecycle methods to be more like other commands. (khtml::RemoveCSSPropertyCommandImpl::doApply): Ditto. (khtml::RemoveNodeAttributeCommandImpl::~RemoveNodeAttributeCommandImpl): Ditto. (khtml::RemoveNodeAttributeCommandImpl::doApply):Ditto. * khtml/editing/htmlediting_impl.h: (khtml::ApplyStyleCommandImpl::style): Added. (khtml::ApplyStyleCommandImpl::StyleChange::StyleChange): Added. * kwq/DOM-CSS.mm: (-[DOMCSSStyleDeclaration setProperty:::]): Fix problem where passing an empty NSString to a function expecting a boolean made all properties important priority. * kwq/WebCoreBridge.mm: (-[WebCoreBridge applyStyle:]): Remove provisional code and comment. Now pass along style, following the intended design. 2004-06-01 Chris Blumenberg Reviewed by kocienda. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragCaretDOMRange]): new, lets WebKit pass the drag caret DOM range to the editing delegate 2004-05-28 John Louch Reviewed by gramps. - removed setShadowWithColor and change setShadow to work with optional attributes it follows the same rules as setFill/StrokeColor - Fixed bug in setFillColor and setStrokeColor for CMYK colors (missing break in case). * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): 2004-05-28 Darin Adler Reviewed by Ken. - various editing-related improvements * khtml/xml/dom_selection.h: Removed UP and DOWN directions, and added PARAGRAPH granularity. * khtml/xml/dom_selection.cpp: (DOM::Selection::modify): Got rid of the UP and DOWN directions, and made movement between lines happen when granularity is LINE. Added a new unimplemented granularity: PARAGRAPH. (DOM::Selection::validate): Remove some unneeded APPLE_CHANGES. The code need not be ifdef'd. (DOM::Selection::debugPosition): Ditto. * kwq/WebCoreBridge.h: Removed WebSelectUp and WebSelectDown, and added WebSelectByParagraph. Added stringForRange: and selectedDOMRangeWithGranularity:, and renamed replaceSelectionWithNewline to insertNewline because it has the insertText: semantic, not the replaceSelectionWithText: one. * kwq/WebCoreBridge.mm: (-[WebCoreBridge stringForRange:]): Added. (-[WebCoreBridge selectedDOMRangeWithGranularity:]): Added. (-[WebCoreBridge alterCurrentSelection:direction:granularity:]): Updated code to understand that vertical movement is based on granularity now, not direction. (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:]): Moved an ensureCaretVisible from the WebKit down here. I think perhaps this should go down even further in WebCore. (-[WebCoreBridge insertNewline]): Renamed, and moved ensureCaretVisible here. (-[WebCoreBridge insertText:]): Moved ensureCaretVisible here. (-[WebCoreBridge deleteKeyPressed]): Moved ensureCaretVisible here. * khtml/xml/dom_position.cpp: Some ifdef tweaks. * khtml/misc/helper.cpp: Namespace and formatting tweaks. * khtml/misc/helper.h: Removed some unused stuff. * khtml/dom/dom2_range.h: Make range constructor public so that anyone with a RangeImpl can easily make a Range. 2004-05-28 Richard Williamson setStrokeColor and setFillColor now support old school web color string, oswcs+alpha, gray, gray+alpha, rgba, and cmyka. Reviewed by jay-lo. * khtml/css/cssparser.cpp: (CSSParser::parseColor): (CSSParser::parseColorFromValue): * khtml/css/cssparser.h: Made parseColor static public class method * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): 2004-05-28 David Hyatt Implement -khtml-user-select and add support for the property -khtml-user-drag (although someone will still need to wire it up). Reviewed by rjw * khtml/css/cssparser.cpp: (CSSParser::parseValue): * khtml/css/cssproperties.c: (hash_prop): (findProp): * khtml/css/cssproperties.h: * khtml/css/cssproperties.in: * khtml/css/cssstyleselector.cpp: (khtml::CSSStyleSelector::applyProperty): * khtml/css/cssvalues.c: (hash_val): (findValue): * khtml/css/cssvalues.h: * khtml/css/cssvalues.in: * khtml/khtml_part.cpp: (KHTMLPart::handleMousePressEventDoubleClick): (KHTMLPart::handleMousePressEventTripleClick): (KHTMLPart::handleMousePressEventSingleClick): (KHTMLPart::handleMouseMoveEventSelection): * khtml/rendering/render_canvas.cpp: (RenderCanvas::setSelection): * khtml/rendering/render_object.cpp: (RenderObject::shouldSelect): * khtml/rendering/render_object.h: * khtml/rendering/render_style.cpp: (userSelect): (StyleCSS3NonInheritedData::operator==): (RenderStyle::diff): * khtml/rendering/render_style.h: (khtml::): (khtml::RenderStyle::userDrag): (khtml::RenderStyle::userSelect): (khtml::RenderStyle::setUserDrag): (khtml::RenderStyle::setUserSelect): (khtml::RenderStyle::initialUserDrag): (khtml::RenderStyle::initialUserSelect): 2004-05-28 John Louch added addArc and clip path routines. Reviewed by sullivan. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): 2004-05-28 John Louch Added addArcToPoint and addRect path routines. Reviewed by sullivan. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): 2004-05-27 Ken Kocienda Reviewed by John * khtml/xml/dom_selection.cpp: (DOM::Selection::toRange): Add call to update document layout before returning a Range. This is done to ensure recently-done editing changes are reflected in the calculation of the Range. This change solves a specific problem with updating the font panel, where the wrong Range was used, resulting in an incorrect font. Also, defer converting positions to be range-compliant positions. The nodeIsBeforeNode function is not range-compliant-position-savvy. 2004-05-27 Kevin Decker Reviewed by Ken. - added support for the new JavaScript error console - error messages are now wired directly to the bridge - revised generated error message content * khtml/ecma/kjs_events.cpp: (JSEventListener::handleEvent): * khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::evaluate): * khtml/ecma/kjs_window.cpp: (Window::isSafeScript): (ScheduledAction::execute): * kwq/KWQKHTMLPart.h: * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::addMessageToConsole): * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: 2004-05-27 Trey Matteson Two dragging tweaks: ondragleave events are sent before ondragenter events when going across element boundaries, to match WinIE. For compatibility with WinIE, we honor MIME types of "Text" and "URL". Reviewed by rjw. * khtml/khtmlview.cpp: (KHTMLView::updateDragAndDrop): * kwq/KWQClipboard.mm: (cocoaTypeFromMIMEType): === Safari-142 === 2004-05-27 Vicki Murley Reviewed by Darin. - Fix Tiger build failure. Rename constant "S" to "WHITESPACE", and change all instances of S to WHITESPACE. * khtml/css/cssparser.cpp: (DOM::CSSParser::lex): S to WHITESPACE * khtml/css/parser.cpp: regenerated file * khtml/css/parser.h: regenerated file * khtml/css/parser.y: S to WHITESPACE * khtml/css/tokenizer.cpp: regenerated file * khtml/css/tokenizer.flex: S to WHITESPACE 2004-05-27 John Louch Reviewed by NOBODY (OOPS!). * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): 2004-05-27 Trey Matteson First cut at DHTML dragging, destination side. Dragging text, files and URLs onto elements works. Type conversion from NSPasteboard to MIME types is hardwired. No JS access yet to modifier keys, or drag operations mask. Per IE's dragging API, we have the new DOM events ondragenter, ondragover, ondragleave and ondrop. We also have an event.dataTransfer object providing access to the NSPasteboard bearing the incoming data. Reviewed by rjw. * WebCore.pbproj/project.pbxproj: add 2 new files. * khtml/ecma/kjs_dom.cpp: (DOMNode::getValueProperty): JS access to ondragenter and pals (DOMNode::putValue): Ditto * khtml/ecma/kjs_dom.h: (KJS::DOMNode::): New attr enum values. * khtml/ecma/kjs_dom.lut.h: (KJS::): * khtml/ecma/kjs_events.cpp: (DOMMouseEvent::mark): Pass along mark to dataTransfer we hold. (DOMMouseEvent::getValueProperty): Create and return dataTransfer. (Clipboard::Clipboard): New class exposed in JS. (Clipboard::~Clipboard): (Clipboard::tryGet): Boilerplate. (Clipboard::getValueProperty): Return the clipboard's props. (Clipboard::tryPut): Boilerplate. (Clipboard::putValue): Set the clipboard's props. (ClipboardProtoFunc::tryCall): Implement clipboard's funcs. * khtml/ecma/kjs_events.h: (KJS::DOMMouseEvent::DOMMouseEvent): Init clipboard ptr. (KJS::DOMMouseEvent::): (KJS::Clipboard::toBoolean): (KJS::Clipboard::classInfo): (KJS::Clipboard::): * khtml/ecma/kjs_events.lut.h: (KJS::): * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Enable setting ondragenter and friends as html attributes. * khtml/khtmlview.cpp: (KHTMLView::dispatchDragEvent): Send a drag related event to the DOM. (KHTMLView::updateDragAndDrop): Handle a dragenter or dragupdate. (KHTMLView::cancelDragAndDrop): Handle a dragexit. (KHTMLView::performDragAndDrop): Handle an actual drop. * khtml/khtmlview.h: * khtml/misc/htmlattrs.c: Generated code. * khtml/misc/htmlattrs.h: Generated code. * khtml/misc/htmlattrs.in: Add ondragenter, etc * khtml/xml/dom2_eventsimpl.cpp: (EventImpl::typeToId): Handle new event types for dragging. (EventImpl::idToType): Ditto. (MouseEventImpl::MouseEventImpl): Init new clipboard ptr. (MouseEventImpl::~MouseEventImpl): Deref clipboard. (ClipboardImpl::ClipboardImpl): (ClipboardImpl::~ClipboardImpl): * khtml/xml/dom2_eventsimpl.h: (DOM::EventImpl::): New event enums. (DOM::MouseEventImpl::clipboard): * kwq/KWQClipboard.h: Added. * kwq/KWQClipboard.mm: Added. (KWQClipboard::KWQClipboard): (KWQClipboard::~KWQClipboard): (KWQClipboard::isForDragging): Trivial getter/setters. (KWQClipboard::dropEffect): (KWQClipboard::setDropEffect): (KWQClipboard::dropAllowed): (KWQClipboard::setDropAllowed): (cocoaTypeFromMIMEType): Convert MIME pboard type to Cocoa type. (KWQClipboard::clearData): OSX specific clipboard impl. of IE func (KWQClipboard::clearAllData): Ditto (KWQClipboard::getData): Ditto (KWQClipboard::setData): Ditto * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge dragOperationForDraggingInfo:]): Passthrough from WebKit to khtmlpart (-[WebCoreBridge dragExitedWithDraggingInfo:]): Ditto (-[WebCoreBridge concludeDragForDraggingInfo:]): Ditto 2004-05-27 Ken Kocienda Reviewed by Gramps * kwq/KWQKHTMLPart.h: Declare new fontForCurrentPosition helper. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::fontForCurrentPosition): Determines the "current font" in the way that Cocoa does. Either the font of the character before the caret, when the selection is a caret, or the font of the first character selected, when the selection is a range. * kwq/WebCoreBridge.h: Declare bridge method so this can be called from WebKit. * kwq/WebCoreBridge.mm: (-[WebCoreBridge fontForCurrentPosition]): Calls through to fontForCurrentPosition on KWQKHTMLPart. 2004-05-27 Ken Kocienda Reviewed by Gramps Adds a typing style member variable to khtml part. This patch adds basic life-cycle management and accessors. In addition, one essential piece of behavior has been added: Clearing the typing style whenever the selection changes. Follow-on work will make this typing style a fully functional part of applying styles to text while typing. * khtml/khtml_part.cpp: (KHTMLPart::notifySelectionChanged): Clear typing style. (KHTMLPart::typingStyle): Getter. (KHTMLPart::setTypingStyle): Setter. (KHTMLPart::clearTypingStyle): Convenience. Sets to 0. * khtml/khtml_part.h: Function declarations. * khtml/khtmlpart_p.h: (KHTMLPartPrivate::KHTMLPartPrivate): Initialize member variable. (KHTMLPartPrivate::~KHTMLPartPrivate): Deref if necessary. 2004-05-27 Ken Kocienda Reviewed by Gramps Add helper to get the DOM element for a Position. * khtml/xml/dom_position.cpp: (DOM::Position::element): Returns the Position's node if it is an element, or the first ancestor of the node that is an element. Returns 0 if node is not an element and has no parent that is an element. * khtml/xml/dom_position.h: Added declaration. 2004-05-27 Darin Adler Reviewed by Maciej. - moved to new symlink technique for embedding frameworks * WebCore.pbproj/project.pbxproj: Get rid of embed-frameworks build step because we don't need it any more. 2004-05-27 Darin Adler - fixed bug where all pages with images would cause a crash - fixed Deployment build * kwq/KWQPainter.mm: (QPainter::drawPixmap): Put #if 0 around placeholder code for setting up the graphics context. 2004-05-26 Richard Williamson Added shadow support (w/ Louch). Added infrastructure for drawing images. New context methods: setShadow setShadowWithColor clearShadow Reviewed by me and Louch. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Image::image): (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): * kwq/KWQPainter.h: * kwq/KWQPainter.mm: (QPainter::drawPixmap): 2004-05-26 Richard Williamson Fixed build snafu. * khtml/ecma/kjs_html.cpp: (KJS::Context2DFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): 2004-05-26 Richard Williamson Part 2 of the new tag implementation. This adds the basic machinery and draw operations for the tag. Pretty cool. function drawLine() { var canvas1 = document.getElementById ("canvas1"); var context = canvas1.getContext("context-2d"); context.setStrokeColor ("red"); context.setLineWidth (10); context.beginPath(); context.moveToPoint (0,0); context.addLineToPoint (400,400); context.strokePath(); } ... Currently supported operations on the 2D context are: Save, Restore, Scale, Rotate, Translate, BeginPath, ClosePath, SetStrokeColor, SetFillColor, SetLineWidth, SetLineCap, SetLineJoin, SetMiterLimit, FillPath, StrokePath, MoveToPoint, AddLineToPoint, AddQuadraticCurveToPoint, AddBezierCurveToPoint, ClearRect More to come. Reviewed by Dave. * khtml/ecma/kjs_html.cpp: (KJS::HTMLElementFunction::tryCall): (KJS::Context2DFunction::tryCall): (Context2D::tryGet): (Context2D::getValueProperty): (Context2D::tryPut): (Context2D::putValue): (Context2D::Context2D): (Context2D::~Context2D): * khtml/ecma/kjs_html.h: (KJS::Context2D::toBoolean): (KJS::Context2D::classInfo): (KJS::Context2D::): * khtml/ecma/kjs_html.lut.h: (KJS::): * khtml/html/html_canvasimpl.cpp: (HTMLCanvasElementImpl::HTMLCanvasElementImpl): * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): * khtml/rendering/render_canvasimage.cpp: (RenderCanvasImage::RenderCanvasImage): (RenderCanvasImage::~RenderCanvasImage): (RenderCanvasImage::createDrawingContext): (RenderCanvasImage::drawingContext): (RenderCanvasImage::setNeedsImageUpdate): (RenderCanvasImage::updateDrawnImage): (RenderCanvasImage::drawnImage): (RenderCanvasImage::paint): (RenderCanvasImage::layout): * khtml/rendering/render_canvasimage.h: * khtml/rendering/render_image.cpp: (RenderImage::paint): * khtml/rendering/render_image.h: * khtml/rendering/render_replaced.cpp: (RenderReplaced::shouldPaint): (RenderWidget::paint): * kwq/KWQPainter.h: * kwq/KWQPainter.mm: (QPainter::currentContext): 2004-05-26 Darin Adler - fixed warning that prevents Deployment build from compiling * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMousePressEvent): Moved use of single-click boolean outside the scope of the "block exceptions" macros. 2004-05-25 Chris Blumenberg Fixed a regression where selections that were created via double or triple were not draggable. Reviewed by darin. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMousePressEvent): if the click count is greater than 1, don't allow drags (KWQKHTMLPart::khtmlMouseMoveEvent): allow drags to occur even if the selection was originally created via double or triple click 2004-05-25 Chris Blumenberg Fixed regression where undoing typing would undo character-by-character. Reviewed by kocienda. * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge insertText:]): new, this method used to be replaceSelectionWithText, but replaceSelectionWithText now is one operation whereas calls to insertText: are coalesced 2004-05-25 Ken Kocienda Reviewed by John Change postDidChangeSelectionNotification and postDidChangeNotification tp respondToChangedSelection and respondToChangedContents, respectively, to account for the fact that we do work in these calls other than post a notification. * khtml/khtml_part.cpp: (KHTMLPart::notifySelectionChanged): Use new names. (KHTMLPart::appliedEditing): Ditto. (KHTMLPart::unappliedEditing): Ditto. (KHTMLPart::reappliedEditing): Ditto. * kwq/KWQKHTMLPart.h: Change name of functions as described. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::respondToChangedSelection): Ditto. (KWQKHTMLPart::respondToChangedContents): Ditto. * kwq/WebCoreBridge.h: Ditto. 2004-05-25 Maciej Stachowiak Fixed build. * ForwardingHeaders/misc/khtml_text_operations.h: Added. 2004-05-25 Richard Williamson Part 1 of the new tag implementation. This patch adds the boiler plate for the new element. Reviewed by Dave. * ForwardingHeaders/html/html_canvasimpl.h: Added. * ForwardingHeaders/rendering/render_canvasimage.h: Added. * WebCore.pbproj/project.pbxproj: * khtml/ecma/kjs_html.cpp: (KJS::HTMLElement::classInfo): (KJS::HTMLElementFunction::tryCall): * khtml/ecma/kjs_html.h: (KJS::HTMLElement::): * khtml/ecma/kjs_html.lut.h: (KJS::): * khtml/html/dtd.cpp: (DOM::checkChild): * khtml/html/html_canvasimpl.cpp: Added. (HTMLCanvasElementImpl::HTMLCanvasElementImpl): (HTMLCanvasElementImpl::~HTMLCanvasElementImpl): (HTMLCanvasElementImpl::id): (HTMLCanvasElementImpl::mapToEntry): (HTMLCanvasElementImpl::parseHTMLAttribute): (HTMLCanvasElementImpl::createRenderer): (HTMLCanvasElementImpl::attach): (HTMLCanvasElementImpl::detach): (HTMLCanvasElementImpl::isURLAttribute): * khtml/html/html_canvasimpl.h: Added. * khtml/html/htmlparser.cpp: (KHTMLParser::getElement): * khtml/misc/htmltags.c: (hash_tag): (findTag): * khtml/misc/htmltags.h: * khtml/misc/htmltags.in: * khtml/rendering/render_canvasimage.cpp: Added. (RenderCanvasImage::RenderCanvasImage): (RenderCanvasImage::~RenderCanvasImage): (RenderCanvasImage::paint): (RenderCanvasImage::layout): * khtml/rendering/render_canvasimage.h: Added. (khtml::RenderCanvasImage::renderName): (khtml::RenderCanvasImage::element): 2004-05-25 Chris Blumenberg Fixed: : (when dragging text within an editable HTML doc, the selection should be moved not copied) Reviewed by kocienda. * khtml/editing/htmlediting_impl.cpp: (khtml::MoveSelectionCommandImpl::doApply): implemented * khtml/khtml_part.cpp: (KHTMLPart::setDragCaret): make the old drag cursor rect dirty * khtml/khtml_part.h: 2004-05-25 Maciej Stachowiak Reviewed by John. - fixed : (Editing: export innerText, innerHTML, outerText, outerHTML and setters to Objective-C) - partial fix for : (Fix innerText and setInnerText DOM extensions) * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::innerText): Use plainText() to make the text, to match other browsers. (HTMLElementImpl::outerText): Extended comment. * khtml/misc/khtml_text_operations.h: * kwq/DOMExtensions.h: * kwq/DOMHTML.mm: (-[DOMHTMLElement outerText]): Added new ObjC wrapper for this. (-[DOMHTMLElement setOuterText:]): Ditto. 2004-05-25 Ken Kocienda Reviewed by Chris Defer setting the selection to delete when none has been passed in to the time that the command is run. This fixes a problem where a command nested in a composite was not correctly picking up the right selection to begin its work. Now, the command will correctly use the ending selection of its parent when no selection has been passed in. * khtml/editing/htmlediting_impl.cpp: (khtml::DeleteCollapsibleWhitespaceCommandImpl::DeleteCollapsibleWhitespaceCommandImpl): (khtml::DeleteCollapsibleWhitespaceCommandImpl::doApply): (khtml::DeleteSelectionCommandImpl::DeleteSelectionCommandImpl): (khtml::DeleteSelectionCommandImpl::doApply): * khtml/editing/htmlediting_impl.h: 2004-05-24 Maciej Stachowiak Reviewed by Dave. Added a new simple layout test for outerText. * layout-tests/fast/dom/outerText-expected.txt: Added. * layout-tests/fast/dom/outerText.html: Added. 2004-05-24 Darin Adler Reviewed by Vicki. - fixed : (iBench is crashing in TOT) * khtml/html/html_formimpl.cpp: (HTMLSelectElementImpl::HTMLSelectElementImpl): Initialize m_options to 0. 2004-05-24 Ken Kocienda Reviewed by Richard * khtml/xml/dom_selection.cpp: (DOM::Selection::toRange): Improved the code to return ranges that are convenient to use by WebKit code which needs to perform text-editor-like operations with ranges. Comments in the code describe this behavior. (DOM::Selection::nodeIsBeforeNode): Make this method const. * khtml/xml/dom_selection.h: Ditto. 2004-05-24 Chris Blumenberg Improved editing via drag. Reviewed by kocienda. * khtml/editing/htmlediting.cpp: Renamed PasteMarkupCommand to ReplaceSelectionCommand (khtml::ReplaceSelectionCommand::ReplaceSelectionCommand): (khtml::ReplaceSelectionCommand::~ReplaceSelectionCommand): (khtml::ReplaceSelectionCommand::impl): (khtml::MoveSelectionCommand::MoveSelectionCommand): (khtml::MoveSelectionCommand::~MoveSelectionCommand): (khtml::MoveSelectionCommand::impl): * khtml/editing/htmlediting.h: (khtml::): * khtml/editing/htmlediting_impl.cpp: (khtml::ReplaceSelectionCommandImpl::ReplaceSelectionCommandImpl): (khtml::ReplaceSelectionCommandImpl::~ReplaceSelectionCommandImpl): (khtml::ReplaceSelectionCommandImpl::commandID): (khtml::ReplaceSelectionCommandImpl::doApply): (khtml::MoveSelectionCommandImpl::MoveSelectionCommandImpl): new command (khtml::MoveSelectionCommandImpl::~MoveSelectionCommandImpl): (khtml::MoveSelectionCommandImpl::commandID): (khtml::MoveSelectionCommandImpl::doApply): * khtml/editing/htmlediting_impl.h: * khtml/khtml_part.cpp: (KHTMLPart::dragCaret): new (KHTMLPart::setDragCaret): new (KHTMLPart::notifyDragCaretChanged): new (KHTMLPart::paintDragCaret): new * khtml/khtml_part.h: * khtml/khtmlpart_p.h: * khtml/rendering/render_block.cpp: (khtml::RenderBlock::paintObject): paint the drag caret * kwq/DOM.mm: (+[DOMDocumentFragment _documentFragmentWithImpl:]): made internally available (-[DOMDocumentFragment _fragmentImpl]): * kwq/DOMInternal.h: * kwq/WebCoreBridge.h: * kwq/WebCoreBridge.mm: (-[WebCoreBridge documentFragmentWithMarkupString:baseURLString:]): new (-[WebCoreBridge documentFragmentWithText:]): new (-[WebCoreBridge replaceSelectionWithFragment:selectReplacement:]): new (-[WebCoreBridge replaceSelectionWithNode:selectReplacement:]): renamed to take the selectReplacement BOOL (-[WebCoreBridge replaceSelectionWithMarkupString:baseURLString:selectReplacement:]): ditto (-[WebCoreBridge replaceSelectionWithText:selectReplacement:]): ditto (-[WebCoreBridge replaceSelectionWithNewline]): moved (-[WebCoreBridge setSelectionToDragCaret]): new (-[WebCoreBridge moveSelectionToDragCaret:]): new (-[WebCoreBridge moveDragCaretToPoint:]): set the drag caret, not the selection (-[WebCoreBridge removeDragCaret]): new 2004-05-24 Ken Kocienda Reviewed by John Fixed some life-cycle issues with node iterators and detaching. Big deal is to detach in DOMNodeIterator dealloc. Otherwise, NodeIterators created from obj-c leak. * khtml/xml/dom2_traversalimpl.cpp: (DOM::NodeIteratorImpl::detach): Only detach if not yet detached. * khtml/xml/dom2_traversalimpl.h: (DOM::NodeIteratorImpl::setDetached): New convenience. * kwq/DOM.mm: (-[DOMNodeIterator dealloc]): Detach here, if not yet detached; fixes leak. 2004-05-24 Ken Kocienda Reviewed by Hyatt * khtml/css/css_computedstyle.cpp: (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue): Fixed to return the property value, as it should, instead of the whole property, as it was doing before. 2004-05-23 Darin Adler Reviewed by Ken. - fixed : (Shift click should extend selection) * khtml/khtmlpart_p.h: Renamed m_textElement to m_selectionGranularity and m_mouseMovedSinceLastMousePress to m_beganSelectingText. * khtml/khtml_part.cpp: (KHTMLPart::handleMousePressEventDoubleClick): Set m_beganSelectingText if the double-click began selecting text. (KHTMLPart::handleMousePressEventTripleClick): Ditto. (KHTMLPart::handleMousePressEventSingleClick): Added code to extend selection if shift is down. (KHTMLPart::khtmlMousePressEvent): Remove code that sets the selection granularity to "by character". We only want to do that if we start selecting with a single click. Otherwise we want to leave the selection granularity alone. (KHTMLPart::khtmlMouseReleaseEvent): Change the code that clears the selection on a plain old click to check the m_beganSelectingText boolean so it won't run when you shift-click, for example. * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::khtmlMouseMoveEvent): Updated for m_textElement name change. 2004-05-22 Darin Adler Reviewed by Ken. - went through things marked "unimplemented" or "not implemented" and removed or implemented as many as possible * kwq/DOM.mm: (-[DOMNode dispatchEvent:]): Implemented. Also moved DOMAbstractView and DOMDocumentView into DOMViews.mm. * kwq/DOM-CSS.mm: (-[DOMDocument getComputedStyle::]): Implemented. * kwq/DOMEventsInternal.h: Added. * kwq/DOMEvents.mm: (-[DOMEvent type]): Implemented. (-[DOMEvent target]): Implemented. (-[DOMEvent currentTarget]): Implemented. (-[DOMEvent eventPhase]): Implemented. (-[DOMEvent bubbles]): Implemented. (-[DOMEvent cancelable]): Implemented. (-[DOMEvent timeStamp]): Implemented. (-[DOMEvent stopPropagation]): Implemented. (-[DOMEvent preventDefault]): Implemented. (-[DOMEvent initEvent:::]): Implemented. (-[DOMEvent _eventImpl]): Added. (-[DOMEvent _initWithEventImpl:]): Added. (+[DOMEvent _eventWithImpl:]): Added. (-[DOMMouseEvent _mouseEventImpl]): Added. (-[DOMMouseEvent screenX]): Implemented. (-[DOMMouseEvent screenY]): Implemented. (-[DOMMouseEvent clientX]): Implemented. (-[DOMMouseEvent clientY]): Implemented. (-[DOMMouseEvent ctrlKey]): Implemented. (-[DOMMouseEvent shiftKey]): Implemented. (-[DOMMouseEvent altKey]): Implemented. (-[DOMMouseEvent metaKey]): Implemented. (-[DOMMouseEvent button]): Implemented. (-[DOMMouseEvent relatedTarget]): Implemented. (-[DOMMouseEvent initMouseEvent:::::::::::::::]): Implemented. (-[DOMMutationEvent _mutationEventImpl]): Added. (-[DOMMutationEvent relatedNode]): Implemented. (-[DOMMutationEvent prevValue]): Implemented. (-[DOMMutationEvent newValue]): Implemented. (-[DOMMutationEvent attrName]): Implemented. (-[DOMMutationEvent attrChange]): Implemented. (-[DOMMutationEvent initMutationEvent::::::::]): (-[DOMUIEvent _UIEventImpl]): Added. (-[DOMUIEvent view]): Implemented. (-[DOMUIEvent detail]): Implemented. (-[DOMUIEvent initUIEvent:::::]): Implemented. (-[DOMDocument createEvent:]): Implemented. * kwq/DOMHTMLInternal.h: Added. * kwq/DOMHTML.mm: (+[DOMHTMLOptionsCollection _optionsCollectionWithImpl:]): Added. (-[DOMHTMLOptionsCollection length]): Implemented. (-[DOMHTMLOptionsCollection setLength:]): Implemented. (-[DOMHTMLOptionsCollection item:]): Implemented. (-[DOMHTMLOptionsCollection namedItem:]): Implemented. (-[DOMHTMLSelectElement options]): Implemented. * kwq/DOMViews.h: Changed DOMDocumentView to be a category on DOMDocument rather than a separate class. * kwq/DOMViewsInternal.h: Added. * kwq/DOMViews.mm: Added. (-[DOMAbstractView document]): Implemnted. (-[DOMAbstractView _abstractViewImpl]): Added. (-[DOMAbstractView _initWithAbstractViewImpl:]): Added. (+[DOMAbstractView _abstractViewWithImpl:]): Added. (-[DOMDocument defaultView]): Implemented. * khtml/dom/dom2_views.h: Made AbstractView constructor public to allow creation in the bindings. Would not be necessary if the impl classes were used consistently. * khtml/html/html_formimpl.h: Added options() function to HTMLSelectElementImpl. Added HTMLOptionsCollectionImpl class. * khtml/html/html_formimpl.cpp: (HTMLSelectElementImpl::~HTMLSelectElementImpl): Added code to detach and deref the options collection. (HTMLSelectElementImpl::options): Create an options collection if needed. (HTMLOptionsCollectionImpl::length): Added. Not yet implemented. (HTMLOptionsCollectionImpl::setLength): Ditto. (HTMLOptionsCollectionImpl::item): Ditto. (HTMLOptionsCollectionImpl::namedItem): Ditto. * khtml/khtmlview.h: Move unused focusNextPrevChild virtual function inside !APPLE_CHANGES. * khtml/khtmlview.cpp: Put the tp, paintBuffer, and formCompletions fields entirely inside !APPLE_CHANGES. Also made QT_NO_TOOLTIP entirely disable the tooltip field. Also put focusNextPrevChild and formCompletionItems functions inside !APPLE_CHANGES. * khtml/rendering/render_text.h: Removed unused isFixedWidthFont member function. * khtml/rendering/render_text.cpp: Ditto. * kwq/KWQCursor.h: Removed unused pos member function. * kwq/KWQCursor.mm: Ditto. * kwq/KWQFontMetrics.h: Removed unused rightBearing and leftBearing member functions. * kwq/KWQFontMetrics.mm: Ditto. * kwq/KWQKComboBox.h: Removed KCompletionBase as a base class. * kwq/KWQKConfigBase.h: Removed unused readBoolEntry, writeEntry, and readListEntry member functions. * kwq/KWQKConfigBase.mm: Ditto. (KConfig::readEntry): Improved "not implemented" message to indicate which key is uinimplemented. (KConfig::readNumEntry): Ditto. (KConfig::readUnsignedNumEntry): Ditto. * kwq/KWQKLineEdit.h: Removed everything, since all the KLineEdit stuff was unused. Changed KLineEdit to just be a typedef for QLineEdit. * kwq/KWQSlot.mm: Removed slotAutoScroll. (KWQSlot::KWQSlot): And from here. (KWQSlot::call): And from here. * kwq/KWQTextStream.h: Removed unused QTextOStream and QTextIStream. * kwq/KWQTextStream.mm: Removed unused QTextIStream function. A