+2006-03-20 Eric Seidel <eseidel@apple.com>
+
+ Reviewed by darin.
+
+ Remove many, many uses of DeprecatedString.
+ Fix various style issues throughout the touched code.
+
+ * bindings/objc/DOM.mm:
+ (-[DOMRange _text]):
+ * bridge/mac/BrowserExtensionMac.mm:
+ (WebCore::BrowserExtensionMac::createNewWindow):
+ * bridge/mac/FrameMac.h:
+ (WebCore::FrameMac::bridge):
+ (WebCore::FrameMac::markedTextRange):
+ (WebCore::Mac):
+ * bridge/mac/FrameMac.mm:
+ (WebCore::FrameMac::openURLRequest):
+ (WebCore::FrameMac::searchForLabelsAboveCell):
+ (WebCore::FrameMac::searchForLabelsBeforeElement):
+ (WebCore::FrameMac::matchLabelsAgainstElement):
+ (WebCore::FrameMac::findString):
+ (WebCore::FrameMac::submitForm):
+ (WebCore::FrameMac::urlSelected):
+ (WebCore::FrameMac::objectContentType):
+ (WebCore::FrameMac::createPlugin):
+ (WebCore::FrameMac::createFrame):
+ (WebCore::FrameMac::setTitle):
+ (WebCore::FrameMac::setStatusBarText):
+ (WebCore::FrameMac::advanceToNextMisspelling):
+ (WebCore::FrameMac::userAgent):
+ (WebCore::FrameMac::mimeTypeForFileName):
+ (WebCore::FrameMac::openURLFromPageCache):
+ (WebCore::FrameMac::incomingReferrer):
+ (WebCore::FrameMac::attributedString):
+ (WebCore::FrameMac::overrideMediaType):
+ (WebCore::FrameMac::shouldClose):
+ * bridge/mac/WebCoreFrameBridge.mm:
+ (-[WebCoreFrameBridge _documentTypeString]):
+ (-[WebCoreFrameBridge selectedString]):
+ (-[WebCoreFrameBridge stringForRange:]):
+ (-[WebCoreFrameBridge advanceToNextMisspelling]):
+ (-[WebCoreFrameBridge advanceToNextMisspellingStartingJustBeforeSelection]):
+ (-[WebCoreFrameBridge domain]):
+ * bridge/mac/WebCoreSettings.mm:
+ (-[WebCoreSettings setStandardFontFamily:]):
+ (-[WebCoreSettings setFixedFontFamily:]):
+ (-[WebCoreSettings setSerifFontFamily:]):
+ (-[WebCoreSettings setSansSerifFontFamily:]):
+ (-[WebCoreSettings setCursiveFontFamily:]):
+ (-[WebCoreSettings setFantasyFontFamily:]):
+ (-[WebCoreSettings setUserStyleSheetLocation:]):
+ (-[WebCoreSettings setDefaultTextEncoding:]):
+ * css/css_valueimpl.cpp:
+ (WebCore::quoteStringIfNeeded):
+ * css/cssstyleselector.cpp:
+ (WebCore::CSSStyleSelector::CSSStyleSelector):
+ (WebCore::CSSStyleSelector::setEncodedURL):
+ (WebCore::cleanpath):
+ (WebCore::checkPseudoState):
+ (WebCore::CSSStyleSelector::styleForElement):
+ (WebCore::CSSStyleSelector::styleRulesForElement):
+ (WebCore::convertToLength):
+ (WebCore::colorForCSSValue):
+ (WebCore::CSSStyleSelector::applyProperty):
+ (WebCore::CSSStyleSelector::getColorFromPrimitiveValue):
+ * css/cssstyleselector.h:
+ * dom/CDATASection.cpp:
+ (WebCore::CDATASection::toString):
+ * dom/Document.cpp:
+ (WebCore::Document::recalcStyle):
+ * dom/Document.h:
+ (WebCore::Document::baseTarget):
+ (WebCore::Document::setBaseTarget):
+ * dom/dom_elementimpl.cpp:
+ (WebCore::Element::openTagStartToString):
+ * dom/xml_tokenizer.cpp:
+ (WebCore::handleElementAttributes):
+ (WebCore::XMLTokenizer::startElementNs):
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::type):
+ * editing/TextIterator.cpp:
+ (WebCore::TextIterator::advance):
+ (WebCore::TextIterator::handleTextBox):
+ (WebCore::TextIterator::handleNonTextNode):
+ (WebCore::TextIterator::exitNode):
+ (WebCore::SimplifiedBackwardsTextIterator::advance):
+ (WebCore::SimplifiedBackwardsTextIterator::handleTextNode):
+ (WebCore::CharacterIterator::advance):
+ (WebCore::WordAwareIterator::advance):
+ (WebCore::WordAwareIterator::length):
+ (WebCore::WordAwareIterator::characters):
+ (WebCore::CircularSearchBuffer::CircularSearchBuffer):
+ (WebCore::CircularSearchBuffer::append):
+ (WebCore::TextIterator::rangeFromLocationAndLength):
+ (WebCore::findPlainText):
+ * editing/TextIterator.h:
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::formData):
+ * khtml/ecma/kjs_navigator.cpp:
+ (KJS::Navigator::getValueProperty):
+ * khtml/ecma/kjs_proxy.cpp:
+ (WebCore::KJSProxy::initScriptIfNeeded):
+ * khtml/ecma/kjs_window.cpp:
+ (KJS::Location::getValueProperty):
+ * ksvg2/misc/KCanvasRenderingStyle.cpp:
+ (WebCore::KSVGPainterFactory::fillPaintServer):
+ (WebCore::KSVGPainterFactory::strokePaintServer):
+ * ksvg2/svg/SVGAngle.cpp:
+ (SVGAngle::calculate):
+ (SVGAngle::setValueAsString):
+ (SVGAngle::valueAsString):
+ (SVGAngle::convertToSpecifiedUnits):
+ (SVGAngle::shortestArcBisector):
+ * ksvg2/svg/SVGAngle.h:
+ * ksvg2/svg/SVGAnimationElement.cpp:
+ (SVGAnimationElement::targetElement):
+ (SVGAnimationElement::parseMappedAttribute):
+ (SVGAnimationElement::parseClockValue):
+ (SVGAnimationElement::targetAttribute):
+ (SVGAnimationElement::setTargetAttribute):
+ (SVGAnimationElement::detectAnimationMode):
+ (SVGAnimationElement::calculateCurrentValueItem):
+ (SVGAnimationElement::calculateRelativeTimePercentage):
+ * ksvg2/svg/SVGColor.cpp:
+ (SVGColor::setRGBColor):
+ * ksvg2/svg/SVGDOMImplementation.cpp:
+ (svgFeatureSet):
+ (SVGDOMImplementation::self):
+ (SVGDOMImplementation::hasFeature):
+ (SVGDOMImplementation::createDocumentType):
+ (SVGDOMImplementation::createDocument):
+ * ksvg2/svg/SVGDOMImplementation.h:
+ * ksvg2/svg/SVGPaint.cpp:
+ (SVGPaint::cssText):
+ * ksvg2/svg/SVGPathSegClosePath.h:
+ (WebCore::SVGPathSegClosePath::toString):
+ * ksvg2/svg/SVGPreserveAspectRatio.cpp:
+ (SVGPreserveAspectRatio::parsePreserveAspectRatio):
+ (SVGPreserveAspectRatio::getCTM):
+ * ksvg2/svg/SVGStopElement.cpp:
+ (SVGStopElement::parseMappedAttribute):
+ * ksvg2/svg/SVGStyleElement.cpp:
+ (SVGStyleElement::childrenChanged):
+ * ksvg2/svg/SVGURIReference.cpp:
+ (SVGURIReference::getTarget):
+ * kwq/ClipboardMac.mm:
+ (WebCore::ClipboardMac::setData):
+ (WebCore::ClipboardMac::types):
+ (WebCore::ClipboardMac::setEffectAllowed):
+ (WebCore::cocoaOpFromIEOp):
+ (WebCore::IEOpFromCocoaOp):
+ (WebCore::ClipboardMac::sourceOperation):
+ (WebCore::ClipboardMac::destinationOperation):
+ * kwq/KWQCString.cpp:
+ (DeprecatedCString::append):
+ * kwq/KWQKHTMLSettings.h:
+ (KHTMLSettings::stdFontName):
+ (KHTMLSettings::fixedFontName):
+ (KHTMLSettings::serifFontName):
+ (KHTMLSettings::sansSerifFontName):
+ (KHTMLSettings::cursiveFontName):
+ (KHTMLSettings::fantasyFontName):
+ (KHTMLSettings::minFontSize):
+ (KHTMLSettings::minLogicalFontSize):
+ (KHTMLSettings::mediumFontSize):
+ (KHTMLSettings::mediumFixedFontSize):
+ (KHTMLSettings::autoLoadImages):
+ (KHTMLSettings::isJavaScriptEnabled):
+ (KHTMLSettings::JavaScriptCanOpenWindowsAutomatically):
+ (KHTMLSettings::isJavaEnabled):
+ (KHTMLSettings::isPluginsEnabled):
+ (KHTMLSettings::encoding):
+ (KHTMLSettings::userStyleSheet):
+ (KHTMLSettings::shouldPrintBackgrounds):
+ (KHTMLSettings::textAreasAreResizable):
+ (KHTMLSettings::setStdFontName):
+ (KHTMLSettings::setFixedFontName):
+ (KHTMLSettings::setSerifFontName):
+ (KHTMLSettings::setSansSerifFontName):
+ (KHTMLSettings::setCursiveFontName):
+ (KHTMLSettings::setFantasyFontName):
+ (KHTMLSettings::setMinFontSize):
+ (KHTMLSettings::setMinLogicalFontSize):
+ (KHTMLSettings::setMediumFontSize):
+ (KHTMLSettings::setMediumFixedFontSize):
+ (KHTMLSettings::setAutoLoadImages):
+ (KHTMLSettings::setIsJavaScriptEnabled):
+ (KHTMLSettings::setIsJavaEnabled):
+ (KHTMLSettings::setArePluginsEnabled):
+ (KHTMLSettings::setJavaScriptCanOpenWindowsAutomatically):
+ (KHTMLSettings::setEncoding):
+ (KHTMLSettings::setUserStyleSheet):
+ (KHTMLSettings::setShouldPrintBackgrounds):
+ (KHTMLSettings::setTextAreasAreResizable):
+ * kwq/KWQLoader.mm:
+ (KWQServeSynchronousRequest):
+ * kwq/KWQTextStream.cpp:
+ (QTextStream::QTextStream):
+ (QTextStream::operator<<):
+ (QTextStream::precision):
+ * kwq/KWQTextStream.h:
+ * kwq/RenderTreeAsText.cpp:
+ (operator<<):
+ (quoteAndEscapeNonPrintables):
+ (writeTextRun):
+ (write):
+ (writeSelection):
+ * loader/Cache.cpp:
+ (WebCore::Cache::init):
+ (WebCore::Cache::requestImage):
+ (WebCore::Cache::requestStyleSheet):
+ (WebCore::Cache::preloadStyleSheet):
+ (WebCore::Cache::requestScript):
+ (WebCore::Cache::preloadScript):
+ (WebCore::Cache::requestXSLStyleSheet):
+ (WebCore::Cache::requestXBLDocument):
+ (WebCore::Cache::remove):
+ * loader/Cache.h:
+ * loader/CachedCSSStyleSheet.cpp:
+ (WebCore::CachedCSSStyleSheet::error):
+ * loader/CachedCSSStyleSheet.h:
+ * loader/CachedImage.cpp:
+ (WebCore::CachedImage::error):
+ * loader/CachedImage.h:
+ * loader/CachedObject.h:
+ * loader/CachedScript.cpp:
+ (WebCore::CachedScript::checkNotify):
+ (WebCore::CachedScript::error):
+ * loader/CachedScript.h:
+ * loader/CachedXBLDocument.cpp:
+ (WebCore::CachedXBLDocument::error):
+ * loader/CachedXBLDocument.h:
+ * loader/CachedXSLStyleSheet.cpp:
+ (WebCore::CachedXSLStyleSheet::error):
+ * loader/CachedXSLStyleSheet.h:
+ * loader/DocLoader.cpp:
+ (WebCore::DocLoader::DocLoader):
+ (WebCore::DocLoader::~DocLoader):
+ (WebCore::DocLoader::needReload):
+ (WebCore::DocLoader::requestImage):
+ (WebCore::DocLoader::requestStyleSheet):
+ (WebCore::DocLoader::requestScript):
+ (WebCore::DocLoader::requestXSLStyleSheet):
+ (WebCore::DocLoader::requestXBLDocument):
+ (WebCore::DocLoader::setAutoloadImages):
+ (WebCore::DocLoader::setShowAnimations):
+ (WebCore::DocLoader::removeCachedObject):
+ * loader/loader.cpp:
+ (WebCore::Loader::receivedAllData):
+ (WebCore::Loader::receivedResponse):
+ * page/Frame.cpp:
+ (WebCore::UserStyleSheetLoader::setStyleSheet):
+ (WebCore::Frame::didOpenURL):
+ (WebCore::Frame::setMetaRefreshEnabled):
+ (WebCore::Frame::setAutoloadImages):
+ (WebCore::Frame::autoloadImages):
+ (WebCore::Frame::clear):
+ (WebCore::Frame::receivedFirstData):
+ (WebCore::Frame::begin):
+ (WebCore::Frame::write):
+ (WebCore::Frame::baseTarget):
+ (WebCore::Frame::completeURL):
+ (WebCore::Frame::scheduleRedirection):
+ (WebCore::Frame::scheduleLocationChange):
+ (WebCore::Frame::scheduleHistoryNavigation):
+ (WebCore::Frame::changeLocation):
+ (WebCore::Frame::redirectionTimerFired):
+ (WebCore::Frame::encoding):
+ (WebCore::Frame::gotoAnchor):
+ (WebCore::Frame::setStandardFont):
+ (WebCore::Frame::setFixedFont):
+ (WebCore::Frame::selectedText):
+ (WebCore::Frame::selection):
+ (WebCore::Frame::dragCaret):
+ (WebCore::Frame::setSelection):
+ (WebCore::Frame::setDragCaret):
+ (WebCore::Frame::paintCaret):
+ (WebCore::Frame::paintDragCaret):
+ (WebCore::Frame::urlSelected):
+ (WebCore::Frame::requestFrame):
+ (WebCore::Frame::requestObject):
+ (WebCore::Frame::shouldUsePlugin):
+ (WebCore::Frame::loadPlugin):
+ (WebCore::Frame::loadSubframe):
+ (WebCore::Frame::submitForm):
+ (WebCore::Frame::lastModified):
+ (WebCore::Frame::reparseConfiguration):
+ (WebCore::Frame::shouldChangeSelection):
+ (WebCore::Frame::appliedEditing):
+ (WebCore::Frame::unappliedEditing):
+ (WebCore::Frame::reappliedEditing):
+ (WebCore::Frame::executeScript):
+ (WebCore::updateState):
+ (WebCore::Frame::isCharacterSmartReplaceExempt):
+ (WebCore::Frame::openURL):
+ (WebCore::Frame::didNotOpenURL):
+ (WebCore::Frame::setEncoding):
+ (WebCore::Frame::saveInterpreterBuiltins):
+ (WebCore::Frame::restoreInterpreterBuiltins):
+ (WebCore::Frame::mutableInstances):
+ (WebCore::Frame::setPolicyBaseURL):
+ (WebCore::Frame::addMetaData):
+ (WebCore::Frame::scrollToAnchor):
+ (WebCore::Frame::setMediaType):
+ (WebCore::Frame::highlightAllMatchesForString):
+ (WebCore::Frame::tree):
+ * page/Frame.h:
+ (WebCore::Frame::instances):
+ * page/FramePrivate.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameViewPrivate::FrameViewPrivate):
+ (WebCore::FrameView::FrameView):
+ (WebCore::FrameView::~FrameView):
+ (WebCore::FrameView::init):
+ (WebCore::FrameView::setMarginWidth):
+ (WebCore::FrameView::setMarginHeight):
+ (WebCore::FrameView::adjustViewSize):
+ (WebCore::FrameView::layout):
+ (WebCore::FrameView::dispatchDragEvent):
+ (WebCore::FrameView::scrollTo):
+ (WebCore::FrameView::setMediaType):
+ (WebCore::FrameView::mediaType):
+ (WebCore::FrameView::setResizingFrameSet):
+ (WebCore::FrameView::setIgnoreWheelEvents):
+ * page/FrameView.h:
+ (WebCore::FrameView::frameWidth):
+ (WebCore::FrameView::marginWidth):
+ (WebCore::FrameView::marginHeight):
+ (WebCore::FrameView::ref):
+ (WebCore::FrameView::deref):
+ * page/ResourceRequest.h:
+ (WebCore::ResourceRequest::contentType):
+ (WebCore::ResourceRequest::setContentType):
+ * platform/FontFamily.h:
+ * platform/Image.h:
+ * platform/KURL.cpp:
+ (KURL::KURL):
+ (KURL::parse):
+ (urlcmp):
+ (KURL::encode_string):
+ (encodeHostname):
+ * platform/KURL.h:
+ * platform/PlatformString.h:
+ (WebCore::String::left):
+ (WebCore::String::right):
+ * platform/String.cpp:
+ (WebCore::String::toInt):
+ * platform/StringImpl.cpp:
+ (WebCore::StringImpl::toInt):
+ * platform/TransferJob.cpp:
+ (WebCore::TransferJob::queryMetaData):
+ (WebCore::TransferJob::addMetaData):
+ * platform/TransferJob.h:
+ * platform/mac/ImageMac.mm:
+ (WebCore::Image::supportsType):
+ * platform/mac/TransferJobMac.mm:
+ (WebCore::TransferJob::start):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::information):
+ * rendering/RenderTextField.cpp:
+ (WebCore::RenderTextField::updateFromElement):
+ * xml/xmlhttprequest.cpp:
+ (WebCore::getMIMEType):
+ (WebCore::getCharset):
+ (WebCore::XMLHttpRequest::getReadyState):
+ (WebCore::XMLHttpRequest::getResponseText):
+ (WebCore::XMLHttpRequest::getResponseXML):
+ (WebCore::XMLHttpRequest::XMLHttpRequest):
+ (WebCore::XMLHttpRequest::~XMLHttpRequest):
+ (WebCore::XMLHttpRequest::changeState):
+ (WebCore::XMLHttpRequest::callReadyStateChangeListener):
+ (WebCore::XMLHttpRequest::urlMatchesDocumentDomain):
+ (WebCore::XMLHttpRequest::open):
+ (WebCore::XMLHttpRequest::send):
+ (WebCore::XMLHttpRequest::abort):
+ (WebCore::XMLHttpRequest::overrideMIMEType):
+ (WebCore::XMLHttpRequest::setRequestHeader):
+ (WebCore::XMLHttpRequest::getRequestHeader):
+ (WebCore::XMLHttpRequest::getAllResponseHeaders):
+ (WebCore::XMLHttpRequest::getResponseHeader):
+ (WebCore::XMLHttpRequest::responseIsXML):
+ (WebCore::XMLHttpRequest::getStatus):
+ (WebCore::XMLHttpRequest::getStatusText):
+ (WebCore::XMLHttpRequest::processSyncLoadResults):
+ (WebCore::XMLHttpRequest::receivedAllData):
+ (WebCore::XMLHttpRequest::receivedRedirect):
+ (WebCore::XMLHttpRequest::receivedData):
+ (WebCore::XMLHttpRequest::cancelRequests):
+ (WebCore::XMLHttpRequest::detachRequests):
+ * xml/xmlhttprequest.h:
+
2006-03-20 Alexey Proskuryakov <ap@nypop.com>
Reviewed by Darin.
- (NSString *)_text
{
- return [self _range]->text().deprecatedString().getNSString();
+ return [self _range]->text();
}
@end
const KURL& url = request.url();
- NSString *frameName = request.frameName.length() == 0 ? nil : request.frameName.getNSString();
+ NSString *frameName = request.frameName.isEmpty() ? nil : (NSString*)request.frameName;
if (frameName) {
// FIXME: Can't we just use m_frame->findFrame?
if (WebCoreFrameBridge *bridge = [m_frame->bridge() findFrameNamed:frameName]) {
WebCoreFrameBridge *bridge = [page mainFrame];
if ([bridge impl])
- [bridge impl]->tree()->setName(request.frameName);
+ [bridge impl]->tree()->setName(AtomicString(request.frameName));
if (partResult)
*partResult = [bridge impl];
void clear();
- void setBridge(WebCoreFrameBridge *p);
- WebCoreFrameBridge *bridge() const { return _bridge; }
+ void setBridge(WebCoreFrameBridge* p);
+ WebCoreFrameBridge* bridge() const { return _bridge; }
virtual void setView(FrameView*);
virtual void frameDetached();
- virtual bool openURL(const KURL &);
+ virtual bool openURL(const KURL&);
virtual void openURLRequest(const ResourceRequest&);
virtual void submitForm(const ResourceRequest&);
- DeprecatedString advanceToNextMisspelling(bool startBeforeSelection = false);
+ String advanceToNextMisspelling(bool startBeforeSelection = false);
- virtual void setTitle(const String &);
+ virtual void setTitle(const String&);
virtual void setStatusBarText(const String&);
virtual void urlSelected(const ResourceRequest&);
- virtual ObjectContentType objectContentType(const KURL& url, const DeprecatedString& mimeType);
- virtual Plugin* createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const DeprecatedString& mimeType);
- virtual Frame* createFrame(const KURL& url, const DeprecatedString& name, RenderPart* renderer, const String& referrer);
+ virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
+ virtual Plugin* createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const String& mimeType);
+ virtual Frame* createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer);
virtual void scheduleClose();
virtual void unfocusWindow();
- void openURLFromPageCache(KWQPageState *state);
+ void openURLFromPageCache(KWQPageState* state);
virtual void saveDocumentState();
virtual void restoreDocumentState();
virtual void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID);
virtual void setDisplaysWithFocusAttributes(bool flag);
- NSView *nextKeyView(Node *startingPoint, KWQSelectionDirection);
- NSView *nextKeyViewInFrameHierarchy(Node *startingPoint, KWQSelectionDirection);
- static NSView *nextKeyViewForWidget(Widget *startingPoint, KWQSelectionDirection);
+ NSView* nextKeyView(Node* startingPoint, KWQSelectionDirection);
+ NSView* nextKeyViewInFrameHierarchy(Node* startingPoint, KWQSelectionDirection);
+ static NSView* nextKeyViewForWidget(Widget* startingPoint, KWQSelectionDirection);
static bool currentEventIsKeyboardOptionTab();
- static bool handleKeyboardOptionTabInView(NSView *view);
+ static bool handleKeyboardOptionTabInView(NSView* view);
virtual bool tabsToLinks() const;
virtual bool tabsToAllControls() const;
- static bool currentEventIsMouseDownInWidget(Widget *candidate);
+ static bool currentEventIsMouseDownInWidget(Widget* candidate);
virtual void runJavaScriptAlert(const String& message);
virtual bool runJavaScriptConfirm(const String& message);
virtual void createEmptyDocument();
- static WebCoreFrameBridge *bridgeForWidget(const Widget *);
+ static WebCoreFrameBridge* bridgeForWidget(const Widget*);
- virtual DeprecatedString incomingReferrer() const;
- virtual DeprecatedString userAgent() const;
+ virtual String incomingReferrer() const;
+ virtual String userAgent() const;
- virtual DeprecatedString mimeTypeForFileName(const DeprecatedString &) const;
+ virtual String mimeTypeForFileName(const String&) const;
- NSImage *selectionImage() const;
- NSImage *snapshotDragImage(Node *node, NSRect *imageRect, NSRect *elementRect) const;
+ NSImage* selectionImage() const;
+ NSImage* snapshotDragImage(Node* node, NSRect* imageRect, NSRect* elementRect) const;
bool dispatchDragSrcEvent(const AtomicString &eventType, const PlatformMouseEvent&) const;
- NSFont *fontForSelection(bool *hasMultipleFonts) const;
- NSDictionary *fontAttributesForSelectionStart() const;
+ NSFont* fontForSelection(bool* hasMultipleFonts) const;
+ NSDictionary* fontAttributesForSelectionStart() const;
NSWritingDirection baseWritingDirectionForSelectionStart() const;
- virtual void markMisspellingsInAdjacentWords(const VisiblePosition &);
- virtual void markMisspellings(const SelectionController &);
+ virtual void markMisspellingsInAdjacentWords(const VisiblePosition&);
+ virtual void markMisspellings(const SelectionController&);
- NSFileWrapper *fileWrapperForElement(Element *);
- NSAttributedString *attributedString(Node *startNode, int startOffset, Node *endNode, int endOffset);
+ NSFileWrapper* fileWrapperForElement(Element*);
+ NSAttributedString* attributedString(Node* startNode, int startOffset, Node* endNode, int endOffset);
- void mouseDown(NSEvent *);
- void mouseDragged(NSEvent *);
- void mouseUp(NSEvent *);
- void mouseMoved(NSEvent *);
- bool keyEvent(NSEvent *);
- bool wheelEvent(NSEvent *);
+ void mouseDown(NSEvent*);
+ void mouseDragged(NSEvent*);
+ void mouseUp(NSEvent*);
+ void mouseMoved(NSEvent*);
+ bool keyEvent(NSEvent*);
+ bool wheelEvent(NSEvent*);
- void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
+ void sendFakeEventsAfterWidgetTracking(NSEvent* initiatingEvent);
virtual bool lastEventIsMouseUp() const;
void setActivationEventNumber(int num) { _activationEventNumber = num; }
bool dragHysteresisExceeded(float dragLocationX, float dragLocationY) const;
- bool eventMayStartDrag(NSEvent *) const;
+ bool eventMayStartDrag(NSEvent*) const;
void dragSourceMovedTo(const PlatformMouseEvent&);
void dragSourceEndedAt(const PlatformMouseEvent&, NSDragOperation);
bool tryCopy();
bool tryPaste();
- bool sendContextMenuEvent(NSEvent *);
+ bool sendContextMenuEvent(NSEvent*);
- virtual bool passMouseDownEventToWidget(Widget *);
+ virtual bool passMouseDownEventToWidget(Widget*);
virtual bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframePart);
- virtual bool passWheelEventToChildWidget(Node *);
+ virtual bool passWheelEventToChildWidget(Node*);
- NSString *searchForLabelsAboveCell(RegularExpression *regExp, HTMLTableCellElement *cell);
- NSString *searchForLabelsBeforeElement(NSArray *labels, Element *element);
- NSString *matchLabelsAgainstElement(NSArray *labels, Element *element);
+ NSString* searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell);
+ NSString* searchForLabelsBeforeElement(NSArray* labels, Element* element);
+ NSString* matchLabelsAgainstElement(NSArray* labels, Element* element);
- bool findString(NSString *str, bool forward, bool caseFlag, bool wrapFlag);
+ bool findString(NSString* str, bool forward, bool caseFlag, bool wrapFlag);
virtual void tokenizerProcessedData();
- virtual DeprecatedString overrideMediaType() const;
+ virtual String overrideMediaType() const;
- NSColor *bodyBackgroundColor() const;
+ NSColor* bodyBackgroundColor() const;
WebCoreKeyboardUIMode keyboardUIMode() const;
void didTellBridgeAboutLoad(const String& URL);
bool haveToldBridgeAboutLoad(const String& URL);
- virtual KJS::Bindings::Instance *getEmbedInstanceForWidget(Widget*);
- virtual KJS::Bindings::Instance *getObjectInstanceForWidget(Widget*);
- virtual KJS::Bindings::Instance *getAppletInstanceForWidget(Widget*);
- void addPluginRootObject(const KJS::Bindings::RootObject *root);
+ virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*);
+ virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
+ virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
+ void addPluginRootObject(const KJS::Bindings::RootObject* root);
void cleanupPluginRootObjects();
- virtual void registerCommandForUndo(const EditCommandPtr &);
- virtual void registerCommandForRedo(const EditCommandPtr &);
+ virtual void registerCommandForUndo(const EditCommandPtr&);
+ virtual void registerCommandForRedo(const EditCommandPtr&);
virtual void clearUndoRedoOperations();
virtual void issueUndoCommand();
virtual void issueRedoCommand();
virtual void respondToChangedContents();
virtual bool isContentEditable() const;
virtual bool shouldChangeSelection(const SelectionController &oldSelection, const SelectionController &newSelection, EAffinity affinity, bool stillSelecting) const;
- virtual bool shouldBeginEditing(const Range *) const;
- virtual bool shouldEndEditing(const Range *) const;
+ virtual bool shouldBeginEditing(const Range*) const;
+ virtual bool shouldEndEditing(const Range*) const;
virtual void didBeginEditing() const;
virtual void didEndEditing() const;
- KJS::Bindings::RootObject *executionContextForDOM();
- KJS::Bindings::RootObject *bindingRootObject();
+ KJS::Bindings::RootObject* executionContextForDOM();
+ KJS::Bindings::RootObject* bindingRootObject();
- WebScriptObject *windowScriptObject();
- NPObject *windowScriptNPObject();
+ WebScriptObject* windowScriptObject();
+ NPObject* windowScriptNPObject();
virtual void partClearedInBegin();
// Implementation of CSS property -khtml-user-drag == auto
virtual bool shouldDragAutoNode(Node*, int x, int y) const;
- void setMarkedTextRange(const Range *, NSArray *attributes, NSArray *ranges);
- virtual Range *markedTextRange() const { return m_markedTextRange.get(); }
+ void setMarkedTextRange(const Range* , NSArray* attributes, NSArray* ranges);
+ virtual Range* markedTextRange() const { return m_markedTextRange.get(); }
virtual bool canGoBackOrForward(int distance) const;
virtual void didFirstLayout();
- NSMutableDictionary *dashboardRegionsDictionary();
+ NSMutableDictionary* dashboardRegionsDictionary();
void dashboardRegionsChanged();
virtual bool isCharacterSmartReplaceExempt(const QChar &, bool);
virtual void handleMouseMoveEvent(const MouseEventWithHitTestResults&);
virtual void handleMouseReleaseEvent(const MouseEventWithHitTestResults&);
- NSView *mouseDownViewIfStillGood();
+ NSView* mouseDownViewIfStillGood();
- NSView *nextKeyViewInFrame(Node *startingPoint, KWQSelectionDirection);
- static NSView *documentViewForNode(Node *);
+ NSView* nextKeyViewInFrame(Node* startingPoint, KWQSelectionDirection);
+ static NSView* documentViewForNode(Node*);
bool dispatchCPPEvent(const AtomicString &eventType, ClipboardMac::AccessPolicy policy);
- NSImage *imageFromRect(NSRect rect) const;
+ NSImage* imageFromRect(NSRect rect) const;
void freeClipboard();
virtual void detachFromView();
- WebCoreFrameBridge *_bridge;
+ WebCoreFrameBridge* _bridge;
- NSView *_mouseDownView;
+ NSView* _mouseDownView;
bool _mouseDownWasInSubframe;
bool _sendingEventToSubview;
bool _mouseDownMayStartDrag;
float _mouseDownTimestamp;
int _activationEventNumber;
- static NSEvent *_currentEvent;
+ static NSEvent* _currentEvent;
- NSMutableDictionary *_formValuesAboutToBeSubmitted;
- ObjCDOMElement *_formAboutToBeSubmitted;
+ NSMutableDictionary* _formValuesAboutToBeSubmitted;
+ ObjCDOMElement* _formAboutToBeSubmitted;
bool _haveUndoRedoOperations;
friend class Frame;
- KJS::Bindings::RootObject *_bindingRoot; // The root object used for objects
+ KJS::Bindings::RootObject* _bindingRoot; // The root object used for objects
// bound outside the context of a plugin.
DeprecatedPtrList<KJS::Bindings::RootObject> rootObjects;
- WebScriptObject *_windowScriptObject;
- NPObject *_windowScriptNPObject;
+ WebScriptObject* _windowScriptObject;
+ NPObject* _windowScriptNPObject;
RefPtr<Node> _dragSrc; // element that may be a drag source, for the current mouse gesture
bool _dragSrcIsLink;
RefPtr<Range> m_markedTextRange;
};
-inline FrameMac *Mac(Frame *frame) { return static_cast<FrameMac *>(frame); }
-inline const FrameMac *Mac(const Frame *frame) { return static_cast<const FrameMac *>(frame); }
+inline FrameMac* Mac(Frame* frame) { return static_cast<FrameMac*>(frame); }
+inline const FrameMac* Mac(const Frame* frame) { return static_cast<const FrameMac*>(frame); }
}
referrer:referrer
reload:request.reload
userGesture:userGestureHint()
- target:request.frameName.getNSString()
+ target:request.frameName
triggeringEvent:nil
form:nil
formValues:nil];
if (aboveCell) {
// search within the above cell we found for a match
for (Node *n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
- if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE)
- {
+ if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
// For each text chunk, run the regexp
DeprecatedString nodeString = n->nodeValue().deprecatedString();
int pos = regExp->searchRev(nodeString);
- if (pos >= 0) {
+ if (pos >= 0)
return nodeString.mid(pos, regExp->matchedLength()).getNSString();
- }
}
}
}
nodeString = nodeString.right(charsSearchedThreshold - lengthSearched);
}
int pos = regExp->searchRev(nodeString);
- if (pos >= 0) {
+ if (pos >= 0)
return nodeString.mid(pos, regExp->matchedLength()).getNSString();
- } else {
+ else
lengthSearched += nodeString.length();
- }
}
}
}
} while (pos != -1);
- if (bestPos != -1) {
+ if (bestPos != -1)
return name.mid(bestPos, bestLength).getNSString();
- }
return nil;
}
// Searches from the beginning of the document if nothing is selected.
bool FrameMac::findString(NSString *string, bool forward, bool caseFlag, bool wrapFlag)
{
- DeprecatedString target = DeprecatedString::fromNSString(string);
- if (target.isEmpty()) {
+ String target = string;
+ if (target.isEmpty())
return false;
- }
// Initially search from the start (if forward) or end (if backward) of the selection, and search to edge of document.
RefPtr<Range> searchRange(rangeOfContents(document()));
if (selection().start().node()) {
- if (forward) {
+ if (forward)
setStart(searchRange.get(), VisiblePosition(selection().start(), selection().affinity()));
- } else {
+ else
setEnd(searchRange.get(), VisiblePosition(selection().end(), selection().affinity()));
- }
}
RefPtr<Range> resultRange(findPlainText(searchRange.get(), target, forward, caseFlag));
// If we re-found the (non-empty) selected range, then search again starting just past the selected range.
if (selection().start().node() && *resultRange == *selection().toRange()) {
searchRange = rangeOfContents(document());
- if (forward) {
+ if (forward)
setStart(searchRange.get(), VisiblePosition(selection().end(), selection().affinity()));
- } else {
+ else
setEnd(searchRange.get(), VisiblePosition(selection().start(), selection().affinity()));
- }
resultRange = findPlainText(searchRange.get(), target, forward, caseFlag);
}
// this should be a success case instead, so we'll just fall through in that case.
}
- if (resultRange->collapsed(exception)) {
+ if (resultRange->collapsed(exception))
return false;
- }
setSelection(SelectionController(resultRange.get(), DOWNSTREAM));
revealSelection();
// FIXME: Frame targeting is only one of the ways the submission could end up doing something other
// than replacing this frame's content, so this check is flawed. On the other hand, the check is hardly
// needed any more now that we reset d->m_submittedFormURL on each mouse or key down event.
- WebCoreFrameBridge *target = request.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.frameName.getNSString()];
+ WebCoreFrameBridge *target = request.frameName.isEmpty() ? _bridge : [_bridge findFrameNamed:request.frameName];
Frame *targetPart = [target impl];
bool willReplaceThisFrame = false;
for (Frame *p = this; p; p = p->tree()->parent()) {
referrer:[_bridge referrer]
reload:request.reload
userGesture:true
- target:request.frameName.getNSString()
+ target:request.frameName
triggeringEvent:_currentEvent
form:_formAboutToBeSubmitted
formValues:_formValuesAboutToBeSubmitted];
ASSERT(request.contentType().startsWith("Content-Type: "));
[_bridge postWithURL:request.url().getNSURL()
referrer:[_bridge referrer]
- target:request.frameName.getNSString()
+ target:request.frameName
data:arrayFromFormData(request.postData)
- contentType:request.contentType().mid(14).getNSString()
+ contentType:request.contentType().substring(14)
triggeringEvent:_currentEvent
form:_formAboutToBeSubmitted
formValues:_formValuesAboutToBeSubmitted];
referrer:referrer
reload:request.reload
userGesture:true
- target:request.frameName.getNSString()
+ target:request.frameName
triggeringEvent:_currentEvent
form:nil
formValues:nil];
END_BLOCK_OBJC_EXCEPTIONS;
}
-ObjectContentType FrameMac::objectContentType(const KURL& url, const DeprecatedString& mimeType)
+ObjectContentType FrameMac::objectContentType(const KURL& url, const String& mimeType)
{
- return (ObjectContentType)[_bridge determineObjectFromMIMEType:mimeType.getNSString() URL:url.getNSURL()];
+ return (ObjectContentType)[_bridge determineObjectFromMIMEType:mimeType URL:url.getNSURL()];
}
-Plugin* FrameMac::createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const DeprecatedString& mimeType)
+Plugin* FrameMac::createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const String& mimeType)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
return new Plugin(new Widget([_bridge viewForPluginWithURL:url.getNSURL()
attributeNames:paramNames.getNSArray()
attributeValues:paramValues.getNSArray()
- MIMEType:mimeType.getNSString()]));
+ MIMEType:mimeType]));
END_BLOCK_OBJC_EXCEPTIONS;
return 0;
}
-Frame* FrameMac::createFrame(const KURL& url, const DeprecatedString& name, RenderPart* renderer, const String& referrer)
+Frame* FrameMac::createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer)
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
marginHeight = o->getMarginHeight();
}
- WebCoreFrameBridge *childBridge = [_bridge createChildFrameNamed:name.getNSString()
+ WebCoreFrameBridge *childBridge = [_bridge createChildFrameNamed:name
withURL:url.getNSURL()
referrer:referrer
renderPart:renderer
void FrameMac::setTitle(const String &title)
{
- DeprecatedString text = title.deprecatedString();
+ String text = title;
text.replace(QChar('\\'), backslashAsCurrencySymbol());
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [_bridge setTitle:text.getNSString()];
+ [_bridge setTitle:text];
END_BLOCK_OBJC_EXCEPTIONS;
}
void FrameMac::setStatusBarText(const String& status)
{
- DeprecatedString text = status.deprecatedString();
+ String text = status;
text.replace(QChar('\\'), backslashAsCurrencySymbol());
-
+
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- [_bridge setStatusText:text.getNSString()];
+ [_bridge setStatusText:text];
END_BLOCK_OBJC_EXCEPTIONS;
}
END_BLOCK_OBJC_EXCEPTIONS;
}
-DeprecatedString FrameMac::advanceToNextMisspelling(bool startBeforeSelection)
+String FrameMac::advanceToNextMisspelling(bool startBeforeSelection)
{
int exception = 0;
if (!editableNode->isContentEditable()) {
editableNode = editableNode->nextEditable();
if (!editableNode) {
- return DeprecatedString();
+ return String();
}
searchRange->setStartBefore(editableNode, exception);
startedWithSelection = false; // won't need to wrap
}
if (searchRange->collapsed(exception))
- return DeprecatedString(); // nothing to search in
+ return String(); // nothing to search in
// Get the spell checker if it is available
NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
if (checker == nil)
- return DeprecatedString();
+ return String();
WordAwareIterator it(searchRange.get());
bool wrapped = false;
}
}
- return DeprecatedString();
+ return String();
}
bool FrameMac::wheelEvent(NSEvent *event)
Frame::redirectionTimerFired(timer);
}
-DeprecatedString FrameMac::userAgent() const
+String FrameMac::userAgent() const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString::fromNSString([_bridge userAgentForURL:url().getNSURL()]);
+ return [_bridge userAgentForURL:url().getNSURL()];
END_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString();
+ return String();
}
-DeprecatedString FrameMac::mimeTypeForFileName(const DeprecatedString &fileName) const
+String FrameMac::mimeTypeForFileName(const String& fileName) const
{
- NSString *ns = fileName.getNSString();
-
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString::fromNSString([_bridge MIMETypeForPath:ns]);
+ return [_bridge MIMETypeForPath:fileName];
END_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString();
+ return String();
}
NSView *FrameMac::nextKeyViewInFrame(Node *node, KWQSelectionDirection direction)
// delete old status bar msg's from kjs (if it _was_ activated on last URL)
if (d->m_bJScriptEnabled) {
- d->m_kjsStatusBarText = DeprecatedString::null;
- d->m_kjsDefaultStatusBarText = DeprecatedString::null;
+ d->m_kjsStatusBarText = String();
+ d->m_kjsDefaultStatusBarText = String();
}
ASSERT(kurl);
END_BLOCK_OBJC_EXCEPTIONS;
}
-DeprecatedString FrameMac::incomingReferrer() const
+String FrameMac::incomingReferrer() const
{
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString::fromNSString([_bridge incomingReferrer]);
+ return [_bridge incomingReferrer];
END_BLOCK_OBJC_EXCEPTIONS;
- return DeprecatedString();
+ return String();
}
void FrameMac::runJavaScriptAlert(const String& message)
Node * _startNode = _start;
- if (_startNode == nil) {
+ if (!_startNode)
return nil;
- }
result = [[[NSMutableAttributedString alloc] init] autorelease];
if (renderer->isText()) {
if (!style->collapseWhiteSpace()) {
if (needSpace && !addedSpace) {
- if (text.isEmpty() && linkStartLocation == [result length]) {
+ if (text.isEmpty() && linkStartLocation == [result length])
++linkStartLocation;
- }
[result appendAttributedString:pendingStyledSpace];
}
int runStart = (start == -1) ? 0 : start;
runEnd = kMin(runEnd, box->m_start + box->m_len);
if (runStart >= box->m_start &&
runStart < box->m_start + box->m_len) {
- if (box == textObj->firstTextBox() && box->m_start == runStart && runStart > 0) {
+ if (box == textObj->firstTextBox() && box->m_start == runStart && runStart > 0)
needSpace = true; // collapsed space at the start
- }
if (needSpace && !addedSpace) {
if (pendingStyledSpace != nil) {
- if (text.isEmpty() && linkStartLocation == [result length]) {
+ if (text.isEmpty() && linkStartLocation == [result length])
++linkStartLocation;
- }
[result appendAttributedString:pendingStyledSpace];
- } else {
+ } else
text += ' ';
- }
}
DeprecatedString runText = str.mid(runStart, runEnd - runStart);
runText.replace('\n', ' ');
_bridge = bridge;
}
-DeprecatedString FrameMac::overrideMediaType() const
+String FrameMac::overrideMediaType() const
{
NSString *overrideType = [_bridge overrideMediaType];
if (overrideType)
- return DeprecatedString::fromNSString(overrideType);
- return DeprecatedString();
+ return overrideType;
+ return String();
}
void FrameMac::setDisplaysWithFocusAttributes(bool flag)
if (event->result().isNull())
return true;
- DeprecatedString text = event->result().deprecatedString();
+ String text = event->result();
text.replace(QChar('\\'), backslashAsCurrencySymbol());
- return [_bridge runBeforeUnloadConfirmPanelWithMessage:text.getNSString()];
+ return [_bridge runBeforeUnloadConfirmPanelWithMessage:text];
END_BLOCK_OBJC_EXCEPTIONS;
NSString *documentTypeString = nil;
Document *doc = m_frame->document();
if (doc) {
- DocumentType *doctype = doc->realDocType();
- if (doctype) {
- documentTypeString = doctype->toString().deprecatedString().getNSString();
- }
+ if (DocumentType *doctype = doc->realDocType())
+ documentTypeString = doctype->toString();
}
return documentTypeString;
}
- (NSString *)selectedString
{
- DeprecatedString text = m_frame->selectedText();
+ String text = m_frame->selectedText();
text.replace(QChar('\\'), m_frame->backslashAsCurrencySymbol());
- return [[text.getNSString() copy] autorelease];
+ return [[(NSString*)text copy] autorelease];
}
- (NSString *)stringForRange:(DOMRange *)range
{
- DeprecatedString text = plainText([range _range]);
+ String text = plainText([range _range]);
text.replace(QChar('\\'), m_frame->backslashAsCurrencySymbol());
- return [[text.getNSString() copy] autorelease];
+ return [[(NSString*)text copy] autorelease];
}
- (void)selectAll
- (NSString *)advanceToNextMisspelling
{
- return m_frame->advanceToNextMisspelling().getNSString();
+ return m_frame->advanceToNextMisspelling();
}
- (NSString *)advanceToNextMisspellingStartingJustBeforeSelection
{
- return m_frame->advanceToNextMisspelling(true).getNSString();
+ return m_frame->advanceToNextMisspelling(true);
}
- (void)unmarkAllMisspellings
- (NSString *)domain
{
Document *doc = m_frame->document();
- if (doc && doc->isHTMLDocument()) {
- return doc->domain().deprecatedString().getNSString();
- }
+ if (doc && doc->isHTMLDocument())
+ return doc->domain();
return nil;
}
}
[standardFontFamily release];
standardFontFamily = [s copy];
- settings->setStdFontName(DeprecatedString::fromNSString(s));
+ settings->setStdFontName(s);
[self _updateAllViews];
}
- (void)setFixedFontFamily:(NSString *)s
{
- if ([fixedFontFamily isEqualToString:s]) {
+ if ([fixedFontFamily isEqualToString:s])
return;
- }
[fixedFontFamily release];
fixedFontFamily = [s copy];
- settings->setFixedFontName(DeprecatedString::fromNSString(s));
+ settings->setFixedFontName(s);
[self _updateAllViews];
}
- (void)setSerifFontFamily:(NSString *)s
{
- if ([serifFontFamily isEqualToString:s]) {
+ if ([serifFontFamily isEqualToString:s])
return;
- }
[serifFontFamily release];
serifFontFamily = [s copy];
- settings->setSerifFontName(DeprecatedString::fromNSString(s));
+ settings->setSerifFontName(s);
[self _updateAllViews];
}
- (void)setSansSerifFontFamily:(NSString *)s
{
- if ([sansSerifFontFamily isEqualToString:s]) {
+ if ([sansSerifFontFamily isEqualToString:s])
return;
- }
[sansSerifFontFamily release];
sansSerifFontFamily = [s copy];
- settings->setSansSerifFontName(DeprecatedString::fromNSString(s));
+ settings->setSansSerifFontName(s);
[self _updateAllViews];
}
- (void)setCursiveFontFamily:(NSString *)s
{
- if ([cursiveFontFamily isEqualToString:s]) {
+ if ([cursiveFontFamily isEqualToString:s])
return;
- }
[cursiveFontFamily release];
cursiveFontFamily = [s copy];
- settings->setCursiveFontName(DeprecatedString::fromNSString(s));
+ settings->setCursiveFontName(s);
[self _updateAllViews];
}
- (void)setFantasyFontFamily:(NSString *)s
{
- if ([fantasyFontFamily isEqualToString:s]) {
+ if ([fantasyFontFamily isEqualToString:s])
return;
- }
[fantasyFontFamily release];
fantasyFontFamily = [s copy];
- settings->setFantasyFontName(DeprecatedString::fromNSString(s));
+ settings->setFantasyFontName(s);
[self _updateAllViews];
}
- (void)setUserStyleSheetLocation:(NSString *)s
{
- if ([userStyleSheetLocation isEqualToString:s]) {
+ if ([userStyleSheetLocation isEqualToString:s])
return;
- }
[userStyleSheetLocation release];
userStyleSheetLocation = [s copy];
settings->setUserStyleSheet(DeprecatedString::fromNSString(s));
- (void)setDefaultTextEncoding:(NSString *)s
{
- if ([defaultTextEncoding isEqualToString:s]) {
+ if ([defaultTextEncoding isEqualToString:s])
return;
- }
[defaultTextEncoding release];
defaultTextEncoding = [s copy];
settings->setEncoding(DeprecatedString::fromNSString(s));
{
// For now, just do this for strings that start with "#" to fix Korean font names that start with "#".
// Post-Tiger, we should isLegalIdentifier instead after working out all the ancillary issues.
- if (string[0] != '#') {
+ if (string[0] != '#')
return string;
- }
// FIXME: Also need to transform control characters into \ sequences.
DeprecatedString s = string.deprecatedString();
static CSSStyleSelector::Encodedurl *currentEncodedURL = 0;
static PseudoState pseudoState;
-CSSStyleSelector::CSSStyleSelector( Document* doc, DeprecatedString userStyleSheet, StyleSheetList *styleSheets,
- bool _strictParsing )
+CSSStyleSelector::CSSStyleSelector(Document* doc, DeprecatedString userStyleSheet, StyleSheetList *styleSheets, bool _strictParsing)
{
init();
settings = view ? view->frame()->settings() : 0;
if (!defaultStyle)
loadDefaultStyle();
- m_medium = view ? view->mediaType() : DeprecatedString("all");
+ m_mediaType = view ? view->mediaType() : String("all");
m_userStyle = 0;
m_userSheet = 0;
m_userSheet->parseString(String(userStyleSheet), strictParsing);
m_userStyle = new CSSRuleSet();
- m_userStyle->addRulesFromSheet( m_userSheet, m_medium );
+ m_userStyle->addRulesFromSheet(m_userSheet, m_mediaType);
}
// add stylesheets from document
DeprecatedPtrListIterator<StyleSheet> it(styleSheets->styleSheets);
for (; it.current(); ++it)
if (it.current()->isCSSStyleSheet() && !it.current()->disabled())
- m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(it.current()), m_medium);
+ m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(it.current()), m_mediaType);
m_ruleList = 0;
m_collectRulesOnly = false;
}
-CSSStyleSelector::CSSStyleSelector( CSSStyleSheet *sheet )
+CSSStyleSelector::CSSStyleSelector(CSSStyleSheet *sheet)
{
init();
- if(!defaultStyle) loadDefaultStyle();
+ if (!defaultStyle)
+ loadDefaultStyle();
FrameView *view = sheet->doc()->view();
- m_medium = view ? view->mediaType() : DeprecatedString("all");
+ m_mediaType = view ? view->mediaType() : String("all");
m_authorStyle = new CSSRuleSet();
- m_authorStyle->addRulesFromSheet( sheet, m_medium );
+ m_authorStyle->addRulesFromSheet(sheet, m_mediaType);
}
void CSSStyleSelector::init()
{
KURL u = url;
- u.setQuery( DeprecatedString::null );
- u.setRef( DeprecatedString::null );
+ u.setQuery(DeprecatedString::null);
+ u.setRef(DeprecatedString::null);
encodedurl.file = u.url();
int pos = encodedurl.file.findRev('/');
encodedurl.path = encodedurl.file;
- if ( pos > 0 ) {
- encodedurl.path.truncate( pos );
+ if (pos > 0) {
+ encodedurl.path.truncate(pos);
encodedurl.path += '/';
}
- u.setPath( DeprecatedString::null );
+ u.setPath(DeprecatedString::null);
encodedurl.host = u.url();
}
static void cleanpath(DeprecatedString &path)
{
int pos;
- while ( (pos = path.find( "/../" )) != -1 ) {
+ while ((pos = path.find("/../")) != -1) {
int prev = 0;
- if ( pos > 0 )
- prev = path.findRev( "/", pos -1 );
+ if (pos > 0)
+ prev = path.findRev("/", pos -1);
// don't remove the host, i.e. http://foo.org/../foo.html
if (prev < 0 || (prev > 3 && path.findRev("://", prev-1) == prev-2))
- path.remove( pos, 3);
+ path.remove(pos, 3);
else
// matching directory found ?
- path.remove( prev, pos- prev + 3 );
+ path.remove(prev, pos- prev + 3);
}
pos = 0;
// We don't want to waste a function call on the search for the the anchor
// in the vast majority of cases where there is no "//" in the path.
int refPos = -2;
- while ( (pos = path.find( "//", pos )) != -1) {
+ while ((pos = path.find("//", pos)) != -1) {
if (refPos == -2)
refPos = path.find("#");
if (refPos > 0 && pos >= refPos)
break;
- if ( pos == 0 || path[pos-1] != ':' )
- path.remove( pos, 1 );
+ if (pos == 0 || path[pos-1] != ':')
+ path.remove(pos, 1);
else
pos += 2;
}
- while ( (pos = path.find( "/./" )) != -1)
- path.remove( pos, 2 );
+ while ((pos = path.find("/./")) != -1)
+ path.remove(pos, 2);
}
-static void checkPseudoState( Element *e, bool checkVisited = true )
+static void checkPseudoState(Element *e, bool checkVisited = true)
{
if (!e->isLink()) {
pseudoState = PseudoNone;
QConstString cu(attr.unicode(), attr.length());
DeprecatedString u = cu.string();
- if ( !u.contains("://") ) {
- if ( u[0] == '/' )
+ if (!u.contains("://")) {
+ if (u[0] == '/')
u.prepend(currentEncodedURL->host);
- else if ( u[0] == '#' )
+ else if (u[0] == '#')
u.prepend(currentEncodedURL->file);
else
u.prepend(currentEncodedURL->path);
- cleanpath( u );
+ cleanpath(u);
}
pseudoState = historyContains(u) ? PseudoVisited : PseudoLink;
}
matchRules(defaultQuirksStyle, firstUARule, lastUARule);
// 3. If our medium is print, then we match rules from the print sheet.
- if (m_medium == "print")
+ if (m_mediaType == "print")
matchRules(defaultPrintStyle, firstUARule, lastUARule);
// 4. Now we check user sheet rules.
matchRules(defaultQuirksStyle, firstUARule, lastUARule);
// If our medium is print, then we match rules from the print sheet.
- if (m_medium == "print")
+ if (m_mediaType == "print")
matchRules(defaultPrintStyle, firstUARule, lastUARule);
// Now we check user sheet rules.
// -------------------------------------------------------------------------------------
// this is mostly boring stuff on how to apply a certain rule to the renderstyle...
-static Length convertToLength( CSSPrimitiveValue *primitiveValue, RenderStyle *style, bool *ok = 0 )
+static Length convertToLength(CSSPrimitiveValue *primitiveValue, RenderStyle *style, bool *ok = 0)
{
Length l;
- if ( !primitiveValue ) {
- if ( ok )
+ if (!primitiveValue) {
+ if (ok)
*ok = false;
} else {
int type = primitiveValue->primitiveType();
l = Length(int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE)), Percent);
else if(type == CSSPrimitiveValue::CSS_NUMBER)
l = Length(int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_NUMBER)*100), Percent);
- else if ( ok )
+ else if (ok)
*ok = false;
}
return l;
};
-static Color colorForCSSValue( int css_value )
+static Color colorForCSSValue(int css_value)
{
// try the regular ones first
const colorMap *col = cmap;
- while ( col->css_value && col->css_value != css_value )
+ while (col->css_value && col->css_value != css_value)
++col;
- if ( col->css_value )
+ if (col->css_value)
return col->color;
return Color();
}
}
-void CSSStyleSelector::applyProperty( int id, CSSValue *value )
+void CSSStyleSelector::applyProperty(int id, CSSValue *value)
{
CSSPrimitiveValue *primitiveValue = 0;
if(value->isPrimitiveValue()) primitiveValue = static_cast<CSSPrimitiveValue *>(value);
HANDLE_INHERIT_AND_INITIAL(listStylePosition, ListStylePosition)
if (!primitiveValue) return;
if (primitiveValue->getIdent())
- style->setListStylePosition( (EListStylePosition) (primitiveValue->getIdent() - CSS_VAL_OUTSIDE) );
+ style->setListStylePosition((EListStylePosition) (primitiveValue->getIdent() - CSS_VAL_OUTSIDE));
return;
}
{
EListStyleType t;
int id = primitiveValue->getIdent();
- if ( id == CSS_VAL_NONE) { // important!!
+ if (id == CSS_VAL_NONE) { // important!!
t = LNONE;
} else {
t = EListStyleType(id - CSS_VAL_DISC);
p = AbsolutePosition; break;
case CSS_VAL_FIXED:
{
- if ( view )
+ if (view)
view->useSlowRepaints();
p = FixedPosition;
break;
case CSS_PROP_TABLE_LAYOUT: {
HANDLE_INHERIT_AND_INITIAL(tableLayout, TableLayout)
- if ( !primitiveValue->getIdent() )
+ if (!primitiveValue->getIdent())
return;
ETableLayout l = RenderStyle::initialTableLayout();
- switch( primitiveValue->getIdent() ) {
+ switch(primitiveValue->getIdent()) {
case CSS_VAL_FIXED:
l = TFIXED;
// fall through
case CSS_VAL_AUTO:
- style->setTableLayout( l );
+ style->setTableLayout(l);
default:
break;
}
{
HANDLE_INHERIT_AND_INITIAL(visibility, Visibility)
- switch( primitiveValue->getIdent() ) {
+ switch(primitiveValue->getIdent()) {
case CSS_VAL_HIDDEN:
- style->setVisibility( HIDDEN );
+ style->setVisibility(HIDDEN);
break;
case CSS_VAL_VISIBLE:
- style->setVisibility( VISIBLE );
+ style->setVisibility(VISIBLE);
break;
case CSS_VAL_COLLAPSE:
- style->setVisibility( COLLAPSE );
+ style->setVisibility(COLLAPSE);
default:
break;
}
int type = primitiveValue->primitiveType();
Length l;
if(type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG)
- l = Length(primitiveValue->computeLength(style), Fixed );
+ l = Length(primitiveValue->computeLength(style), Fixed);
else if(type == CSSPrimitiveValue::CSS_PERCENTAGE)
- l = Length( int( primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE) ), Percent );
+ l = Length(int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE)), Percent);
- style->setVerticalAlign( LENGTH );
- style->setVerticalAlignLength( l );
+ style->setVerticalAlign(LENGTH);
+ style->setVerticalAlignLength(l);
}
break;
Length lineHeight;
int type = primitiveValue->primitiveType();
if (primitiveValue->getIdent() == CSS_VAL_NORMAL)
- lineHeight = Length( -100, Percent );
+ lineHeight = Length(-100, Percent);
else if (type > CSSPrimitiveValue::CSS_PERCENTAGE && type < CSSPrimitiveValue::CSS_DEG) {
double multiplier = 1.0;
// Scale for the font zoom factor only for types other than "em" and "ex", since those are
}
lineHeight = Length(primitiveValue->computeLength(style, multiplier), Fixed);
} else if (type == CSSPrimitiveValue::CSS_PERCENTAGE)
- lineHeight = Length( (style->fontSize() * int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE)) ) / 100, Fixed );
+ lineHeight = Length((style->fontSize() * int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE))) / 100, Fixed);
else if (type == CSSPrimitiveValue::CSS_NUMBER)
lineHeight = Length(int(primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_NUMBER)*100), Percent);
else
HANDLE_INHERIT_AND_INITIAL(textAlign, TextAlign)
if (!primitiveValue) return;
if (primitiveValue->getIdent())
- style->setTextAlign( (ETextAlign) (primitiveValue->getIdent() - CSS_VAL__KHTML_AUTO) );
+ style->setTextAlign((ETextAlign) (primitiveValue->getIdent() - CSS_VAL__KHTML_AUTO));
return;
}
} else if (isInitial) {
hasClip = false;
top = right = bottom = left = Length();
- } else if ( !primitiveValue ) {
+ } else if (!primitiveValue) {
break;
- } else if ( primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RECT ) {
+ } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RECT) {
RectImpl *rect = primitiveValue->getRectValue();
- if ( !rect )
+ if (!rect)
break;
top = convertToLength(rect->top(), style);
right = convertToLength(rect->right(), style);
bottom = convertToLength(rect->bottom(), style);
left = convertToLength(rect->left(), style);
- } else if ( primitiveValue->getIdent() != CSS_VAL_AUTO ) {
+ } else if (primitiveValue->getIdent() != CSS_VAL_AUTO) {
break;
}
style->setClip(top, right, bottom, left);
CSSValue *item = list->item(i);
if(!item->isPrimitiveValue()) continue;
CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue *>(item);
- DeprecatedString face;
- if( val->primitiveType() == CSSPrimitiveValue::CSS_STRING )
+ AtomicString face;
+ if(val->primitiveType() == CSSPrimitiveValue::CSS_STRING)
face = static_cast<FontFamilyValue *>(val)->fontName();
else if (val->primitiveType() == CSSPrimitiveValue::CSS_IDENT) {
switch (val->getIdent()) {
}
}
- if ( !face.isEmpty() ) {
+ if (!face.isEmpty()) {
if (!currFamily) {
// Filling in the first family.
firstFamily.setFamily(face);
style->setLineHeight(RenderStyle::initialLineHeight());
if (style->setFontDescription(fontDescription))
fontDirty = true;
- } else if ( value->isFontValue() ) {
+ } else if (value->isFontValue()) {
FontValue *font = static_cast<FontValue *>(value);
- if ( !font->style || !font->variant || !font->weight ||
- !font->size || !font->lineHeight || !font->family )
+ if (!font->style || !font->variant || !font->weight ||
+ !font->size || !font->lineHeight || !font->family)
return;
applyProperty(CSS_PROP_FONT_STYLE, font->style.get());
applyProperty(CSS_PROP_FONT_VARIANT, font->variant.get());
if (item->color) {
int ident = item->color->getIdent();
if (ident)
- col = colorForCSSValue( ident );
+ col = colorForCSSValue(ident);
else if (item->color->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR)
col.setRgb(item->color->getRGBColorValue());
}
else if (ident == CSS_VAL__KHTML_ACTIVELINK)
col = element->getDocument()->activeLinkColor();
else
- col = colorForCSSValue( ident );
- } else if ( primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR )
+ col = colorForCSSValue(ident);
+ } else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR)
col.setRgb(primitiveValue->getRGBColorValue());
return col;
}
CSSRuleList* m_ruleList;
bool m_collectRulesOnly;
- DeprecatedString m_medium;
+ String m_mediaType;
RenderStyle::PseudoId dynamicPseudo;
String CDATASection::toString() const
{
// FIXME: substitute entity references as needed!
- return String("<![CDATA[") + nodeValue() + "]]>";
+ return "<![CDATA[" + nodeValue() + "]]>";
}
} // namespace WebCore
const KHTMLSettings *settings = m_view->frame()->settings();
if (printing() && !settings->shouldPrintBackgrounds())
_style->setForceBackgroundsToWhite(true);
- DeprecatedString stdfont = settings->stdFontName();
+ const AtomicString& stdfont = settings->stdFontName();
if (!stdfont.isEmpty()) {
fontDescription.firstFamily().setFamily(stdfont);
fontDescription.firstFamily().appendFamily(0);
DeprecatedString baseURL() const { return m_baseURL.isEmpty() ? URL() : m_baseURL; }
void setBaseURL(const DeprecatedString& baseURL) { m_baseURL = baseURL; }
- DeprecatedString baseTarget() const { return m_baseTarget; }
- void setBaseTarget(const DeprecatedString& baseTarget) { m_baseTarget = baseTarget; }
+ String baseTarget() const { return m_baseTarget; }
+ void setBaseTarget(const String& baseTarget) { m_baseTarget = baseTarget; }
DeprecatedString completeURL(const DeprecatedString &);
String completeURL(const String&);
Tokenizer *m_tokenizer;
DeprecatedString m_url;
DeprecatedString m_baseURL;
- DeprecatedString m_baseTarget;
+ String m_baseTarget;
RefPtr<DocumentType> m_docType;
RefPtr<DOMImplementation> m_implementation;
String Element::openTagStartToString() const
{
- String result = String("<") + nodeName();
+ String result = "<" + nodeName();
NamedAttrMap *attrMap = attributes(true);
String attrValue = toQString(attributes[i].value, valueLength);
String attrPrefix = toQString(attributes[i].prefix);
String attrURI = attrPrefix.isEmpty() ? String() : toQString(attributes[i].uri);
- String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + String(":") + attrLocalName;
+ String attrQName = attrPrefix.isEmpty() ? attrLocalName : attrPrefix + ":" + attrLocalName;
newElement->setAttributeNS(attrURI, attrQName, attrValue, ec);
if (ec) // exception setting attributes
String localName = toQString(xmlLocalName);
String uri = toQString(xmlURI);
String prefix = toQString(xmlPrefix);
- String qName = prefix.isEmpty() ? localName : prefix + DeprecatedString::fromLatin1(":") + localName;
+ String qName = prefix.isEmpty() ? localName : prefix + ":" + localName;
if (m_parsingFragment && uri.isEmpty()) {
if (!prefix.isEmpty())
String SelectionController::type() const
{
if (isNone())
- return String("None");
+ return "None";
else if (isCaret())
- return String("Caret");
+ return "Caret";
else
- return String("Range");
+ return "Range";
}
String SelectionController::toString() const
// but no more.
class CircularSearchBuffer {
public:
- CircularSearchBuffer(const DeprecatedString &target, bool isCaseSensitive);
+ CircularSearchBuffer(const String& target, bool isCaseSensitive);
~CircularSearchBuffer() { fastFree(m_buffer); }
void clear() { m_cursor = m_buffer; m_bufferFull = false; }
void append(int length, const QChar *characters);
- void append(const QChar &);
+ void append(const QChar&);
int neededCharacters() const;
bool isMatch() const;
int length() const { return m_target.length(); }
private:
- DeprecatedString m_target;
+ String m_target;
bool m_isCaseSensitive;
QChar *m_buffer;
// handle remembered text box
if (m_textBox) {
handleTextBox();
- if (m_positionNode) {
+ if (m_positionNode)
return;
- }
}
while (m_node && m_node != m_pastEndNode) {
RenderObject *renderer = m_node->renderer();
if (renderer && renderer->isText() && m_node->nodeType() == Node::TEXT_NODE) {
// FIXME: What about CDATA_SECTION_NODE?
- if (renderer->style()->visibility() == VISIBLE) {
+ if (renderer->style()->visibility() == VISIBLE)
m_handledNode = handleTextNode();
- }
} else if (renderer && (renderer->isImage() || renderer->isWidget())) {
- if (renderer->style()->visibility() == VISIBLE) {
+ if (renderer->style()->visibility() == VISIBLE)
m_handledNode = handleReplacedElement();
- }
- } else {
+ } else
m_handledNode = handleNonTextNode();
- }
- if (m_positionNode) {
+ if (m_positionNode)
return;
- }
}
// find a new current node to handle in depth-first manner,
m_handledChildren = false;
// how would this ever be?
- if (m_positionNode) {
+ if (m_positionNode)
return;
- }
}
}
m_offset = runStart + 1;
} else {
int subrunEnd = str.find('\n', runStart);
- if (subrunEnd == -1 || subrunEnd > runEnd) {
+ if (subrunEnd == -1 || subrunEnd > runEnd)
subrunEnd = runEnd;
- }
m_offset = subrunEnd;
// If we are doing a subrun that doesn't go to the end of the text box,
// come back again to finish handling this text box; don't advance to the next one.
- if (m_positionEndOffset < textBoxEnd) {
+ if (m_positionEndOffset < textBoxEnd)
return;
- }
// Advance and return
int nextRunStart = nextTextBox ? nextTextBox->m_start : str.length();
- if (nextRunStart > runEnd) {
+ if (nextRunStart > runEnd)
m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
- }
m_textBox = nextTextBox;
if (renderer->containsReversedText())
++m_sortedTextBoxesPosition;
if (m_node->hasTagName(brTag)) {
emitCharacter('\n', m_node->parentNode(), m_node, 0, 1);
} else if (m_node->hasTagName(tdTag) || m_node->hasTagName(thTag)) {
- if (m_lastCharacter != '\n' && m_lastTextNode) {
+ if (m_lastCharacter != '\n' && m_lastTextNode)
emitCharacter('\t', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
- }
} else if (m_node->hasTagName(blockquoteTag) || m_node->hasTagName(ddTag) ||
m_node->hasTagName(divTag) ||
m_node->hasTagName(dlTag) || m_node->hasTagName(dtTag) ||
m_node->hasTagName(olTag) || m_node->hasTagName(pTag) ||
m_node->hasTagName(preTag) || m_node->hasTagName(trTag) ||
m_node->hasTagName(ulTag)) {
- if (m_lastCharacter != '\n' && m_lastTextNode) {
+ if (m_lastCharacter != '\n' && m_lastTextNode)
emitCharacter('\n', m_lastTextNode->parentNode(), m_lastTextNode, 0, 1);
- }
}
return true;
if (style) {
int bottomMargin = renderer->collapsedMarginBottom();
int fontSize = style->fontDescription().computedPixelSize();
- if (bottomMargin * 2 >= fontSize) {
+ if (bottomMargin * 2 >= fontSize)
addNewline = true;
- }
}
}
}
RenderObject *renderer = m_node->renderer();
if (renderer && renderer->isText() && m_node->nodeType() == Node::TEXT_NODE) {
// FIXME: What about CDATA_SECTION_NODE?
- if (renderer->style()->visibility() == VISIBLE && m_offset > 0) {
+ if (renderer->style()->visibility() == VISIBLE && m_offset > 0)
m_handledNode = handleTextNode();
- }
} else if (renderer && (renderer->isImage() || renderer->isWidget())) {
- if (renderer->style()->visibility() == VISIBLE && m_offset > 0) {
+ if (renderer->style()->visibility() == VISIBLE && m_offset > 0)
m_handledNode = handleReplacedElement();
- }
- } else {
+ } else
m_handledNode = handleNonTextNode();
- }
- if (m_positionNode) {
+ if (m_positionNode)
return;
- }
}
if (m_node == m_startNode)
m_offset = 0;
m_handledNode = false;
- if (m_positionNode) {
+ if (m_positionNode)
return;
- }
}
}
RenderText *renderer = static_cast<RenderText *>(m_node->renderer());
String str = m_node->nodeValue();
- if (!renderer->firstTextBox() && str.length() > 0) {
+ if (!renderer->firstTextBox() && str.length() > 0)
return true;
- }
m_positionEndOffset = m_offset;
// move to a subsequent m_textIterator run
for (m_textIterator.advance(); !atEnd(); m_textIterator.advance()) {
int runLength = m_textIterator.length();
- if (runLength == 0) {
+ if (runLength == 0)
m_atBreak = true;
- } else {
+ else {
// see whether this is m_textIterator to use
if (count < runLength) {
m_runOffset = count;
}
m_range = m_textIterator.range();
- if (m_textIterator.atEnd()) {
+ if (m_textIterator.atEnd())
return;
- }
while (1) {
// If this chunk ends in whitespace we can just use it as our chunk.
- if (m_textIterator.characters()[m_textIterator.length()-1].isSpace()) {
+ if (m_textIterator.characters()[m_textIterator.length()-1].isSpace())
return;
- }
// If this is the first chunk that failed, save it in previousText before look ahead
if (m_buffer.isEmpty()) {
}
m_buffer.append(m_textIterator.characters(), m_textIterator.length());
int exception = 0;
- m_range->setEnd(m_textIterator.range()->endContainer(exception),
- m_textIterator.range()->endOffset(exception), exception);
+ m_range->setEnd(m_textIterator.range()->endContainer(exception), m_textIterator.range()->endOffset(exception), exception);
}
}
int WordAwareIterator::length() const
{
- if (!m_buffer.isEmpty()) {
+ if (!m_buffer.isEmpty())
return m_buffer.length();
- } else if (m_previousText) {
+ else if (m_previousText)
return m_previousLength;
- } else {
+ else
return m_textIterator.length();
- }
}
const QChar *WordAwareIterator::characters() const
{
- if (!m_buffer.isEmpty()) {
+ if (!m_buffer.isEmpty())
return m_buffer.unicode();
- } else if (m_previousText) {
+ else if (m_previousText)
return m_previousText;
- } else {
+ else
return m_textIterator.characters();
- }
}
-CircularSearchBuffer::CircularSearchBuffer(const DeprecatedString &s, bool isCaseSensitive)
+CircularSearchBuffer::CircularSearchBuffer(const String& s, bool isCaseSensitive)
: m_target(s)
{
assert(!s.isEmpty());
- if (!isCaseSensitive) {
+ if (!isCaseSensitive)
m_target = s.lower();
- }
m_target.replace(nonBreakingSpace, ' ');
m_isCaseSensitive = isCaseSensitive;
void CircularSearchBuffer::append(const QChar &c)
{
- if (m_isCaseSensitive) {
+ if (m_isCaseSensitive)
*m_cursor++ = c.unicode() == nonBreakingSpace ? ' ' : c.unicode();
- } else {
+ else
*m_cursor++ = c.unicode() == nonBreakingSpace ? ' ' : c.lower().unicode();
- }
if (m_cursor == m_buffer + length()) {
m_cursor = m_buffer;
m_bufferFull = true;
m_cursor[i] = c.unicode() == nonBreakingSpace ? ' ' : c.lower().unicode();
}
}
- if (count < tailSpace) {
+ if (count < tailSpace)
m_cursor += count;
- } else {
+ else {
m_bufferFull = true;
m_cursor = m_buffer;
}
int offset = rangeLocation - docTextPosition;
resultRange->setStart(textRunRange->startContainer(exception), offset + textRunRange->startOffset(exception), exception);
} else {
- if (rangeLocation == docTextPosition) {
+ if (rangeLocation == docTextPosition)
resultRange->setStart(textRunRange->startContainer(exception), textRunRange->startOffset(exception), exception);
- } else {
+ else
resultRange->setStart(textRunRange->endContainer(exception), textRunRange->endOffset(exception), exception);
- }
}
}
int offset = rangeEnd - docTextPosition;
resultRange->setEnd(textRunRange->startContainer(exception), offset + textRunRange->startOffset(exception), exception);
} else {
- if (rangeEnd == docTextPosition) {
+ if (rangeEnd == docTextPosition)
resultRange->setEnd(textRunRange->startContainer(exception), textRunRange->startOffset(exception), exception);
- } else {
+ else
resultRange->setEnd(textRunRange->endContainer(exception), textRunRange->endOffset(exception), exception);
- }
}
if (!(rangeLength == 0 && rangeEnd == docTextPosition + len)) {
docTextPosition += len;
return result;
}
-PassRefPtr<Range> findPlainText(const Range *r, const DeprecatedString &s, bool forward, bool caseSensitive)
+PassRefPtr<Range> findPlainText(const Range *r, const String& s, bool forward, bool caseSensitive)
{
// FIXME: Can we do Boyer-Moore or equivalent instead for speed?
// Fill the buffer.
while (int needed = buffer.neededCharacters()) {
if (it.atBreak()) {
- if (it.atEnd()) {
+ if (it.atEnd())
goto done;
- }
buffer.clear();
}
int available = it.length();
rangeEnd = it;
// If searching forward, stop on the first match.
// If searching backward, don't stop, so we end up with the last match.
- if (forward) {
+ if (forward)
goto done;
- }
}
if (it.atBreak())
break;
done:
int exception = 0;
RefPtr<Range> result = r->cloneRange(exception);
- if (!found) {
+ if (!found)
result->collapse(!forward, exception);
- } else {
+ else {
CharacterIterator it(r);
it.advance(rangeEnd.characterOffset() - buffer.length());
result->setStart(it.range()->startContainer(exception), it.range()->startOffset(exception), exception);
}
}
-DeprecatedString plainText(const Range *);
-PassRefPtr<Range> findPlainText(const Range *, const DeprecatedString &, bool forward, bool caseSensitive);
+DeprecatedString plainText(const Range*);
+PassRefPtr<Range> findPlainText(const Range*, const String&, bool forward, bool caseSensitive);
// Iterates through the DOM range, returning all the text, and 0-length boundaries
// at points where replaced elements break up the text flow. The text comes back in
// if the current type is FILE, then we also need to
// include the filename
if (current->hasLocalName(inputTag) &&
- static_cast<HTMLInputElement*>(current)->inputType() == HTMLInputElement::FILE)
- {
+ static_cast<HTMLInputElement*>(current)->inputType() == HTMLInputElement::FILE) {
DeprecatedString path = static_cast<HTMLInputElement*>(current)->value().deprecatedString();
// FIXME: This won't work if the filename includes a " mark,
hstr += encoding.fromUnicode(path.mid(path.findRev('/') + 1), true);
hstr += "\"";
- if(!static_cast<HTMLInputElement*>(current)->value().isEmpty())
- {
- DeprecatedString mimeType = frame ? frame->mimeTypeForFileName(path) : DeprecatedString();
+ if (!static_cast<HTMLInputElement*>(current)->value().isEmpty()) {
+ DeprecatedString mimeType = frame ? frame->mimeTypeForFileName(path).deprecatedString() : DeprecatedString();
if (!mimeType.isEmpty()) {
hstr += "\r\nContent-Type: ";
hstr += mimeType.ascii();
JSValue *Navigator::getValueProperty(ExecState *exec, int token) const
{
- DeprecatedString userAgent = m_frame->userAgent();
+ String userAgent = m_frame->userAgent();
switch (token) {
case AppCodeName:
return jsString("Mozilla");
return jsUndefined();
case AppVersion:
// We assume the string is something like Mozilla/version (properties)
- return jsString(userAgent.mid(userAgent.find('/') + 1));
+ return jsString(userAgent.substring(userAgent.find('/') + 1));
case Product:
// When acting normal, we pretend to be "Gecko".
if (userAgent.find("Mozilla/5.0") >= 0 && userAgent.find("compatible") == -1)
m_script = new ScriptInterpreter(globalObject, m_frame);
globalObject->put(m_script->globalExec(), "debug", new TestFunctionImp(), Internal);
- DeprecatedString userAgent = m_frame->userAgent();
+ String userAgent = m_frame->userAgent();
if (userAgent.find("Microsoft") >= 0 || userAgent.find("MSIE") >= 0)
m_script->setCompatMode(Interpreter::IECompat);
else
KURL url = m_frame->url();
switch (token) {
case Hash:
- return jsString(url.ref().isNull() ? DeprecatedString("") : "#" + url.ref());
+ return jsString(url.ref().isNull() ? "" : "#" + url.ref());
case Host: {
// Note: this is the IE spec. The NS spec swaps the two, it says
// "The hostname property is the concatenation of the host and port properties, separated by a colon."
else
return jsString(url.prettyURL());
case Pathname:
- return jsString(url.path().isEmpty() ? DeprecatedString("/") : url.path());
+ return jsString(url.path().isEmpty() ? "/" : url.path());
case Port:
- return jsString(url.port() ? DeprecatedString::number((int)url.port()) : DeprecatedString::fromLatin1(""));
+ return jsString(url.port() ? DeprecatedString::number((int)url.port()) : "");
case Protocol:
- return jsString(url.protocol()+":");
+ return jsString(url.protocol() + ":");
case Search:
return jsString(url.query());
default:
static_cast<KRenderingPaintServerSolid *>(fillPaintServer)->setColor(Color::black);
} else if (fill->paintType() == SVG_PAINTTYPE_URI) {
String id(fill->uri());
- fillPaintServer = getPaintServerById(item->document(), id.deprecatedString().mid(1));
+ fillPaintServer = getPaintServerById(item->document(), AtomicString(id.substring(1)));
if (item && fillPaintServer && item->isRenderPath())
fillPaintServer->addClient(static_cast<const RenderPath*>(item));
} else {
KRenderingPaintServer *strokePaintServer;
if (stroke && stroke->paintType() == SVG_PAINTTYPE_URI) {
String id(stroke->uri());
- strokePaintServer = getPaintServerById(item->document(), id.deprecatedString().mid(1));
+ strokePaintServer = getPaintServerById(item->document(), AtomicString(id.substring(1)));
if(item && strokePaintServer && item->isRenderPath())
strokePaintServer->addClient(static_cast<const RenderPath*>(item));
} else {
// calc m_value
void SVGAngle::calculate()
{
- if(m_unitType == SVG_ANGLETYPE_GRAD)
+ if (m_unitType == SVG_ANGLETYPE_GRAD)
m_value = m_valueInSpecifiedUnits / deg2grad;
- else if(m_unitType == SVG_ANGLETYPE_RAD)
+ else if (m_unitType == SVG_ANGLETYPE_RAD)
m_value = m_valueInSpecifiedUnits / deg2rad;
- else if(m_unitType == SVG_ANGLETYPE_UNSPECIFIED || m_unitType == SVG_ANGLETYPE_DEG)
+ else if (m_unitType == SVG_ANGLETYPE_UNSPECIFIED || m_unitType == SVG_ANGLETYPE_DEG)
m_value = m_valueInSpecifiedUnits;
}
{
m_valueAsString = String(valueAsString);
- DeprecatedString s = m_valueAsString.deprecatedString();
-
bool bOK;
- m_valueInSpecifiedUnits = s.toDouble(&bOK);
+ m_valueInSpecifiedUnits = m_valueAsString.deprecatedString().toDouble(&bOK);
m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
- if(!bOK)
- {
- if(s.endsWith(DeprecatedString::fromLatin1("deg")))
+ if (!bOK) {
+ if (m_valueAsString.endsWith("deg"))
m_unitType = SVG_ANGLETYPE_DEG;
- else if(s.endsWith(DeprecatedString::fromLatin1("grad")))
+ else if (m_valueAsString.endsWith("grad"))
m_unitType = SVG_ANGLETYPE_GRAD;
- else if(s.endsWith(DeprecatedString::fromLatin1("rad")))
+ else if (m_valueAsString.endsWith("rad"))
m_unitType = SVG_ANGLETYPE_RAD;
}
StringImpl *SVGAngle::valueAsString() const
{
- m_valueAsString.deprecatedString().setNum(m_valueInSpecifiedUnits);
+ m_valueAsString = DeprecatedString::number(m_valueInSpecifiedUnits);
- switch(m_unitType)
- {
+ switch(m_unitType) {
case SVG_ANGLETYPE_UNSPECIFIED:
case SVG_ANGLETYPE_DEG:
- m_valueAsString.deprecatedString() += DeprecatedString::fromLatin1("deg");
+ m_valueAsString += "deg";
break;
case SVG_ANGLETYPE_RAD:
- m_valueAsString.deprecatedString() += DeprecatedString::fromLatin1("rad");
+ m_valueAsString += "rad";
break;
case SVG_ANGLETYPE_GRAD:
- m_valueAsString.deprecatedString() += DeprecatedString::fromLatin1("grad");
+ m_valueAsString += "grad";
break;
}
void SVGAngle::convertToSpecifiedUnits(unsigned short unitType)
{
- if(m_unitType == unitType)
+ if (m_unitType == unitType)
return;
- if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_RAD)
+ if (m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_RAD)
m_valueInSpecifiedUnits *= deg2rad;
- else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_RAD)
+ else if (m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_RAD)
m_valueInSpecifiedUnits /= rad2grad;
- else if(m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_GRAD)
+ else if (m_unitType == SVG_ANGLETYPE_DEG && unitType == SVG_ANGLETYPE_GRAD)
m_valueInSpecifiedUnits *= deg2grad;
- else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_GRAD)
+ else if (m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_GRAD)
m_valueInSpecifiedUnits *= rad2grad;
- else if(m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_DEG)
+ else if (m_unitType == SVG_ANGLETYPE_RAD && unitType == SVG_ANGLETYPE_DEG)
m_valueInSpecifiedUnits /= deg2rad;
- else if(m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_DEG)
+ else if (m_unitType == SVG_ANGLETYPE_GRAD && unitType == SVG_ANGLETYPE_DEG)
m_valueInSpecifiedUnits /= deg2grad;
m_unitType = unitType;
{
double bisector = (angle1 + angle2) / 2;
- if(fabs(angle1 - angle2) > 180)
+ if (fabs(angle1 - angle2) > 180)
bisector += 180;
return bisector;
unsigned short m_unitType;
float m_value;
float m_valueInSpecifiedUnits;
- String m_valueAsString;
+ mutable String m_valueAsString;
const SVGStyledElement *m_context;
void calculate();
SVGElement *SVGAnimationElement::targetElement() const
{
- if(!m_targetElement)
+ if (!m_targetElement)
{
- if(!m_href.isEmpty())
+ if (!m_href.isEmpty())
{
String targetId = SVGURIReference::getTarget(m_href);
Element *element = ownerDocument()->getElementById(targetId.impl());
m_targetElement = svg_dynamic_cast(element);
}
- else if(parentNode())
+ else if (parentNode())
{
Node *target = parentNode();
while(target != 0)
{
- if(target->nodeType() != ELEMENT_NODE)
+ if (target->nodeType() != ELEMENT_NODE)
target = target->parentNode();
else
break;
m_attributeName = value.deprecatedString();
else if (attr->name() == SVGNames::attributeTypeAttr)
{
- if(value == "CSS")
+ if (value == "CSS")
m_attributeType = ATTRIBUTETYPE_CSS;
- else if(value == "XML")
+ else if (value == "XML")
m_attributeType = ATTRIBUTETYPE_XML;
- else if(value == "auto")
+ else if (value == "auto")
m_attributeType = ATTRIBUTETYPE_AUTO;
}
else if (attr->name() == SVGNames::beginAttr || attr->name() == SVGNames::endAttr)
SVGHelper::ParseSeperatedList(temp.get(), value.deprecatedString(), ';');
// Parse data
- for(unsigned int i = 0; i < temp->numberOfItems(); i++)
- {
+ for (unsigned int i = 0; i < temp->numberOfItems(); i++) {
DeprecatedString current = String(temp->getItem(i)).deprecatedString();
- if(current.startsWith(DeprecatedString::fromLatin1("accessKey")))
- {
+ if (current.startsWith("accessKey")) {
// Register keyDownEventListener for the character
DeprecatedString character = current.mid(current.length() - 2, 1);
//kdDebug() << k_funcinfo << " Supposed to register accessKey Character: " << character << " UNSUPPORTED!" << endl;
- }
- else if(current.startsWith(DeprecatedString::fromLatin1("wallclock")))
- {
+ } else if (current.startsWith("wallclock")) {
int firstBrace = current.find('(');
int secondBrace = current.find(')');
DeprecatedString wallclockValue = current.mid(firstBrace + 1, secondBrace - firstBrace - 2);
//kdDebug() << k_funcinfo << " Supposed to use wallClock value: " << wallclockValue << " UNSUPPORTED!" << endl;
}
- else if(current.contains('.'))
+ else if (current.contains('.'))
{
int dotPosition = current.find('.');
DeprecatedString element = current.mid(0, dotPosition);
DeprecatedString clockValue;
- if(current.contains(DeprecatedString::fromLatin1("begin")))
+ if (current.contains("begin"))
clockValue = current.mid(dotPosition + 6);
- else if(current.contains(DeprecatedString::fromLatin1("end")))
+ else if (current.contains("end"))
clockValue = current.mid(dotPosition + 4);
- else if(current.contains(DeprecatedString::fromLatin1("repeat")))
+ else if (current.contains("repeat"))
clockValue = current.mid(dotPosition + 7);
else // DOM2 Event Reference
{
int plusMinusPosition = -1;
- if(current.contains('+'))
+ if (current.contains('+'))
plusMinusPosition = current.find('+');
- else if(current.contains('-'))
+ else if (current.contains('-'))
plusMinusPosition = current.find('-');
DeprecatedString event = current.mid(dotPosition + 1, plusMinusPosition - dotPosition - 1);
}
else
{
- if(attr->name() == SVGNames::beginAttr)
+ if (attr->name() == SVGNames::beginAttr)
{
m_begin = parseClockValue(current);
- if(!isIndefinite(m_begin))
+ if (!isIndefinite(m_begin))
m_begin *= 1000.0;
//kdDebug() << k_funcinfo << " Setting begin time to " << m_begin << " ms!" << endl;
else
{
m_end = parseClockValue(current);
- if(!isIndefinite(m_end))
+ if (!isIndefinite(m_end))
m_end *= 1000.0;
//kdDebug() << k_funcinfo << " Setting end time to " << m_end << " ms!" << endl;
else if (attr->name() == SVGNames::durAttr)
{
m_simpleDuration = parseClockValue(value.deprecatedString());
- if(!isIndefinite(m_simpleDuration))
+ if (!isIndefinite(m_simpleDuration))
m_simpleDuration *= 1000.0;
}
else if (attr->name() == SVGNames::minAttr)
{
m_min = parseClockValue(value.deprecatedString());
- if(!isIndefinite(m_min))
+ if (!isIndefinite(m_min))
m_min *= 1000.0;
}
else if (attr->name() == SVGNames::maxAttr)
{
m_max = parseClockValue(value.deprecatedString());
- if(!isIndefinite(m_max))
+ if (!isIndefinite(m_max))
m_max *= 1000.0;
}
else if (attr->name() == SVGNames::restartAttr)
{
- if(value == "whenNotActive")
+ if (value == "whenNotActive")
m_restart = RESTART_WHENNOTACTIVE;
- else if(value == "never")
+ else if (value == "never")
m_restart = RESTART_NEVER;
- else if(value == "always")
+ else if (value == "always")
m_restart = RESTART_ALWAYS;
}
else if (attr->name() == SVGNames::repeatCountAttr)
{
- if(value == "indefinite")
+ if (value == "indefinite")
m_repeatCount = DBL_MAX;
else
m_repeatCount = value.deprecatedString().toDouble();
m_repeatDur = value.deprecatedString();
else if (attr->name() == SVGNames::fillAttr)
{
- if(value == "freeze")
+ if (value == "freeze")
m_fill = FILL_FREEZE;
- else if(value == "remove")
+ else if (value == "remove")
m_fill = FILL_REMOVE;
}
else if (attr->name() == SVGNames::calcModeAttr)
{
- if(value == "discrete")
+ if (value == "discrete")
m_calcMode = CALCMODE_DISCRETE;
- else if(value == "linear")
+ else if (value == "linear")
m_calcMode = CALCMODE_LINEAR;
- else if(value == "spline")
+ else if (value == "spline")
m_calcMode = CALCMODE_SPLINE;
- else if(value == "paced")
+ else if (value == "paced")
m_calcMode = CALCMODE_PACED;
}
else if (attr->name() == SVGNames::valuesAttr)
m_by = value.deprecatedString();
else if (attr->name() == SVGNames::additiveAttr)
{
- if(value == "sum")
+ if (value == "sum")
m_additive = ADDITIVE_SUM;
- else if(value == "replace")
+ else if (value == "replace")
m_additive = ADDITIVE_REPLACE;
}
else if (attr->name() == SVGNames::accumulateAttr)
{
- if(value == "sum")
+ if (value == "sum")
m_accumulate = ACCUMULATE_SUM;
- else if(value == "none")
+ else if (value == "none")
m_accumulate = ACCUMULATE_NONE;
}
else
{
- if(SVGTests::parseMappedAttribute(attr)) return;
- if(SVGExternalResourcesRequired::parseMappedAttribute(attr)) return;
+ if (SVGTests::parseMappedAttribute(attr)) return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) return;
SVGElement::parseMappedAttribute(attr);
}
{
DeprecatedString parse = data.stripWhiteSpace();
- if(parse == DeprecatedString::fromLatin1("indefinite")) // Saves some time...
+ if (parse == "indefinite") // Saves some time...
return DBL_MAX;
double result;
int doublePointOne = parse.find(':');
int doublePointTwo = parse.find(':', doublePointOne + 1);
- if(doublePointOne != -1 && doublePointTwo != -1) // Spec: "Full clock values"
+ if (doublePointOne != -1 && doublePointTwo != -1) // Spec: "Full clock values"
{
unsigned int hours = parse.mid(0, 2).toUInt();
unsigned int minutes = parse.mid(3, 2).toUInt();
result = (3600 * hours) + (60 * minutes) + seconds;
- if(parse.find('.') != -1)
+ if (parse.find('.') != -1)
{
DeprecatedString temp = parse.mid(9, 2);
milliseconds = temp.toUInt();
result += (milliseconds * (1 / pow(10.0, int(temp.length()))));
}
}
- else if(doublePointOne != -1 && doublePointTwo == -1) // Spec: "Partial clock values"
+ else if (doublePointOne != -1 && doublePointTwo == -1) // Spec: "Partial clock values"
{
unsigned int minutes = parse.mid(0, 2).toUInt();
unsigned int seconds = parse.mid(3, 2).toUInt();
result = (60 * minutes) + seconds;
- if(parse.find('.') != -1)
+ if (parse.find('.') != -1)
{
DeprecatedString temp = parse.mid(6, 2);
milliseconds = temp.toUInt();
{
int dotPosition = parse.find('.');
- if(parse.endsWith(DeprecatedString::fromLatin1("h")))
+ if (parse.endsWith("h"))
{
- if(dotPosition == -1)
+ if (dotPosition == -1)
result = parse.mid(0, parse.length() - 1).toUInt() * 3600;
else
{
result += (3600.0 * temp.toUInt()) * (1 / pow(10.0, int(temp.length())));
}
}
- else if(parse.endsWith(DeprecatedString::fromLatin1("min")))
+ else if (parse.endsWith("min"))
{
- if(dotPosition == -1)
+ if (dotPosition == -1)
result = parse.mid(0, parse.length() - 3).toUInt() * 60;
else
{
result += (60.0 * temp.toUInt()) * (1 / pow(10.0, int(temp.length())));
}
}
- else if(parse.endsWith(DeprecatedString::fromLatin1("ms")))
+ else if (parse.endsWith("ms"))
{
- if(dotPosition == -1)
+ if (dotPosition == -1)
result = parse.mid(0, parse.length() - 2).toUInt() / 1000.0;
else
{
result += (temp.toUInt() / 1000.0) * (1 / pow(10.0, int(temp.length())));
}
}
- else if(parse.endsWith(DeprecatedString::fromLatin1("s")))
+ else if (parse.endsWith("s"))
{
- if(dotPosition == -1)
+ if (dotPosition == -1)
result = parse.mid(0, parse.length() - 1).toUInt();
else
{
String SVGAnimationElement::targetAttribute() const
{
- if(!targetElement())
+ if (!targetElement())
return String();
SVGElement *target = targetElement();
ret = styled->style()->getPropertyValue(m_attributeName);
}
- if(attributeType == ATTRIBUTETYPE_XML || ret.isEmpty())
+ if (attributeType == ATTRIBUTETYPE_XML || ret.isEmpty())
ret = targetElement()->getAttribute(String(m_attributeName).impl());
return ret;
void SVGAnimationElement::setTargetAttribute(SVGElement *target, StringImpl *nameImpl, StringImpl *value, EAttributeType type)
{
- if(!target || !nameImpl || !value)
+ if (!target || !nameImpl || !value)
return;
String name(nameImpl);
styled = static_cast<SVGStyledElement *>(target);
EAttributeType attributeType = type;
- if(type == ATTRIBUTETYPE_AUTO)
+ if (type == ATTRIBUTETYPE_AUTO)
{
attributeType = ATTRIBUTETYPE_XML;
EAnimationMode SVGAnimationElement::detectAnimationMode() const
{
- if((!m_from.isEmpty() && !m_to.isEmpty()) || (!m_to.isEmpty())) // to/from-to animation
+ if ((!m_from.isEmpty() && !m_to.isEmpty()) || (!m_to.isEmpty())) // to/from-to animation
{
- if(!m_from.isEmpty()) // from-to animation
+ if (!m_from.isEmpty()) // from-to animation
return FROM_TO_ANIMATION;
else
return TO_ANIMATION;
}
- else if((m_from.isEmpty() && m_to.isEmpty() && !m_by.isEmpty()) ||
+ else if ((m_from.isEmpty() && m_to.isEmpty() && !m_by.isEmpty()) ||
(!m_from.isEmpty() && !m_by.isEmpty())) // by/from-by animation
{
- if(!m_from.isEmpty()) // from-by animation
+ if (!m_from.isEmpty()) // from-by animation
return FROM_BY_ANIMATION;
else
return BY_ANIMATION;
}
- else if(m_values)
+ else if (m_values)
return VALUES_ANIMATION;
return NO_ANIMATION;
int SVGAnimationElement::calculateCurrentValueItem(double timePercentage)
{
- if(!m_values)
+ if (!m_values)
return -1;
unsigned long items = m_values->numberOfItems();
// Calculate the relative time percentages for each 'fade'.
double startTimes[items]; startTimes[0] = 0.0;
- for(unsigned int i = 1; i < items; ++i)
+ for (unsigned int i = 1; i < items; ++i)
startTimes[i] = (((2.0 * i)) / (items - 1)) / 2.0;
int itemByPercentage = -1;
- for(unsigned int i = 0; i < items - 1; ++i)
+ for (unsigned int i = 0; i < items - 1; ++i)
{
- if(timePercentage >= startTimes[i] && timePercentage <= startTimes[i + 1])
+ if (timePercentage >= startTimes[i] && timePercentage <= startTimes[i + 1])
{
itemByPercentage = i;
break;
double SVGAnimationElement::calculateRelativeTimePercentage(double timePercentage, int currentItem)
{
- if(currentItem == -1 || !m_values)
+ if (currentItem == -1 || !m_values)
return 0.0;
unsigned long items = m_values->numberOfItems();
// Calculate the relative time percentages for each 'fade'.
double startTimes[items]; startTimes[0] = 0.0;
- for(unsigned int i = 1; i < items; ++i)
+ for (unsigned int i = 1; i < items; ++i)
startTimes[i] = (((2.0 * i)) / (items - 1)) / 2.0;
double beginTimePercentage = startTimes[currentItem];
double endTimePercentage = startTimes[currentItem + 1];
- if((endTimePercentage - beginTimePercentage) == 0.0)
+ if ((endTimePercentage - beginTimePercentage) == 0.0)
return 0.0;
return ((timePercentage - beginTimePercentage) /
return;
DeprecatedString parse = m_rgbColor.deprecatedString().stripWhiteSpace();
- if(parse.startsWith(DeprecatedString::fromLatin1("rgb(")))
+ if(parse.startsWith("rgb("))
{
DeprecatedStringList colors = DeprecatedStringList::split(',', parse);
DeprecatedString r = colors[0].right((colors[0].length() - 4));
DeprecatedString g = colors[1];
DeprecatedString b = colors[2].left((colors[2].length() - 1));
- if(r.contains(DeprecatedString::fromLatin1("%")))
- {
+ if(r.contains("%")) {
r = r.left(r.length() - 1);
r = DeprecatedString::number(int((double(255 * r.toDouble()) / 100.0)));
}
- if(g.contains(DeprecatedString::fromLatin1("%")))
+ if(g.contains("%"))
{
g = g.left(g.length() - 1);
g = DeprecatedString::number(int((double(255 * g.toDouble()) / 100.0)));
}
- if(b.contains(DeprecatedString::fromLatin1("%")))
+ if(b.contains("%"))
{
b = b.left(b.length() - 1);
b = DeprecatedString::number(int((double(255 * b.toDouble()) / 100.0)));
#include <kdom/Helper.h>
#include <kdom/Namespace.h>
#include <kdom/core/DOMException.h>
-#include <kdom/core/Element.h>
#include <kdom/kdom.h>
+#include <kxmlcore/HashSet.h>
#include "Document.h"
#include "DocumentType.h"
using namespace WebCore;
SVGDOMImplementation *SVGDOMImplementation::s_instance = 0;
-DeprecatedStringList SVGDOMImplementation::s_features;
+
+static const HashSet<String>& svgFeatureSet()
+{
+ static HashSet<String>* svgFeatures = 0;
+ if (!svgFeatures) {
+ svgFeatures = new HashSet<String>;
+
+ // 1.1 features
+ svgFeatures->add("SVG");
+ svgFeatures->add("SVGDOM");
+ svgFeatures->add("SVG-STATIC");
+ svgFeatures->add("SVGDOM-STATIC");
+ svgFeatures->add("SVG-ANIMATION");
+ svgFeatures->add("SVGDOM-ANIMATION");
+ svgFeatures->add("SVG-DYNAMIC");
+ svgFeatures->add("COREATTRIBUTE");
+ svgFeatures->add("STRUCTURE");
+ svgFeatures->add("CONTAINERATTRIBUTE");
+ svgFeatures->add("CONDITIOANLPROCESSING");
+ svgFeatures->add("IMAGE");
+ svgFeatures->add("STYLE");
+ svgFeatures->add("VIEWPORTATTRIBUTE");
+ svgFeatures->add("SHAPE");
+ svgFeatures->add("TEXT");
+ svgFeatures->add("PAINTATTRIBUTE");
+ svgFeatures->add("OPACITYATTRIBUTE");
+ svgFeatures->add("GRAPHICSATTRIBUTE");
+ svgFeatures->add("MARKER");
+ svgFeatures->add("COLORPROFILE");
+ svgFeatures->add("GRADIENT");
+ svgFeatures->add("PATTERN");
+ svgFeatures->add("CLIP");
+ svgFeatures->add("MASK");
+ svgFeatures->add("FILTER");
+ svgFeatures->add("XLINKATTRIBUTE");
+ svgFeatures->add("FONT");
+ svgFeatures->add("EXTENSIBILITY");
+
+ // 1.0 features
+ //svgFeatures->add("SVG");
+ svgFeatures->add("SVG.STATIC");
+ svgFeatures->add("SVG.ANIMATION");
+ svgFeatures->add("SVG.DYNAMIC");
+ svgFeatures->add("DOM");
+ svgFeatures->add("DOM.SVG");
+ svgFeatures->add("DOM.SVG.STATIC");
+ svgFeatures->add("DOM.SVG.ANIMATION");
+ svgFeatures->add("DOM.SVG.DYNAMIC");
+ svgFeatures->add("SVG.ALL");
+ svgFeatures->add("DOM.SVG.ALL");
+ }
+ return *svgFeatures;
+}
SVGDOMImplementation::SVGDOMImplementation() : DOMImplementation()
{
SVGDOMImplementation *SVGDOMImplementation::self()
{
- if(!s_instance)
- {
+ if (!s_instance)
s_instance = new SVGDOMImplementation();
-
- // 1.1 features
- s_features.append(DeprecatedString::fromLatin1("SVG"));
- s_features.append(DeprecatedString::fromLatin1("SVGDOM"));
- s_features.append(DeprecatedString::fromLatin1("SVG-STATIC"));
- s_features.append(DeprecatedString::fromLatin1("SVGDOM-STATIC"));
- s_features.append(DeprecatedString::fromLatin1("SVG-ANIMATION"));
- s_features.append(DeprecatedString::fromLatin1("SVGDOM-ANIMATION"));
- s_features.append(DeprecatedString::fromLatin1("SVG-DYNAMIC"));
- s_features.append(DeprecatedString::fromLatin1("COREATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("STRUCTURE"));
- s_features.append(DeprecatedString::fromLatin1("CONTAINERATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("CONDITIOANLPROCESSING"));
- s_features.append(DeprecatedString::fromLatin1("IMAGE"));
- s_features.append(DeprecatedString::fromLatin1("STYLE"));
- s_features.append(DeprecatedString::fromLatin1("VIEWPORTATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("SHAPE"));
- s_features.append(DeprecatedString::fromLatin1("TEXT"));
- s_features.append(DeprecatedString::fromLatin1("PAINTATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("OPACITYATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("GRAPHICSATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("MARKER"));
- s_features.append(DeprecatedString::fromLatin1("COLORPROFILE"));
- s_features.append(DeprecatedString::fromLatin1("GRADIENT"));
- s_features.append(DeprecatedString::fromLatin1("PATTERN"));
- s_features.append(DeprecatedString::fromLatin1("CLIP"));
- s_features.append(DeprecatedString::fromLatin1("MASK"));
- s_features.append(DeprecatedString::fromLatin1("FILTER"));
- s_features.append(DeprecatedString::fromLatin1("XLINKATTRIBUTE"));
- s_features.append(DeprecatedString::fromLatin1("FONT"));
- s_features.append(DeprecatedString::fromLatin1("EXTENSIBILITY"));
-
- // 1.0 features
- //s_features.append(DeprecatedString::fromLatin1("SVG"));
- s_features.append(DeprecatedString::fromLatin1("SVG.STATIC"));
- s_features.append(DeprecatedString::fromLatin1("SVG.ANIMATION"));
- s_features.append(DeprecatedString::fromLatin1("SVG.DYNAMIC"));
- s_features.append(DeprecatedString::fromLatin1("DOM"));
- s_features.append(DeprecatedString::fromLatin1("DOM.SVG"));
- s_features.append(DeprecatedString::fromLatin1("DOM.SVG.STATIC"));
- s_features.append(DeprecatedString::fromLatin1("DOM.SVG.ANIMATION"));
- s_features.append(DeprecatedString::fromLatin1("DOM.SVG.DYNAMIC"));
- s_features.append(DeprecatedString::fromLatin1("SVG.ALL"));
- s_features.append(DeprecatedString::fromLatin1("DOM.SVG.ALL"));
- }
return s_instance;
}
bool SVGDOMImplementation::hasFeature(StringImpl *featureImpl, StringImpl *versionImpl) const
{
- DeprecatedString feature = (featureImpl ? String(featureImpl).upper().deprecatedString() : DeprecatedString::null);
+ String feature = (featureImpl ? featureImpl->upper(): String());
String version(versionImpl);
- if((version.isEmpty() || version == "1.1") &&
- feature.startsWith(DeprecatedString::fromLatin1("HTTP://WWW.W3.ORG/TR/SVG11/FEATURE#")))
- {
- if(s_features.contains(feature.right(feature.length() - 35)))
+ if ((version.isEmpty() || version == "1.1") && feature.startsWith("HTTP://WWW.W3.ORG/TR/SVG11/FEATURE#")) {
+ if (svgFeatureSet().contains(feature.right(feature.length() - 35)))
return true;
}
- if((version.isEmpty() || version == "1.0") &&
- feature.startsWith(DeprecatedString::fromLatin1("ORG.W3C.")))
- {
- if(s_features.contains(feature.right(feature.length() - 8)))
+ if ((version.isEmpty() || version == "1.0") && feature.startsWith("ORG.W3C.")) {
+ if (svgFeatureSet().contains(feature.right(feature.length() - 8)))
return true;
}
String qualifiedName(qualifiedNameImpl);
#if 0
// INVALID_CHARACTER_ERR: Raised if the specified qualified name contains an illegal character.
- if(!qualifiedName.isEmpty() && !Helper::ValidateAttributeName(qualifiedNameImpl)) {
+ if (!qualifiedName.isEmpty() && !Helper::ValidateAttributeName(qualifiedNameImpl)) {
ec = INVALID_CHARACTER_ERR;
return 0;
}
// NAMESPACE_ERR: Raised if no qualifiedName supplied (not mentioned in the spec!)
- if(qualifiedName.isEmpty()) {
+ if (qualifiedName.isEmpty()) {
ec = NAMESPACE_ERR;
return 0;
}
{
String namespaceURI(namespaceURIImpl);
String qualifiedName(qualifiedNameImpl);
- if((namespaceURI != SVGNames::svgNamespaceURI) || (qualifiedName != "svg" && qualifiedName != "svg:svg"))
+ if ((namespaceURI != SVGNames::svgNamespaceURI) || (qualifiedName != "svg" && qualifiedName != "svg:svg"))
return DOMImplementation::instance()->createDocument(namespaceURIImpl, qualifiedNameImpl, doctype, ec);
#if 0
// WRONG_DOCUMENT_ERR: Raised if docType has already been used with a different
// document or was created from a different implementation.
- if(doctype != 0 && doctype->ownerDocument() != 0) {
+ if (doctype != 0 && doctype->ownerDocument() != 0) {
ec = WRONG_DOCUMENT_ERR;
return 0;
}
bool m_animationContext : 1;
static SVGDOMImplementation *s_instance;
- static DeprecatedStringList s_features;
};
}
else if(m_paintType == SVG_PAINTTYPE_CURRENTCOLOR)
return "currentColor";
else if(m_paintType == SVG_PAINTTYPE_URI)
- return String(DeprecatedString::fromLatin1("url(") + m_uri.deprecatedString() + DeprecatedString::fromLatin1(")"));
+ return "url(" + m_uri + ")";
return SVGColor::cssText();
}
virtual unsigned short pathSegType() const { return PATHSEG_CLOSEPATH; }
virtual StringImpl *pathSegTypeAsLetter() const { return new StringImpl("Z"); }
- virtual DeprecatedString toString() const { return DeprecatedString::fromLatin1("Z"); }
+ virtual DeprecatedString toString() const { return "Z"; }
};
};
DeprecatedString str = s.deprecatedString();
DeprecatedStringList params = DeprecatedStringList::split(' ', str.simplifyWhiteSpace());
- if(params[0].compare(DeprecatedString::fromLatin1("none")) == 0)
+ if (params[0] == "none")
m_align = SVG_PRESERVEASPECTRATIO_NONE;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMinYMin")) == 0)
+ else if (params[0] == "xMinYMin")
m_align = SVG_PRESERVEASPECTRATIO_XMINYMIN;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMidYMin")) == 0)
+ else if (params[0] == "xMidYMin")
m_align = SVG_PRESERVEASPECTRATIO_XMIDYMIN;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMaxYMin")) == 0)
+ else if (params[0] == "xMaxYMin")
m_align = SVG_PRESERVEASPECTRATIO_XMAXYMIN;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMinYMid")) == 0)
+ else if (params[0] == "xMinYMid")
m_align = SVG_PRESERVEASPECTRATIO_XMINYMID;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMidYMid")) == 0)
+ else if (params[0] == "xMidYMid")
m_align = SVG_PRESERVEASPECTRATIO_XMIDYMID;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMaxYMid")) == 0)
+ else if (params[0] == "xMaxYMid")
m_align = SVG_PRESERVEASPECTRATIO_XMAXYMID;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMinYMax")) == 0)
+ else if (params[0] == "xMinYMax")
m_align = SVG_PRESERVEASPECTRATIO_XMINYMAX;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMidYMax")) == 0)
+ else if (params[0] == "xMidYMax")
m_align = SVG_PRESERVEASPECTRATIO_XMIDYMAX;
- else if(params[0].compare(DeprecatedString::fromLatin1("xMaxYMax")) == 0)
+ else if (params[0] == "xMaxYMax")
m_align = SVG_PRESERVEASPECTRATIO_XMAXYMAX;
- if(m_align != SVG_PRESERVEASPECTRATIO_NONE)
- {
- if((params.count() > 1) && params[1].compare(DeprecatedString::fromLatin1("slice")) == 0)
+ if (m_align != SVG_PRESERVEASPECTRATIO_NONE) {
+ if ((params.count() > 1) && (params[1] == "slice"))
m_meetOrSlice = SVG_MEETORSLICE_SLICE;
else
m_meetOrSlice = SVG_MEETORSLICE_MEET;
}
- if(m_context)
+ if (m_context)
m_context->notifyAttributeChange();
}
{
SVGMatrix *temp = SVGSVGElement::createSVGMatrix();
- if(align() == SVG_PRESERVEASPECTRATIO_UNKNOWN)
+ if (align() == SVG_PRESERVEASPECTRATIO_UNKNOWN)
return temp;
float vpar = logicWidth / logicHeight;
float svgar = physWidth / physHeight;
- if(align() == SVG_PRESERVEASPECTRATIO_NONE)
+ if (align() == SVG_PRESERVEASPECTRATIO_NONE)
{
temp->scaleNonUniform(physWidth / logicWidth, physHeight / logicHeight);
temp->translate(-logicX, -logicY);
}
- else if(vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar >= svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE))
+ else if (vpar < svgar && (meetOrSlice() == SVG_MEETORSLICE_MEET) || vpar >= svgar && (meetOrSlice() == SVG_MEETORSLICE_SLICE))
{
temp->scale(physHeight / logicHeight);
- if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX)
+ if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMINYMAX)
temp->translate(-logicX, -logicY);
- else if(align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX)
+ else if (align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMAX)
temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight) / 2, -logicY);
else
temp->translate(-logicX - (logicWidth - physWidth * logicHeight / physHeight), -logicY);
{
temp->scale(physWidth / logicWidth);
- if(align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN)
+ if (align() == SVG_PRESERVEASPECTRATIO_XMINYMIN || align() == SVG_PRESERVEASPECTRATIO_XMIDYMIN || align() == SVG_PRESERVEASPECTRATIO_XMAXYMIN)
temp->translate(-logicX, -logicY);
- else if(align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID)
+ else if (align() == SVG_PRESERVEASPECTRATIO_XMINYMID || align() == SVG_PRESERVEASPECTRATIO_XMIDYMID || align() == SVG_PRESERVEASPECTRATIO_XMAXYMID)
temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth) / 2);
else
temp->translate(-logicX, -logicY - (logicHeight - physHeight * logicWidth / physWidth));
{
String value(attr->value());
if (attr->name() == SVGNames::offsetAttr) {
- if(value.deprecatedString().endsWith(DeprecatedString::fromLatin1("%")))
+ if(value.deprecatedString().endsWith("%"))
offset()->setBaseVal(value.deprecatedString().left(value.length() - 1).toDouble() / 100.);
else
offset()->setBaseVal(value.deprecatedString().toDouble());
m_sheet = 0;
m_loading = false;
- const AtomicString &mediaDomString = media();
- DeprecatedString _media = mediaDomString.deprecatedString();
- if((type().isEmpty() || type() == "text/css") && (_media.isNull() ||
- _media.contains(DeprecatedString::fromLatin1("screen")) ||
- _media.contains(DeprecatedString::fromLatin1("all")) |
- _media.contains(DeprecatedString::fromLatin1("print"))))
- {
+ const AtomicString& _media = media();
+ if ((type().isEmpty() || type() == "text/css") && (_media.isNull() || _media.contains("screen") || _media.contains("all") || _media.contains("print"))) {
ownerDocument()->addPendingSheet();
m_loading = true;
m_sheet = new CSSStyleSheet(this);
m_sheet->parseString(textContent(), false);//!getDocument()->inCompatMode());
- MediaList *mediaList = new MediaList(m_sheet.get(), mediaDomString);
+ MediaList *mediaList = new MediaList(m_sheet.get(), _media);
m_sheet->setMedia(mediaList);
m_loading = false;
}
DeprecatedString SVGURIReference::getTarget(const DeprecatedString &url)
{
- if(url.startsWith(DeprecatedString::fromLatin1("url("))) // URI References, ie. fill:url(#target)
+ if(url.startsWith("url(")) // URI References, ie. fill:url(#target)
{
unsigned int start = url.find('#') + 1;
unsigned int end = url.findRev(')');
bool ClipboardMac::setData(const String &type, const String &data)
{
- if (m_policy != Writable) {
+ if (m_policy != Writable)
return false;
- }
// note NSPasteboard enforces changeCount itself on writing - can't write if not the owner
NSString *cocoaType = cocoaTypeFromMIMEType(type);
- NSString *cocoaData = data.deprecatedString().getNSString();
+ NSString *cocoaData = data;
if ([cocoaType isEqualToString:NSURLPboardType]) {
[m_pasteboard addTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil];
DeprecatedStringList ClipboardMac::types() const
{
- if (m_policy != Readable && m_policy != TypesReadable) {
+ if (m_policy != Readable && m_policy != TypesReadable)
return DeprecatedStringList();
- }
NSArray *types = [m_pasteboard types];
// Enforce changeCount ourselves for security. We check after reading instead of before to be
// sure it doesn't change between our testing the change count and accessing the data.
- if (m_changeCount != [m_pasteboard changeCount]) {
+ if (m_changeCount != [m_pasteboard changeCount])
return DeprecatedStringList();
- }
DeprecatedStringList result;
if (types) {
unsigned i;
for (i = 0; i < count; i++) {
NSString *pbType = [types objectAtIndex:i];
- if ([pbType isEqualToString:@"NeXT plain ascii pasteboard type"]) {
+ if ([pbType isEqualToString:@"NeXT plain ascii pasteboard type"])
continue; // skip this ancient type that gets auto-supplied by some system conversion
- }
DeprecatedString qstr = MIMETypeFromCocoaType(pbType);
- if (!result.contains(qstr)) {
+ if (!result.contains(qstr))
result.append(qstr);
- }
}
}
return result;
void ClipboardMac::setEffectAllowed(const WebCore::String &s)
{
- if (m_policy == Writable) {
+ if (m_policy == Writable)
m_effectAllowed = s;
- }
}
// These "conversion" methods are called by the bridge and part, and never make sense to JS, so we don't
return NSDragOperationLink | NSDragOperationGeneric | NSDragOperationMove;
} else if (op == "all") {
return NSDragOperationEvery;
- } else {
+ } else
return NSDragOperationPrivate; // really a marker for "no conversion"
- }
}
static const String IEOpFromCocoaOp(NSDragOperation op) {
return "copy";
} else if (op & NSDragOperationLink) {
return "link";
- } else {
+ } else
return "none";
- }
}
bool ClipboardMac::sourceOperation(NSDragOperation *op) const
{
- if (m_effectAllowed.isNull()) {
+ if (m_effectAllowed.isNull())
return false;
- } else {
+ else {
*op = cocoaOpFromIEOp(m_effectAllowed);
return true;
}
bool ClipboardMac::destinationOperation(NSDragOperation *op) const
{
- if (m_dropEffect.isNull()) {
+ if (m_dropEffect.isNull())
return false;
- } else {
+ else {
*op = cocoaOpFromIEOp(m_dropEffect);
return true;
}
if (len2) {
detach();
unsigned len1 = length();
- if (DeprecatedByteArray::resize(len1 + len2 + 1)) {
+ if (DeprecatedByteArray::resize(len1 + len2 + 1))
memcpy(data() + len1, s, len2 + 1);
- }
}
}
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef KHTML_SETTINGS_H_
-#define KHTML_SETTINGS_H_
+#ifndef WebCoreSettings_H
+#define WebCoreSettings_H
-#include "DeprecatedString.h"
-#include "DeprecatedStringList.h"
+#include "PlatformString.h"
#include "Font.h"
class KHTMLSettings
KAnimationEnabled
};
- KHTMLSettings() { }
-
- const DeprecatedString &stdFontName() const { return _stdFontName; }
- const DeprecatedString &fixedFontName() const { return _fixedFontName; }
- const DeprecatedString &serifFontName() const { return _serifFontName; }
- const DeprecatedString &sansSerifFontName() const { return _sansSerifFontName; }
- const DeprecatedString &cursiveFontName() const { return _cursiveFontName; }
- const DeprecatedString &fantasyFontName() const { return _fantasyFontName; }
-
- int minFontSize() const { return _minimumFontSize; }
- int minLogicalFontSize() const { return _minimumLogicalFontSize; }
- int mediumFontSize() const { return _defaultFontSize; }
- int mediumFixedFontSize() const { return _defaultFixedFontSize; }
+ const WebCore::AtomicString& stdFontName() const { return m_stdFontName; }
+ const WebCore::AtomicString& fixedFontName() const { return m_fixedFontName; }
+ const WebCore::AtomicString& serifFontName() const { return m_serifFontName; }
+ const WebCore::AtomicString& sansSerifFontName() const { return m_sansSerifFontName; }
+ const WebCore::AtomicString& cursiveFontName() const { return m_cursiveFontName; }
+ const WebCore::AtomicString& fantasyFontName() const { return m_fantasyFontName; }
- static bool changeCursor() { return true; }
+ int minFontSize() const { return m_minimumFontSize; }
+ int minLogicalFontSize() const { return m_minimumLogicalFontSize; }
+ int mediumFontSize() const { return m_defaultFontSize; }
+ int mediumFixedFontSize() const { return m_defaultFixedFontSize; }
- static bool isFormCompletionEnabled() { return false; }
- static int maxFormCompletionItems() { return 0; }
+ bool autoLoadImages() const { return m_willLoadImagesAutomatically; }
- bool autoLoadImages() const { return _willLoadImagesAutomatically; }
- static KAnimationAdvice showAnimations() { return KAnimationEnabled; }
-
- bool isJavaScriptEnabled() const { return _JavaScriptEnabled; }
- bool JavaScriptCanOpenWindowsAutomatically() const { return _JavaScriptCanOpenWindowsAutomatically; }
- bool isJavaScriptEnabled(const DeprecatedString &host) const { return _JavaScriptEnabled; }
- bool isJavaEnabled() const { return _JavaEnabled; }
- bool isJavaEnabled(const DeprecatedString &host) const { return _JavaEnabled; }
- bool isPluginsEnabled() const { return _pluginsEnabled; }
- bool isPluginsEnabled(const DeprecatedString &host) const { return _pluginsEnabled; }
+ bool isJavaScriptEnabled() const { return m_javaScriptEnabled; }
+ bool JavaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
+ bool isJavaEnabled() const { return m_javaEnabled; }
+ bool isPluginsEnabled() const { return m_pluginsEnabled; }
- const DeprecatedString &encoding() const { return _encoding; }
+ const DeprecatedString& encoding() const { return m_encoding; }
- const DeprecatedString &userStyleSheet() const { return _userStyleSheetLocation; }
- bool shouldPrintBackgrounds() const { return _shouldPrintBackgrounds; }
- bool textAreasAreResizable() const { return _textAreasAreResizable; }
+ DeprecatedString userStyleSheet() const { return m_userStyleSheetLocation; }
+ bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; }
+ bool textAreasAreResizable() const { return m_textAreasAreResizable; }
- void setStdFontName(const DeprecatedString &s) { _stdFontName = s; }
- void setFixedFontName(const DeprecatedString &s) { _fixedFontName = s; }
- void setSerifFontName(const DeprecatedString &s) { _serifFontName = s; }
- void setSansSerifFontName(const DeprecatedString &s) { _sansSerifFontName = s; }
- void setCursiveFontName(const DeprecatedString &s) { _cursiveFontName = s; }
- void setFantasyFontName(const DeprecatedString &s) { _fantasyFontName = s; }
+ void setStdFontName(const WebCore::AtomicString& s) { m_stdFontName = s; }
+ void setFixedFontName(const WebCore::AtomicString& s) { m_fixedFontName = s; }
+ void setSerifFontName(const WebCore::AtomicString& s) { m_serifFontName = s; }
+ void setSansSerifFontName(const WebCore::AtomicString& s) { m_sansSerifFontName = s; }
+ void setCursiveFontName(const WebCore::AtomicString& s) { m_cursiveFontName = s; }
+ void setFantasyFontName(const WebCore::AtomicString& s) { m_fantasyFontName = s; }
- void setMinFontSize(int s) { _minimumFontSize = s; }
- void setMinLogicalFontSize(int s) { _minimumLogicalFontSize = s; }
- void setMediumFontSize(int s) { _defaultFontSize = s; }
- void setMediumFixedFontSize(int s) { _defaultFixedFontSize = s; }
+ void setMinFontSize(int s) { m_minimumFontSize = s; }
+ void setMinLogicalFontSize(int s) { m_minimumLogicalFontSize = s; }
+ void setMediumFontSize(int s) { m_defaultFontSize = s; }
+ void setMediumFixedFontSize(int s) { m_defaultFixedFontSize = s; }
- void setAutoLoadImages(bool f) { _willLoadImagesAutomatically = f; }
- void setIsJavaScriptEnabled(bool f) { _JavaScriptEnabled = f; }
- void setIsJavaEnabled(bool f) { _JavaEnabled = f; }
- void setArePluginsEnabled(bool f) { _pluginsEnabled = f; }
- void setJavaScriptCanOpenWindowsAutomatically(bool f) { _JavaScriptCanOpenWindowsAutomatically = f; }
+ void setAutoLoadImages(bool f) { m_willLoadImagesAutomatically = f; }
+ void setIsJavaScriptEnabled(bool f) { m_javaScriptEnabled = f; }
+ void setIsJavaEnabled(bool f) { m_javaEnabled = f; }
+ void setArePluginsEnabled(bool f) { m_pluginsEnabled = f; }
+ void setJavaScriptCanOpenWindowsAutomatically(bool f) { m_javaScriptCanOpenWindowsAutomatically = f; }
- void setEncoding(const DeprecatedString &s) { _encoding = s; }
+ void setEncoding(const DeprecatedString& s) { m_encoding = s; }
- void setUserStyleSheet(const DeprecatedString &s) { _userStyleSheetLocation = s; }
- void setShouldPrintBackgrounds(bool f) { _shouldPrintBackgrounds = f; }
- void setTextAreasAreResizable(bool f) { _textAreasAreResizable = f; }
+ void setUserStyleSheet(const DeprecatedString& s) { m_userStyleSheetLocation = s; }
+ void setShouldPrintBackgrounds(bool f) { m_shouldPrintBackgrounds = f; }
+ void setTextAreasAreResizable(bool f) { m_textAreasAreResizable = f; }
private:
- DeprecatedString _stdFontName;
- DeprecatedString _fixedFontName;
- DeprecatedString _serifFontName;
- DeprecatedString _sansSerifFontName;
- DeprecatedString _cursiveFontName;
- DeprecatedString _fantasyFontName;
- DeprecatedString _encoding;
- DeprecatedString _userStyleSheetLocation;
-
- int _minimumFontSize;
- int _minimumLogicalFontSize;
- int _defaultFontSize;
- int _defaultFixedFontSize;
- bool _JavaEnabled : 1;
- bool _willLoadImagesAutomatically : 1;
- bool _pluginsEnabled : 1;
- bool _JavaScriptEnabled : 1;
- bool _JavaScriptCanOpenWindowsAutomatically : 1;
- bool _shouldPrintBackgrounds : 1;
- bool _textAreasAreResizable : 1;
+ WebCore::AtomicString m_stdFontName;
+ WebCore::AtomicString m_fixedFontName;
+ WebCore::AtomicString m_serifFontName;
+ WebCore::AtomicString m_sansSerifFontName;
+ WebCore::AtomicString m_cursiveFontName;
+ WebCore::AtomicString m_fantasyFontName;
+ DeprecatedString m_encoding; // FIXME: TextEncoding takes a latin1 string, which String & AtomicString don't easily produce
+ DeprecatedString m_userStyleSheetLocation; // FIXME: KURLs still use DeprecatedString
+ int m_minimumFontSize;
+ int m_minimumLogicalFontSize;
+ int m_defaultFontSize;
+ int m_defaultFixedFontSize;
+ bool m_javaEnabled : 1;
+ bool m_willLoadImagesAutomatically : 1;
+ bool m_pluginsEnabled : 1;
+ bool m_javaScriptEnabled : 1;
+ bool m_javaScriptCanOpenWindowsAutomatically : 1;
+ bool m_shouldPrintBackgrounds : 1;
+ bool m_textAreasAreResizable : 1;
};
#endif
BEGIN_BLOCK_OBJC_EXCEPTIONS;
NSDictionary *headerDict = nil;
- DeprecatedString headerString = job->queryMetaData("customHTTPHeader");
+ String headerString = job->queryMetaData("customHTTPHeader");
- if (!headerString.isEmpty()) {
- headerDict = [[NSDictionary _webcore_dictionaryWithHeaderString:headerString.getNSString()] retain];
- }
+ if (!headerString.isEmpty())
+ headerDict = [[NSDictionary _webcore_dictionaryWithHeaderString:headerString] retain];
NSArray *postData = nil;
if (job->postData().count() > 0)
#include "config.h"
#include "KWQTextStream.h"
-#include "DeprecatedString.h"
+#include "PlatformString.h"
#include "Logging.h"
const size_t integerOrPointerAsStringBufferSize = 100; // large enough for any integer or pointer in string format, including trailing null character
const int maxPrecision = 6; // must match to precisionFormats
const int defaultPrecision = 6; // matches qt and sprintf(.., "%f", ...) behaviour
-QTextStream::QTextStream(const DeprecatedByteArray &ba)
- : _hasByteArray(true), _byteArray(ba), _string(0), _precision(defaultPrecision)
+QTextStream::QTextStream(const DeprecatedByteArray& ba)
+ : m_hasByteArray(true), m_byteArray(ba), m_string(0), m_precision(defaultPrecision)
{
}
-QTextStream::QTextStream(DeprecatedString *s)
- : _hasByteArray(false), _string(s), _precision(defaultPrecision)
+QTextStream::QTextStream(DeprecatedString* s)
+ : m_hasByteArray(false), m_string(s), m_precision(defaultPrecision)
{
}
-QTextStream &QTextStream::operator<<(char c)
+QTextStream& QTextStream::operator<<(char c)
{
- if (_hasByteArray) {
- unsigned oldSize = _byteArray.size();
- _byteArray.resize(oldSize + 1);
- _byteArray[oldSize] = c;
- }
- if (_string) {
- _string->append(QChar(c));
+ if (m_hasByteArray) {
+ unsigned oldSize = m_byteArray.size();
+ m_byteArray.resize(oldSize + 1);
+ m_byteArray[oldSize] = c;
}
+ if (m_string)
+ m_string->append(QChar(c));
return *this;
}
-QTextStream &QTextStream::operator<<(short i)
+QTextStream& QTextStream::operator<<(short i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%d", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(unsigned short i)
+QTextStream& QTextStream::operator<<(unsigned short i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%u", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(int i)
+QTextStream& QTextStream::operator<<(int i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%d", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(unsigned i)
+QTextStream& QTextStream::operator<<(unsigned i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%u", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(long i)
+QTextStream& QTextStream::operator<<(long i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%ld", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(unsigned long i)
+QTextStream& QTextStream::operator<<(unsigned long i)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%lu", i);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(float f)
+QTextStream& QTextStream::operator<<(float f)
{
char buffer[integerOrPointerAsStringBufferSize];
- sprintf(buffer, precisionFormats[_precision], f);
+ sprintf(buffer, precisionFormats[m_precision], f);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(double d)
+QTextStream& QTextStream::operator<<(double d)
{
char buffer[integerOrPointerAsStringBufferSize];
- sprintf(buffer, precisionFormats[_precision], d);
+ sprintf(buffer, precisionFormats[m_precision], d);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(const char *s)
+QTextStream& QTextStream::operator<<(const char* s)
{
- if (_hasByteArray) {
+ if (m_hasByteArray) {
unsigned length = strlen(s);
- unsigned oldSize = _byteArray.size();
- _byteArray.resize(oldSize + length);
- memcpy(_byteArray.data() + oldSize, s, length);
- }
- if (_string) {
- _string->append(s);
+ unsigned oldSize = m_byteArray.size();
+ m_byteArray.resize(oldSize + length);
+ memcpy(m_byteArray.data() + oldSize, s, length);
}
+ if (m_string)
+ m_string->append(s);
return *this;
}
-QTextStream &QTextStream::operator<<(const DeprecatedCString &qcs)
+QTextStream& QTextStream::operator<<(const DeprecatedCString& qcs)
{
const char *s = qcs;
return *this << s;
}
-QTextStream &QTextStream::operator<<(const DeprecatedString &s)
+QTextStream& QTextStream::operator<<(const DeprecatedString& s)
{
- if (_hasByteArray) {
+ if (m_hasByteArray) {
unsigned length = s.length();
- unsigned oldSize = _byteArray.size();
- _byteArray.resize(oldSize + length);
- memcpy(_byteArray.data() + oldSize, s.latin1(), length);
- }
- if (_string) {
- _string->append(s);
+ unsigned oldSize = m_byteArray.size();
+ m_byteArray.resize(oldSize + length);
+ memcpy(m_byteArray.data() + oldSize, s.latin1(), length);
}
+ if (m_string)
+ m_string->append(s);
return *this;
}
-QTextStream &QTextStream::operator<<(void *p)
+QTextStream& QTextStream::operator<<(const WebCore::String& s)
+{
+ return (*this) << s.deprecatedString();
+}
+
+QTextStream& QTextStream::operator<<(void* p)
{
char buffer[integerOrPointerAsStringBufferSize];
sprintf(buffer, "%p", p);
return *this << buffer;
}
-QTextStream &QTextStream::operator<<(const QTextStreamManipulator &m)
+QTextStream& QTextStream::operator<<(const QTextStreamManipulator& m)
{
return m(*this);
}
int QTextStream::precision(int p)
{
- int oldPrecision = _precision;
+ int oldPrecision = m_precision;
if (p >= 0 && p <= maxPrecision)
- _precision = p;
+ m_precision = p;
return oldPrecision;
}
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef QTEXTSTREAM_H_
-#define QTEXTSTREAM_H_
+#ifndef QTextStream_H
+#define QTextStream_H
#include "DeprecatedArray.h"
class DeprecatedString;
class QTextStream;
-typedef QTextStream &(*QTextStreamManipulator)(QTextStream &);
+namespace WebCore {
+ class String;
+}
+
+typedef QTextStream &(*QTextStreamManipulator)(QTextStream&);
QTextStream &endl(QTextStream& stream);
class QTextStream {
public:
- QTextStream(const DeprecatedByteArray &);
+ QTextStream(const DeprecatedByteArray&);
QTextStream(DeprecatedString*);
- QTextStream &operator<<(char);
- QTextStream &operator<<(const QChar &);
- QTextStream &operator<<(short);
- QTextStream &operator<<(unsigned short);
- QTextStream &operator<<(int);
- QTextStream &operator<<(unsigned);
- QTextStream &operator<<(long);
- QTextStream &operator<<(unsigned long);
- QTextStream &operator<<(float);
- QTextStream &operator<<(double);
- QTextStream &operator<<(const char *);
- QTextStream &operator<<(const DeprecatedString &);
- QTextStream &operator<<(const DeprecatedCString &);
- QTextStream &operator<<(void *);
+ QTextStream& operator<<(char);
+ QTextStream& operator<<(const QChar&);
+ QTextStream& operator<<(short);
+ QTextStream& operator<<(unsigned short);
+ QTextStream& operator<<(int);
+ QTextStream& operator<<(unsigned);
+ QTextStream& operator<<(long);
+ QTextStream& operator<<(unsigned long);
+ QTextStream& operator<<(float);
+ QTextStream& operator<<(double);
+ QTextStream& operator<<(const char*);
+ QTextStream& operator<<(const WebCore::String&);
+ QTextStream& operator<<(const DeprecatedString&);
+ QTextStream& operator<<(const DeprecatedCString&);
+ QTextStream& operator<<(void*);
- QTextStream &operator<<(const QTextStreamManipulator &);
- int precision(int p);
+ QTextStream& operator<<(const QTextStreamManipulator&);
+ int precision(int);
private:
- QTextStream(const QTextStream &);
- QTextStream &operator=(const QTextStream &);
+ QTextStream(const QTextStream&);
+ QTextStream& operator=(const QTextStream&);
- bool _hasByteArray;
- DeprecatedByteArray _byteArray;
- DeprecatedString *_string;
- int _precision;
+ bool m_hasByteArray;
+ DeprecatedByteArray m_byteArray;
+ DeprecatedString* m_string;
+ int m_precision;
};
#endif
}
if (o.isTableCell()) {
- const RenderTableCell &c = static_cast<const RenderTableCell &>(o);
+ const RenderTableCell& c = static_cast<const RenderTableCell&>(o);
ts << " [r=" << c.row() << " c=" << c.col() << " rs=" << c.rowSpan() << " cs=" << c.colSpan() << "]";
}
return ts;
}
-static DeprecatedString quoteAndEscapeNonPrintables(const DeprecatedString &s)
+static String quoteAndEscapeNonPrintables(const String& s)
{
DeprecatedString result;
result += '"';
for (unsigned i = 0; i != s.length(); ++i) {
- QChar c = s.at(i);
- if (c == '\\') {
+ QChar c = s[i];
+ if (c == '\\')
result += "\\\\";
- } else if (c == '"') {
+ else if (c == '"')
result += "\\\"";
- } else if (c == '\n' || c.unicode() == 0x00A0) {
+ else if (c == '\n' || c.unicode() == 0x00A0)
result += ' ';
- } else {
+ else {
unsigned short u = c.unicode();
- if (u >= 0x20 && u < 0x7F) {
+ if (u >= 0x20 && u < 0x7F)
result += c;
- } else {
+ else {
DeprecatedString hex;
hex.sprintf("\\x{%X}", u);
result += hex;
return result;
}
-static void writeTextRun(QTextStream &ts, const RenderText &o, const InlineTextBox &run)
+static void writeTextRun(QTextStream& ts, const RenderText& o, const InlineTextBox& run)
{
ts << "text run at (" << run.m_x << "," << run.m_y << ") width " << run.m_width;
if (run.m_reversed || run.m_dirOverride) {
ts << " override";
}
ts << ": "
- << quoteAndEscapeNonPrintables(o.data().deprecatedString().mid(run.m_start, run.m_len))
+ << quoteAndEscapeNonPrintables(o.data().substring(run.m_start, run.m_len))
<< "\n";
}
#if SVG_SUPPORT
// FIXME: A hackish way to doing our own "virtual" dispatch
if (o.isRenderPath()) {
- write(ts, static_cast<const RenderPath &>(o), indent);
+ write(ts, static_cast<const RenderPath&>(o), indent);
return;
}
if (o.isKCanvasContainer()) {
- write(ts, static_cast<const KCanvasContainer &>(o), indent);
+ write(ts, static_cast<const KCanvasContainer&>(o), indent);
return;
}
#endif
ts << o << "\n";
if (o.isText() && !o.isBR()) {
- const RenderText &text = static_cast<const RenderText &>(o);
+ const RenderText& text = static_cast<const RenderText&>(o);
for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) {
writeIndent(ts, indent+1);
writeTextRun(ts, text, *box);
}
}
- for (RenderObject *child = o.firstChild(); child; child = child->nextSibling()) {
- if (child->layer()) {
+ for (RenderObject* child = o.firstChild(); child; child = child->nextSibling()) {
+ if (child->layer())
continue;
- }
write(ts, *child, indent + 1);
}
if (o.isWidget()) {
- Widget *widget = static_cast<const RenderWidget &>(o).widget();
+ Widget* widget = static_cast<const RenderWidget&>(o).widget();
if (widget && widget->isFrameView()) {
- FrameView *view = static_cast<FrameView *>(widget);
- RenderObject *root = view->frame()->renderer();
+ FrameView* view = static_cast<FrameView*>(widget);
+ RenderObject* root = view->frame()->renderer();
if (root) {
view->layout();
RenderLayer* l = root->layer();
if (!n || !n->isDocumentNode())
return;
- Document *doc = static_cast<Document *>(n);
+ Document *doc = static_cast<Document*>(n);
Frame *frame = doc->frame();
if (!frame)
return;
if (!cache)
cache = new CacheMap;
- if ( !docloader )
+ if (!docloader)
docloader = new DeprecatedPtrList<DocLoader>;
- if ( !nullImage )
+ if (!nullImage)
nullImage = new Image;
- if ( !brokenImage )
+ if (!brokenImage)
brokenImage = Image::loadResource("missing_image");
- if ( !m_loader )
+ if (!m_loader)
m_loader = new Loader();
}
delete docloader; docloader = 0;
}
-CachedImage *Cache::requestImage( DocLoader* dl, const String & url, bool reload, time_t _expireDate )
+CachedImage *Cache::requestImage(DocLoader* dl, const String& url, bool reload, time_t expireDate)
{
// this brings the _url to a standard form...
KURL kurl;
if (dl)
- kurl = dl->m_doc->completeURL( url.deprecatedString() );
+ kurl = dl->m_doc->completeURL(url.deprecatedString());
else
kurl = url.deprecatedString();
- return requestImage(dl, kurl, reload, _expireDate);
+ return requestImage(dl, kurl, reload, expireDate);
}
-CachedImage *Cache::requestImage( DocLoader* dl, const KURL & url, bool reload, time_t _expireDate )
+CachedImage *Cache::requestImage(DocLoader* dl, const KURL& url, bool reload, time_t expireDate)
{
KIO::CacheControl cachePolicy;
if (dl)
// Checking if the URL is malformed is lots of extra work for little benefit.
- if (!dl->doc()->shouldCreateRenderers()){
+ if (!dl->doc()->shouldCreateRenderers())
return 0;
- }
CachedObject *o = 0;
if (!reload)
o = cache->get(String(url.url()).impl());
- if(!o)
- {
+ if (!o) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache: new: " << url.url() << endl;
+ kdDebug(6060) << "Cache: new: " << url.url() << endl;
#endif
- CachedImage *im = new CachedImage(dl, url.url(), cachePolicy, _expireDate);
- if ( dl && dl->autoloadImages() ) Cache::loader()->load(dl, im, true);
+ CachedImage *im = new CachedImage(dl, url.url(), cachePolicy, expireDate);
+ if (dl && dl->autoloadImages()) Cache::loader()->load(dl, im, true);
if (cacheDisabled)
im->setFree(true);
else {
return 0;
#ifdef CACHE_DEBUG
- if( o->status() == CachedObject::Pending )
- kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
+ if (o->status() == CachedObject::Pending)
+ kdDebug(6060) << "Cache: loading in progress: " << kurl.url() << endl;
else
- kdDebug( 6060 ) << "Cache: using cached: " << kurl.url() << ", status " << o->status() << endl;
+ kdDebug(6060) << "Cache: using cached: " << kurl.url() << ", status " << o->status() << endl;
#endif
moveToHeadOfLRUList(o);
- if ( dl ) {
- dl->m_docObjects.remove( o );
+ if (dl) {
+ dl->m_docObjects.remove(o);
if (!cacheDisabled)
- dl->m_docObjects.append( o );
+ dl->m_docObjects.append(o);
}
return static_cast<CachedImage *>(o);
}
-CachedCSSStyleSheet *Cache::requestStyleSheet( DocLoader* dl, const String & url, bool reload, time_t _expireDate, const DeprecatedString& charset)
+CachedCSSStyleSheet *Cache::requestStyleSheet(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
{
// this brings the _url to a standard form...
KURL kurl;
KIO::CacheControl cachePolicy;
- if ( dl )
- {
- kurl = dl->m_doc->completeURL( url.deprecatedString() );
+ if (dl) {
+ kurl = dl->m_doc->completeURL(url.deprecatedString());
cachePolicy = dl->cachePolicy();
- }
- else
- {
+ } else {
kurl = url.deprecatedString();
cachePolicy = KIO::CC_Verify;
}
// Checking if the URL is malformed is lots of extra work for little benefit.
CachedObject *o = cache->get(String(kurl.url()).impl());
- if(!o)
- {
+ if (!o) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: new: " << kurl.url() << endl;
#endif
- CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), cachePolicy, _expireDate, charset);
+ CachedCSSStyleSheet *sheet = new CachedCSSStyleSheet(dl, kurl.url(), cachePolicy, expireDate, charset);
if (cacheDisabled)
sheet->setFree(true);
else {
}
- if(o->type() != CachedObject::CSSStyleSheet)
+ if (o->type() != CachedObject::CSSStyleSheet)
{
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache::Internal Error in requestStyleSheet url=" << kurl.url() << "!" << endl;
+ kdDebug(6060) << "Cache::Internal Error in requestStyleSheet url=" << kurl.url() << "!" << endl;
#endif
return 0;
}
#ifdef CACHE_DEBUG
- if( o->status() == CachedObject::Pending )
- kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
+ if (o->status() == CachedObject::Pending)
+ kdDebug(6060) << "Cache: loading in progress: " << kurl.url() << endl;
else
- kdDebug( 6060 ) << "Cache: using cached: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
moveToHeadOfLRUList(o);
- if ( dl ) {
- dl->m_docObjects.remove( o );
+ if (dl) {
+ dl->m_docObjects.remove(o);
if (!cacheDisabled)
- dl->m_docObjects.append( o );
+ dl->m_docObjects.append(o);
}
return static_cast<CachedCSSStyleSheet *>(o);
}
-void Cache::preloadStyleSheet(const DeprecatedString &url, const DeprecatedString &stylesheet_data)
+void Cache::preloadStyleSheet(const DeprecatedString& url, const DeprecatedString& stylesheet_data)
{
CachedObject *o = cache->get(String(url).impl());
if (o)
cache->set(String(url).impl(), new CachedCSSStyleSheet(url, stylesheet_data));
}
-CachedScript *Cache::requestScript( DocLoader* dl, const WebCore::String &url, bool reload, time_t _expireDate, const DeprecatedString& charset)
+CachedScript *Cache::requestScript(DocLoader* dl, const String& url, bool reload, time_t expireDate, const DeprecatedString& charset)
{
// this brings the _url to a standard form...
KURL kurl;
KIO::CacheControl cachePolicy;
- if ( dl )
- {
- kurl = dl->m_doc->completeURL( url.deprecatedString() );
+ if (dl) {
+ kurl = dl->m_doc->completeURL(url.deprecatedString());
cachePolicy = dl->cachePolicy();
- }
- else
- {
+ } else {
kurl = url.deprecatedString();
cachePolicy = KIO::CC_Verify;
}
// Checking if the URL is malformed is lots of extra work for little benefit.
CachedObject *o = cache->get(String(kurl.url()).impl());
- if(!o)
+ if (!o)
{
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: new: " << kurl.url() << endl;
#endif
- CachedScript *script = new CachedScript(dl, kurl.url(), cachePolicy, _expireDate, charset);
+ CachedScript *script = new CachedScript(dl, kurl.url(), cachePolicy, expireDate, charset);
if (cacheDisabled)
script->setFree(true);
else {
- cache->set(String(kurl.url()).impl(), script );
+ cache->set(String(kurl.url()).impl(), script);
moveToHeadOfLRUList(script);
}
o = script;
}
- if(!(o->type() == CachedObject::Script))
- {
+ if (!(o->type() == CachedObject::Script)) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache::Internal Error in requestScript url=" << kurl.url() << "!" << endl;
+ kdDebug(6060) << "Cache::Internal Error in requestScript url=" << kurl.url() << "!" << endl;
#endif
return 0;
}
#ifdef CACHE_DEBUG
- if( o->status() == CachedObject::Pending )
- kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
+ if (o->status() == CachedObject::Pending)
+ kdDebug(6060) << "Cache: loading in progress: " << kurl.url() << endl;
else
- kdDebug( 6060 ) << "Cache: using cached: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
moveToHeadOfLRUList(o);
- if ( dl ) {
- dl->m_docObjects.remove( o );
+ if (dl) {
+ dl->m_docObjects.remove(o);
if (!cacheDisabled)
- dl->m_docObjects.append( o );
+ dl->m_docObjects.append(o);
}
return static_cast<CachedScript *>(o);
}
-void Cache::preloadScript(const DeprecatedString &url, const DeprecatedString &script_data)
+void Cache::preloadScript(const DeprecatedString& url, const DeprecatedString& script_data)
{
CachedObject *o = cache->get(String(url).impl());
- if(o)
+ if (o)
remove(o);
cache->set(String(url).impl(), new CachedScript(url, script_data));
}
#ifdef KHTML_XSLT
-CachedXSLStyleSheet* Cache::requestXSLStyleSheet(DocLoader* dl, const String & url, bool reload,
- time_t _expireDate)
+CachedXSLStyleSheet* Cache::requestXSLStyleSheet(DocLoader* dl, const String& url, bool reload, time_t expireDate)
{
// this brings the _url to a standard form...
KURL kurl;
CachedObject *o = cache->get(String(kurl.url()).impl());
if (!o) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: new: " << kurl.url() << endl;
#endif
- CachedXSLStyleSheet* doc = new CachedXSLStyleSheet(dl, kurl.url(), cachePolicy, _expireDate);
+ CachedXSLStyleSheet* doc = new CachedXSLStyleSheet(dl, kurl.url(), cachePolicy, expireDate);
if (cacheDisabled)
doc->setFree(true);
else {
if (o->type() != CachedObject::XSLStyleSheet) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache::Internal Error in requestXSLStyleSheet url=" << kurl.url() << "!" << endl;
+ kdDebug(6060) << "Cache::Internal Error in requestXSLStyleSheet url=" << kurl.url() << "!" << endl;
#endif
return 0;
}
#ifdef CACHE_DEBUG
if (o->status() == CachedObject::Pending)
- kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: loading in progress: " << kurl.url() << endl;
else
- kdDebug( 6060 ) << "Cache: using cached: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
moveToHeadOfLRUList(o);
if (dl) {
- dl->m_docObjects.remove( o );
+ dl->m_docObjects.remove(o);
if (!cacheDisabled)
- dl->m_docObjects.append( o );
+ dl->m_docObjects.append(o);
}
return static_cast<CachedXSLStyleSheet*>(o);
}
#endif
#ifndef KHTML_NO_XBL
-CachedXBLDocument* Cache::requestXBLDocument(DocLoader* dl, const String & url, bool reload,
- time_t _expireDate)
+CachedXBLDocument* Cache::requestXBLDocument(DocLoader* dl, const String& url, bool reload,
+ time_t expireDate)
{
// this brings the _url to a standard form...
KURL kurl;
if (dl) {
kurl = dl->m_doc->completeURL(url.deprecatedString());
cachePolicy = dl->cachePolicy();
- }
- else {
+ } else {
kurl = url.deprecatedString();
cachePolicy = KIO::CC_Verify;
}
// Checking if the URL is malformed is lots of extra work for little benefit.
CachedObject *o = cache->get(String(kurl.url()).impl());
- if(!o)
- {
+ if (!o) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache: new: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: new: " << kurl.url() << endl;
#endif
- CachedXBLDocument* doc = new CachedXBLDocument(dl, kurl.url(), cachePolicy, _expireDate);
+ CachedXBLDocument* doc = new CachedXBLDocument(dl, kurl.url(), cachePolicy, expireDate);
if (cacheDisabled)
doc->setFree(true);
else {
}
- if(o->type() != CachedObject::XBL)
- {
+ if (o->type() != CachedObject::XBL) {
#ifdef CACHE_DEBUG
- kdDebug( 6060 ) << "Cache::Internal Error in requestXBLDocument url=" << kurl.url() << "!" << endl;
+ kdDebug(6060) << "Cache::Internal Error in requestXBLDocument url=" << kurl.url() << "!" << endl;
#endif
return 0;
}
#ifdef CACHE_DEBUG
- if( o->status() == CachedObject::Pending )
- kdDebug( 6060 ) << "Cache: loading in progress: " << kurl.url() << endl;
+ if (o->status() == CachedObject::Pending)
+ kdDebug(6060) << "Cache: loading in progress: " << kurl.url() << endl;
else
- kdDebug( 6060 ) << "Cache: using cached: " << kurl.url() << endl;
+ kdDebug(6060) << "Cache: using cached: " << kurl.url() << endl;
#endif
moveToHeadOfLRUList(o);
- if ( dl ) {
- dl->m_docObjects.remove( o );
+ if (dl) {
+ dl->m_docObjects.remove(o);
if (!cacheDisabled)
- dl->m_docObjects.append( o );
+ dl->m_docObjects.append(o);
}
return static_cast<CachedXBLDocument*>(o);
}
flush(true);
}
-void Cache::remove( CachedObject *object )
+void Cache::remove(CachedObject *object)
{
// this indicates the deref() method of CachedObject to delete itself when the reference counter
// drops down to zero
removeFromLRUList(object);
const DocLoader* dl;
- for ( dl=docloader->first(); dl; dl=docloader->next() )
- dl->removeCachedObject( object );
+ for (dl=docloader->first(); dl; dl=docloader->next())
+ dl->removeCachedObject(object);
- if ( object->canDelete() )
+ if (object->canDelete())
delete object;
}
* if the DocLoader is zero, the url must be full-qualified.
* Otherwise, it is automatically base-url expanded
*/
- static CachedImage* requestImage(DocLoader*, const WebCore::String& URL, bool reload = false, time_t expireDate = 0);
+ static CachedImage* requestImage(DocLoader*, const String& URL, bool reload = false, time_t expireDate = 0);
static CachedImage* requestImage(DocLoader*, const KURL& url, bool reload = false, time_t expireDate = 0);
/**
* Ask the cache for some url. Will return a cachedObject, and
* load the requested data in case it's not cached
*/
- static CachedCSSStyleSheet* requestStyleSheet(DocLoader*, const WebCore::String& URL, bool reload = false, time_t expireDate = 0, const DeprecatedString& charset = DeprecatedString::null);
+ static CachedCSSStyleSheet* requestStyleSheet(DocLoader*, const String& URL, bool reload = false, time_t expireDate = 0, const DeprecatedString& charset = DeprecatedString::null);
/**
* Pre-loads a stylesheet into the cache.
* Ask the cache for some url. Will return a cachedObject, and
* load the requested data in case it's not cahced
*/
- static CachedScript* requestScript(DocLoader*, const WebCore::String& URL, bool reload = false, time_t expireDate = 0, const DeprecatedString& charset = DeprecatedString::null);
+ static CachedScript* requestScript(DocLoader*, const String& URL, bool reload = false, time_t expireDate = 0, const DeprecatedString& charset = DeprecatedString::null);
/**
* Pre-loads a script into the cache.
#ifdef KHTML_XSLT
// Ask the cache for an XSL stylesheet.
- static CachedXSLStyleSheet* requestXSLStyleSheet(DocLoader*, const WebCore::String& URL, bool reload = false, time_t expireDate = 0);
+ static CachedXSLStyleSheet* requestXSLStyleSheet(DocLoader*, const String& URL, bool reload = false, time_t expireDate = 0);
#endif
#ifndef KHTML_NO_XBL
// Ask the cache for an XBL document.
- static CachedXBLDocument* requestXBLDocument(DocLoader*, const WebCore::String& URL, bool reload = false, time_t expireDate = 0);
+ static CachedXBLDocument* requestXBLDocument(DocLoader*, const String& URL, bool reload = false, time_t expireDate = 0);
#endif
/**
static int maxCacheableObjectSize() { return maxCacheable; }
// Get an existing cache entry by URL.
- static CachedObject* get(const WebCore::String& URL);
+ static CachedObject* get(const String& URL);
// Remove an existing cache entry.
static void remove(CachedObject*);
}
}
-void CachedCSSStyleSheet::error( int /*err*/, const char */*text*/ )
+void CachedCSSStyleSheet::error()
{
m_loading = false;
checkNotify();
virtual void setCharset(const DeprecatedString&);
virtual void data(DeprecatedByteArray&, bool atEnd);
- virtual void error(int code, const char* message);
+ virtual void error();
virtual bool schedule() const { return true; }
}
}
-void CachedImage::error( int /*err*/, const char */*text*/ )
+void CachedImage::error()
{
clear();
m_errorOccurred = true;
virtual void deref(CachedObjectClient*);
virtual void data(DeprecatedByteArray&, bool atEnd);
- virtual void error(int code, const char* message);
+ virtual void error();
bool isErrorImage() const { return m_errorOccurred; }
virtual void setCharset(const DeprecatedString&) {}
virtual void data(DeprecatedByteArray&, bool atEnd) = 0;
- virtual void error(int code, const char* message) = 0;
+ virtual void error() = 0;
const String &url() const { return m_url; }
Type type() const { return m_type; }
void CachedScript::checkNotify()
{
- if(m_loading) return;
+ if (m_loading)
+ return;
CachedObjectClientWalker w(m_clients);
while (CachedObjectClient *c = w.next())
c->notifyFinished(this);
}
-
-void CachedScript::error( int /*err*/, const char */*text*/ )
+void CachedScript::error()
{
m_loading = false;
m_errorOccurred = true;
virtual void setCharset(const DeprecatedString&);
virtual void data(DeprecatedByteArray&, bool atEnd);
- virtual void error(int code, const char* message);
+ virtual void error();
virtual bool schedule() const { return false; }
c->setXBLDocument(m_url, m_document);
}
-void CachedXBLDocument::error( int /*err*/, const char */*text*/ )
+void CachedXBLDocument::error()
{
m_loading = false;
checkNotify();
virtual void setCharset( const DeprecatedString &chs );
virtual void data(DeprecatedByteArray&, bool eof );
- virtual void error( int err, const char *text );
+ virtual void error();
virtual bool schedule() const { return true; }
}
-void CachedXSLStyleSheet::error( int /*err*/, const char */*text*/ )
+void CachedXSLStyleSheet::error()
{
m_loading = false;
checkNotify();
virtual void setCharset(const DeprecatedString&);
virtual void data(DeprecatedByteArray&, bool eof);
- virtual void error(int err, const char* text);
+ virtual void error();
virtual bool schedule() const { return true; }
m_loadInProgress = false;
Cache::init();
- Cache::docloader->append( this );
+ Cache::docloader->append(this);
}
DocLoader::~DocLoader()
{
- Cache::docloader->remove( this );
+ Cache::docloader->remove(this);
}
void DocLoader::setExpireDate(time_t _expireDate)
m_expireDate = _expireDate;
}
-bool DocLoader::needReload(const KURL &fullURL)
+bool DocLoader::needReload(const KURL& fullURL)
{
bool reload = false;
- if (m_cachePolicy == KIO::CC_Verify)
- {
- if (!m_reloadedURLs.contains(fullURL.url()))
- {
+ if (m_cachePolicy == KIO::CC_Verify) {
+ if (!m_reloadedURLs.contains(fullURL.url())) {
CachedObject* existing = Cache::get(fullURL.url());
- if (existing && existing->isExpired())
- {
+ if (existing && existing->isExpired()) {
Cache::remove(existing);
m_reloadedURLs.append(fullURL.url());
reload = true;
}
}
- }
- else if ((m_cachePolicy == KIO::CC_Reload) || (m_cachePolicy == KIO::CC_Refresh))
- {
- if (!m_reloadedURLs.contains(fullURL.url()))
- {
+ } else if ((m_cachePolicy == KIO::CC_Reload) || (m_cachePolicy == KIO::CC_Refresh)) {
+ if (!m_reloadedURLs.contains(fullURL.url())) {
CachedObject* existing = Cache::get(fullURL.url());
if (existing)
Cache::remove(existing);
return reload;
}
-CachedImage *DocLoader::requestImage(const WebCore::String &url)
+CachedImage *DocLoader::requestImage(const String& url)
{
KURL fullURL = m_doc->completeURL(url.deprecatedString());
- if (KWQCheckIfReloading(this)) {
+ if (KWQCheckIfReloading(this))
setCachePolicy(KIO::CC_Reload);
- }
bool reload = needReload(fullURL);
return cachedObject;
}
-CachedCSSStyleSheet *DocLoader::requestStyleSheet( const WebCore::String &url, const DeprecatedString& charset)
+CachedCSSStyleSheet *DocLoader::requestStyleSheet(const String& url, const DeprecatedString& charset)
{
KURL fullURL = m_doc->completeURL(url.deprecatedString());
- if (KWQCheckIfReloading(this)) {
+ if (KWQCheckIfReloading(this))
setCachePolicy(KIO::CC_Reload);
- }
bool reload = needReload(fullURL);
return cachedObject;
}
-CachedScript *DocLoader::requestScript( const WebCore::String &url, const DeprecatedString& charset)
+CachedScript *DocLoader::requestScript(const String& url, const DeprecatedString& charset)
{
KURL fullURL = m_doc->completeURL(url.deprecatedString());
- if (KWQCheckIfReloading(this)) {
+ if (KWQCheckIfReloading(this))
setCachePolicy(KIO::CC_Reload);
- }
bool reload = needReload(fullURL);
}
#ifdef KHTML_XSLT
-CachedXSLStyleSheet* DocLoader::requestXSLStyleSheet(const WebCore::String &url)
+CachedXSLStyleSheet* DocLoader::requestXSLStyleSheet(const String& url)
{
KURL fullURL = m_doc->completeURL(url.deprecatedString());
#endif
#ifndef KHTML_NO_XBL
-CachedXBLDocument* DocLoader::requestXBLDocument(const WebCore::String &url)
+CachedXBLDocument* DocLoader::requestXBLDocument(const String& url)
{
KURL fullURL = m_doc->completeURL(url.deprecatedString());
// FIXME: Is this right for XBL?
if (m_frame && m_frame->onlyLocalReferences() && fullURL.protocol() != "file") return 0;
- if (KWQCheckIfReloading(this)) {
+ if (KWQCheckIfReloading(this))
setCachePolicy(KIO::CC_Reload);
- }
bool reload = needReload(fullURL);
}
#endif
-void DocLoader::setAutoloadImages( bool enable )
+void DocLoader::setAutoloadImages(bool enable)
{
- if ( enable == m_bautoloadImages )
+ if (enable == m_bautoloadImages)
return;
m_bautoloadImages = enable;
- if ( !m_bautoloadImages ) return;
+ if (!m_bautoloadImages)
+ return;
- for ( const CachedObject* co=m_docObjects.first(); co; co=m_docObjects.next() )
- if ( co->type() == CachedObject::ImageResource )
- {
- CachedImage *img = const_cast<CachedImage*>( static_cast<const CachedImage *>( co ) );
+ for (const CachedObject* co=m_docObjects.first(); co; co=m_docObjects.next())
+ if (co->type() == CachedObject::ImageResource) {
+ CachedImage *img = const_cast<CachedImage*>(static_cast<const CachedImage *>(co));
CachedObject::Status status = img->status();
- if ( status != CachedObject::Unknown )
+ if (status != CachedObject::Unknown)
continue;
Cache::loader()->load(this, img, true);
const CachedObject* co;
for (co=m_docObjects.first(); co; co = m_docObjects.next())
- if (co->type() == CachedObject::ImageResource)
- {
+ if (co->type() == CachedObject::ImageResource) {
CachedImage *img = const_cast<CachedImage*>(static_cast<const CachedImage*>(co));
img->setShowAnimations(showAnimations);
}
}
-void DocLoader::removeCachedObject( CachedObject* o ) const
+void DocLoader::removeCachedObject(CachedObject* o) const
{
- m_docObjects.removeRef( o );
+ m_docObjects.removeRef(o);
}
void DocLoader::setLoadInProgress(bool load)
if (job->error() || job->isErrorPage()) {
docLoader->setLoadInProgress(true);
- r->object->error( job->error(), job->errorText().ascii() );
+ r->object->error();
docLoader->setLoadInProgress(false);
Cache::remove(object);
} else {
r->object->setResponse(response);
r->object->setExpireDate(KWQCacheObjectExpiresTime(r->m_docLoader, response), false);
- DeprecatedString chs = job->queryMetaData("charset");
+ DeprecatedString chs = job->queryMetaData("charset").deprecatedString();
if (!chs.isNull())
r->object->setCharset(chs);
m_cachedSheet->deref(this);
}
private:
- virtual void setStyleSheet(const String&, const String &sheet)
+ virtual void setStyleSheet(const String&, const String& sheet)
{
- m_frame->setUserStyleSheet(sheet.deprecatedString());
+ m_frame->setUserStyleSheet(sheet);
}
Frame* m_frame;
CachedCSSStyleSheet* m_cachedSheet;
d = 0;
}
-bool Frame::didOpenURL(const KURL &url)
+bool Frame::didOpenURL(const KURL& url)
{
if (d->m_scheduledRedirection == locationChangeScheduledDuringLoad) {
// A redirect was shceduled before the document was created. This can happen
d->m_kjsStatusBarText = String();
d->m_kjsDefaultStatusBarText = String();
- d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(url.host());
- d->m_bJavaEnabled = d->m_settings->isJavaEnabled(url.host());
- d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(url.host());
+ d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled();
+ d->m_bJavaEnabled = d->m_settings->isJavaEnabled();
+ d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled();
// initializing d->m_url to the new url breaks relative links when opening such a link after this call and _before_ begin() is called (when the first
// data arrives) (Simon)
d->m_url = url;
- if(d->m_url.protocol().startsWith("http") && !d->m_url.host().isEmpty() && d->m_url.path().isEmpty())
+ if (d->m_url.protocol().startsWith("http") && !d->m_url.host().isEmpty() && d->m_url.path().isEmpty())
d->m_url.setPath("/");
d->m_workingURL = d->m_url;
return d->m_bJScriptEnabled;
}
-void Frame::setMetaRefreshEnabled( bool enable )
+void Frame::setMetaRefreshEnabled(bool enable)
{
d->m_metaRefreshEnabled = enable;
}
return d->m_bPluginsEnabled;
}
-void Frame::setAutoloadImages( bool enable )
+void Frame::setAutoloadImages(bool enable)
{
- if ( d->m_doc && d->m_doc->docLoader()->autoloadImages() == enable )
+ if (d->m_doc && d->m_doc->docLoader()->autoloadImages() == enable)
return;
- if ( d->m_doc )
- d->m_doc->docLoader()->setAutoloadImages( enable );
+ if (d->m_doc)
+ d->m_doc->docLoader()->setAutoloadImages(enable);
}
bool Frame::autoloadImages() const
{
- if ( d->m_doc )
+ if (d->m_doc)
return d->m_doc->docLoader()->autoloadImages();
return true;
void Frame::clear(bool clearWindowProperties)
{
- if ( d->m_bCleared )
+ if (d->m_bCleared)
return;
d->m_bCleared = true;
d->m_mousePressNode = 0;
if (clearWindowProperties && d->m_jscript)
d->m_jscript->clear();
- if ( d->m_view )
+ if (d->m_view)
d->m_view->clear();
// do not drop the document before the jscript and view are cleared, as some destructors
d->m_bMousePressed = false;
- if ( !d->m_haveEncoding )
+ if (!d->m_haveEncoding)
d->m_encoding = DeprecatedString::null;
}
DeprecatedString qData;
// Support for http-refresh
- qData = d->m_job->queryMetaData("http-refresh");
- if(!qData.isEmpty() && d->m_metaRefreshEnabled) {
+ qData = d->m_job->queryMetaData("http-refresh").deprecatedString();
+ if (!qData.isEmpty() && d->m_metaRefreshEnabled) {
double delay;
- int pos = qData.find( ';' );
- if ( pos == -1 )
- pos = qData.find( ',' );
+ int pos = qData.find(';');
+ if (pos == -1)
+ pos = qData.find(',');
- if( pos == -1 )
- {
+ if (pos == -1) {
delay = qData.stripWhiteSpace().toDouble();
// We want a new history item if the refresh timeout > 1 second
- scheduleRedirection( delay, d->m_url.url(), delay <= 1);
- }
- else
- {
+ scheduleRedirection(delay, d->m_url.url(), delay <= 1);
+ } else {
int end_pos = qData.length();
delay = qData.left(pos).stripWhiteSpace().toDouble();
- while ( qData[++pos] == ' ' );
- if ( qData.find( "url", pos, false ) == pos )
- {
+ while (qData[++pos] == ' ');
+ if (qData.find("url", pos, false) == pos) {
pos += 3;
- while (qData[pos] == ' ' || qData[pos] == '=' )
+ while (qData[pos] == ' ' || qData[pos] == '=')
pos++;
- if ( qData[pos] == '"' )
- {
+ if (qData[pos] == '"') {
pos++;
int index = end_pos-1;
- while( index > pos )
- {
- if ( qData[index] == '"' )
+ while (index > pos) {
+ if (qData[index] == '"')
break;
index--;
}
- if ( index > pos )
+ if (index > pos)
end_pos = index;
}
}
// We want a new history item if the refresh timeout > 1 second
- scheduleRedirection( delay, d->m_doc->completeURL( qData.mid( pos, end_pos ) ), delay <= 1);
+ scheduleRedirection(delay, d->m_doc->completeURL(qData.mid(pos, end_pos)), delay <= 1);
}
d->m_bHTTPRefresh = true;
}
return d->m_request;
}
-void Frame::begin(const KURL &url)
+void Frame::begin(const KURL& url)
{
if (d->m_workingURL.isEmpty())
createEmptyDocument(); // Creates an empty document if we don't have one already
d->m_doc = DOMImplementation::instance()->createHTMLDocument(d->m_view.get());
if (!d->m_doc->attached())
- d->m_doc->attach( );
- d->m_doc->setURL( d->m_url.url() );
+ d->m_doc->attach();
+ d->m_doc->setURL(d->m_url.url());
// We prefer m_baseURL over d->m_url because d->m_url changes when we are
// about to load a new page.
- d->m_doc->setBaseURL( baseurl.url() );
+ d->m_doc->setBaseURL(baseurl.url());
if (d->m_decoder)
d->m_doc->setDecoder(d->m_decoder.get());
- d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
+ d->m_doc->docLoader()->setShowAnimations(KHTMLSettings::KAnimationEnabled);
updatePolicyBaseURL();
- setAutoloadImages( d->m_settings->autoLoadImages() );
- DeprecatedString userStyleSheet = d->m_settings->userStyleSheet();
+ setAutoloadImages(d->m_settings->autoLoadImages());
+ String userStyleSheet = d->m_settings->userStyleSheet();
- if ( !userStyleSheet.isEmpty() )
- setUserStyleSheet( KURL( userStyleSheet ) );
+ if (!userStyleSheet.isEmpty())
+ setUserStyleSheet(KURL(userStyleSheet));
restoreDocumentState();
d->m_doc->implicitOpen();
// clear widget
if (d->m_view)
- d->m_view->resizeContents( 0, 0 );
+ d->m_view->resizeContents(0, 0);
}
void Frame::write(const char* str, int len)
{
- if ( !d->m_decoder ) {
+ if (!d->m_decoder) {
d->m_decoder = new Decoder;
if (!d->m_encoding.isNull())
d->m_decoder->setEncodingName(d->m_encoding.latin1(),
if (d->m_doc)
d->m_doc->setDecoder(d->m_decoder.get());
}
- if ( len == 0 )
+ if (len == 0)
return;
- if ( len == -1 )
- len = strlen( str );
+ if (len == -1)
+ len = strlen(str);
- DeprecatedString decoded = d->m_decoder->decode( str, len );
+ DeprecatedString decoded = d->m_decoder->decode(str, len);
- if(decoded.isEmpty()) return;
+ if (decoded.isEmpty())
+ return;
- if(d->m_bFirstData) {
+ if (d->m_bFirstData) {
// determine the parse mode
- d->m_doc->determineParseMode( decoded );
+ d->m_doc->determineParseMode(decoded);
d->m_bFirstData = false;
// ### this is still quite hacky, but should work a lot better than the old solution
- if(d->m_decoder->visuallyOrdered()) d->m_doc->setVisuallyOrdered();
- d->m_doc->recalcStyle( Node::Force );
+ if (d->m_decoder->visuallyOrdered()) d->m_doc->setVisuallyOrdered();
+ d->m_doc->recalcStyle(Node::Force);
}
if (Tokenizer* t = d->m_doc->tokenizer())
- t->write( decoded, true );
+ t->write(decoded, true);
}
-void Frame::write( const DeprecatedString &str )
+void Frame::write(const DeprecatedString& str)
{
- if ( str.isNull() )
+ if (str.isNull())
return;
- if(d->m_bFirstData) {
+ if (d->m_bFirstData) {
// determine the parse mode
- d->m_doc->setParseMode( Document::Strict );
+ d->m_doc->setParseMode(Document::Strict);
d->m_bFirstData = false;
}
Tokenizer* t = d->m_doc->tokenizer();
- if(t)
- t->write( str, true );
+ if (t)
+ t->write(str, true);
}
void Frame::end()
return d->m_doc->baseURL();
}
-DeprecatedString Frame::baseTarget() const
+String Frame::baseTarget() const
{
if (!d->m_doc)
return DeprecatedString();
return d->m_doc->baseTarget();
}
-KURL Frame::completeURL(const DeprecatedString &url)
+KURL Frame::completeURL(const DeprecatedString& url)
{
if (!d->m_doc)
return url;
return KURL(d->m_doc->completeURL(url));
}
-void Frame::scheduleRedirection( double delay, const DeprecatedString &url, bool doLockHistory)
+void Frame::scheduleRedirection(double delay, const DeprecatedString& url, bool doLockHistory)
{
if (delay < 0 || delay > INT_MAX / 1000)
return;
- if ( d->m_scheduledRedirection == noRedirectionScheduled || delay <= d->m_delayRedirect )
+ if (d->m_scheduledRedirection == noRedirectionScheduled || delay <= d->m_delayRedirect)
{
d->m_scheduledRedirection = redirectionScheduled;
d->m_delayRedirect = delay;
}
}
-void Frame::scheduleLocationChange(const DeprecatedString &url, const DeprecatedString &referrer, bool lockHistory, bool userGesture)
+void Frame::scheduleLocationChange(const DeprecatedString& url, const DeprecatedString& referrer, bool lockHistory, bool userGesture)
{
// Handle a location change of a page with no document as a special case.
// This may happen when a frame changes the location of another frame.
return false;
}
-void Frame::scheduleHistoryNavigation( int steps )
+void Frame::scheduleHistoryNavigation(int steps)
{
// navigation will always be allowed in the 0 steps case, which is OK because
// that's supposed to force a reload.
}
}
-void Frame::changeLocation(const DeprecatedString &URL, const DeprecatedString &referrer, bool lockHistory, bool userGesture)
+void Frame::changeLocation(const DeprecatedString& URL, const DeprecatedString& referrer, bool lockHistory, bool userGesture)
{
if (URL.find("javascript:", 0, false) == 0) {
DeprecatedString script = KURL::decode_string(URL.mid(11));
// in both IE and NS (but not in Mozilla).... we can't easily do that
// in Konqueror...
if (d->m_scheduledHistoryNavigationSteps == 0) // add && parent() to get only frames, but doesn't matter
- openURL( url() ); /// ## need args.reload=true?
+ openURL(url()); /// ## need args.reload=true?
else {
if (d->m_extension) {
d->m_extension->goBackOrForward(d->m_scheduledHistoryNavigationSteps);
return d->m_encoding;
if (d->m_decoder && d->m_decoder->encoding().isValid())
- return DeprecatedString(d->m_decoder->encodingName());
+ return d->m_decoder->encodingName();
return settings()->encoding();
}
d->m_doc->setUserStyleSheet(styleSheet);
}
-bool Frame::gotoAnchor( const DeprecatedString &name )
+bool Frame::gotoAnchor(const String& name)
{
if (!d->m_doc)
return false;
- Node *n = d->m_doc->getElementById(name);
+ Node *n = d->m_doc->getElementById(AtomicString(name));
if (!n) {
HTMLCollection *anchors =
new HTMLCollection(d->m_doc.get(), HTMLCollection::DOC_ANCHORS);
// We need to update the layout before scrolling, otherwise we could
// really mess things up if an anchor scroll comes at a bad moment.
- if ( d->m_doc ) {
+ if (d->m_doc) {
d->m_doc->updateRendering();
// Only do a layout if changes have occurred that make it necessary.
- if ( d->m_view && d->m_doc->renderer() && d->m_doc->renderer()->needsLayout() ) {
+ if (d->m_view && d->m_doc->renderer() && d->m_doc->renderer()->needsLayout()) {
d->m_view->layout();
}
}
return true;
}
-void Frame::setStandardFont( const DeprecatedString &name )
+void Frame::setStandardFont(const String& name)
{
- d->m_settings->setStdFontName(name);
+ d->m_settings->setStdFontName(AtomicString(name));
}
-void Frame::setFixedFont( const DeprecatedString &name )
+void Frame::setFixedFont(const String& name)
{
- d->m_settings->setFixedFontName(name);
+ d->m_settings->setFixedFontName(AtomicString(name));
}
-DeprecatedString Frame::selectedText() const
+String Frame::selectedText() const
{
return plainText(selection().toRange().get());
}
return d->m_selection.isCaretOrRange();
}
-SelectionController &Frame::selection() const
+SelectionController& Frame::selection() const
{
return d->m_selection;
}
d->m_selectionGranularity = granularity;
}
-const SelectionController &Frame::dragCaret() const
+const SelectionController& Frame::dragCaret() const
{
return d->m_dragCaret;
}
d->m_mark = s;
}
-void Frame::setSelection(const SelectionController &s, bool closeTyping, bool keepTypingStyle)
+void Frame::setSelection(const SelectionController& s, bool closeTyping, bool keepTypingStyle)
{
if (d->m_selection == s) {
return;
respondToChangedSelection(oldSelection, closeTyping);
}
-void Frame::setDragCaret(const SelectionController &dragCaret)
+void Frame::setDragCaret(const SelectionController& dragCaret)
{
if (d->m_dragCaret != dragCaret) {
d->m_dragCaret.needsCaretRepaint();
d->m_selection.needsCaretRepaint();
}
-void Frame::paintCaret(GraphicsContext* p, const IntRect &rect) const
+void Frame::paintCaret(GraphicsContext* p, const IntRect& rect) const
{
if (d->m_caretPaint)
d->m_selection.paintCaret(p, rect);
}
-void Frame::paintDragCaret(GraphicsContext* p, const IntRect &rect) const
+void Frame::paintDragCaret(GraphicsContext* p, const IntRect& rect) const
{
d->m_dragCaret.paintCaret(p, rect);
}
-void Frame::urlSelected(const DeprecatedString& url, const DeprecatedString& target)
+void Frame::urlSelected(const DeprecatedString& url, const String& target)
{
urlSelected(ResourceRequest(completeURL(url)), target);
}
-void Frame::urlSelected(const ResourceRequest& request, const DeprecatedString& _target)
+void Frame::urlSelected(const ResourceRequest& request, const String& _target)
{
- DeprecatedString target = _target;
+ String target = _target;
if (target.isEmpty() && d->m_doc)
target = d->m_doc->baseTarget();
urlSelected(requestCopy);
}
-bool Frame::requestFrame(RenderPart* renderer, const DeprecatedString& _url, const DeprecatedString& frameName)
+bool Frame::requestFrame(RenderPart* renderer, const String& urlParam, const AtomicString& frameName)
{
+ DeprecatedString _url = urlParam.deprecatedString();
// Support for <frame src="javascript:string">
KURL scriptURL;
KURL url;
return true;
}
-bool Frame::requestObject(RenderPart* renderer, const DeprecatedString& url, const DeprecatedString& frameName,
- const DeprecatedString& mimeType, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues)
+bool Frame::requestObject(RenderPart* renderer, const String& url, const AtomicString& frameName,
+ const String& mimeType, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues)
{
KURL completedURL;
if (!url.isEmpty())
- completedURL = completeURL(url);
+ completedURL = completeURL(url.deprecatedString());
if (url.isEmpty() && mimeType.isEmpty())
return true;
return loadSubframe(renderer, completedURL, frameName, d->m_referrer);
}
-bool Frame::shouldUsePlugin(Node* element, const KURL& url, const DeprecatedString& mimeType, bool hasFallback, bool& useFallback)
+bool Frame::shouldUsePlugin(Node* element, const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback)
{
useFallback = false;
ObjectContentType objectType = objectContentType(url, mimeType);
}
-bool Frame::loadPlugin(RenderPart *renderer, const KURL &url, const DeprecatedString &mimeType,
+bool Frame::loadPlugin(RenderPart *renderer, const KURL& url, const String& mimeType,
const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, bool useFallback)
{
if (useFallback) {
return true;
}
-Frame* Frame::loadSubframe(RenderPart* renderer, const KURL& url, const DeprecatedString& name, const String& referrer)
+Frame* Frame::loadSubframe(RenderPart* renderer, const KURL& url, const String& name, const String& referrer)
{
Frame* frame = createFrame(url, name, renderer, referrer);
if (!frame) {
delete form;
}
-void Frame::submitForm(const char *action, const DeprecatedString &url, const FormData &formData, const DeprecatedString &_target, const DeprecatedString& contentType, const DeprecatedString& boundary)
+void Frame::submitForm(const char *action, const String& url, const FormData& formData, const String& _target, const String& contentType, const String& boundary)
{
- KURL u = completeURL( url );
+ KURL u = completeURL(url.deprecatedString());
if (!u.isValid())
// ### ERROR HANDLING!
request.setContentType("Content-Type: " + contentType + "; boundary=" + boundary);
}
- if ( d->m_doc->parsing() || d->m_runningScripts > 0 ) {
- if(d->m_submitForm)
+ if (d->m_doc->parsing() || d->m_runningScripts > 0) {
+ if (d->m_submitForm)
return;
d->m_submitForm = new FramePrivate::SubmitForm;
d->m_submitForm->submitAction = action;
return d->m_referrer;
}
-DeprecatedString Frame::lastModified() const
+String Frame::lastModified() const
{
return d->m_lastModified;
}
-
void Frame::reparseConfiguration()
{
- setAutoloadImages( d->m_settings->autoLoadImages() );
+ setAutoloadImages(d->m_settings->autoLoadImages());
if (d->m_doc)
- d->m_doc->docLoader()->setShowAnimations( d->m_settings->showAnimations() );
+ d->m_doc->docLoader()->setShowAnimations(KHTMLSettings::KAnimationEnabled);
- d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled(d->m_url.host());
- d->m_bJavaEnabled = d->m_settings->isJavaEnabled(d->m_url.host());
- d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled(d->m_url.host());
+ d->m_bJScriptEnabled = d->m_settings->isJavaScriptEnabled();
+ d->m_bJavaEnabled = d->m_settings->isJavaEnabled();
+ d->m_bPluginsEnabled = d->m_settings->isPluginsEnabled();
DeprecatedString userStyleSheet = d->m_settings->userStyleSheet();
- if ( !userStyleSheet.isEmpty() )
- setUserStyleSheet( KURL( userStyleSheet ) );
+ if (!userStyleSheet.isEmpty())
+ setUserStyleSheet(KURL(userStyleSheet));
else
- setUserStyleSheet( DeprecatedString() );
+ setUserStyleSheet(DeprecatedString());
- if(d->m_doc) d->m_doc->updateStyleSelector();
+ if (d->m_doc) d->m_doc->updateStyleSelector();
}
bool Frame::shouldDragAutoNode(Node *node, int x, int y) const
return false;
}
-bool Frame::shouldChangeSelection(const SelectionController &newselection) const
+bool Frame::shouldChangeSelection(const SelectionController& newselection) const
{
return shouldChangeSelection(d->m_selection, newselection, newselection.affinity(), false);
}
EventTargetNodeCast(root)->dispatchEvent(evt, ec, true);
}
-void Frame::appliedEditing(EditCommandPtr &cmd)
+void Frame::appliedEditing(EditCommandPtr& cmd)
{
SelectionController sel(cmd.endingSelection());
if (shouldChangeSelection(sel)) {
respondToChangedContents();
}
-void Frame::unappliedEditing(EditCommandPtr &cmd)
+void Frame::unappliedEditing(EditCommandPtr& cmd)
{
SelectionController sel(cmd.startingSelection());
if (shouldChangeSelection(sel)) {
d->m_lastEditCommand = EditCommandPtr::emptyCommand();
}
-void Frame::reappliedEditing(EditCommandPtr &cmd)
+void Frame::reappliedEditing(EditCommandPtr& cmd)
{
SelectionController sel(cmd.endingSelection());
if (shouldChangeSelection(sel)) {
d->m_typingStyle = 0;
}
-JSValue* Frame::executeScript(const DeprecatedString& filename, int baseLine, Node* n, const DeprecatedString &script)
+JSValue* Frame::executeScript(const String& filename, int baseLine, Node* n, const DeprecatedString& script)
{
// FIXME: This is missing stuff that the other executeScript has.
// --> d->m_runningScripts and submitFormAgain.
}
}
-static void updateState(CSSMutableStyleDeclaration *desiredStyle, CSSComputedStyleDeclaration *computedStyle, bool &atStart, Frame::TriState &state)
+static void updateState(CSSMutableStyleDeclaration *desiredStyle, CSSComputedStyleDeclaration *computedStyle, bool& atStart, Frame::TriState& state)
{
DeprecatedValueListConstIterator<CSSProperty> end;
for (DeprecatedValueListConstIterator<CSSProperty> it = desiredStyle->valuesIterator(); it != end; ++it) {
}
-bool Frame::isCharacterSmartReplaceExempt(const QChar &, bool)
+bool Frame::isCharacterSmartReplaceExempt(const QChar&, bool)
{
// no smart replace
return true;
return body && body->renderer() && body->hasTagName(framesetTag);
}
-bool Frame::openURL(const KURL &URL)
+bool Frame::openURL(const KURL& URL)
{
ASSERT_NOT_REACHED();
return true;
}
-void Frame::didNotOpenURL(const KURL &URL)
+void Frame::didNotOpenURL(const KURL& URL)
{
if (d->m_submittedFormURL == URL)
d->m_submittedFormURL = KURL();
return start ? scanForForm(start) : 0;
}
-void Frame::setEncoding(const DeprecatedString &name, bool userChosen)
+void Frame::setEncoding(const DeprecatedString& name, bool userChosen)
{
if (!d->m_workingURL.isEmpty())
receivedFirstData();
}
}
-void Frame::saveInterpreterBuiltins(SavedBuiltins &interpreterBuiltins)
+void Frame::saveInterpreterBuiltins(SavedBuiltins& interpreterBuiltins)
{
if (jScript())
jScript()->interpreter()->saveBuiltins(interpreterBuiltins);
}
-void Frame::restoreInterpreterBuiltins(const SavedBuiltins &interpreterBuiltins)
+void Frame::restoreInterpreterBuiltins(const SavedBuiltins& interpreterBuiltins)
{
if (jScript())
jScript()->interpreter()->restoreBuiltins(interpreterBuiltins);
node->getDocument()->setFocusNode(0);
}
-DeprecatedPtrList<Frame> &Frame::mutableInstances()
+DeprecatedPtrList<Frame>& Frame::mutableInstances()
{
static DeprecatedPtrList<Frame> instancesList;
return instancesList;
setPolicyBaseURL(d->m_url.url());
}
-void Frame::setPolicyBaseURL(const String &s)
+void Frame::setPolicyBaseURL(const String& s)
{
if (document())
document()->setPolicyBaseURL(s);
return true;
}
-void Frame::addMetaData(const DeprecatedString &key, const DeprecatedString &value)
+void Frame::addMetaData(const String& key, const String& value)
{
d->m_job->addMetaData(key, value);
}
// This does the same kind of work that Frame::openURL does, except it relies on the fact
// that a higher level already checked that the URLs match and the scrolling is the right thing to do.
-void Frame::scrollToAnchor(const KURL &URL)
+void Frame::scrollToAnchor(const KURL& URL)
{
d->m_url = URL;
started();
return styleElement->renderer()->style();
}
-void Frame::setMediaType(const DeprecatedString &type)
+void Frame::setMediaType(const String& type)
{
if (d->m_view)
d->m_view->setMediaType(type);
return d->m_markedTextUnderlines;
}
-unsigned Frame::highlightAllMatchesForString(const DeprecatedString &target, bool caseFlag)
+unsigned Frame::highlightAllMatchesForString(const String& target, bool caseFlag)
{
- if (target.isEmpty()) {
+ if (target.isEmpty())
return 0;
- }
RefPtr<Range> searchRange(rangeOfContents(document()));
FrameTree *Frame::tree() const
{
- return &d->m_treeNode;
+ return& d->m_treeNode;
}
void Frame::detachFromView()
* Boston, MA 02111-1307, USA.
*/
-#ifndef FRAME_H
-#define FRAME_H
+#ifndef Frame_H
+#define Frame_H
#include "BrowserExtension.h"
#include "Color.h"
/**
* Returns a pointer to the @ref BrowserExtension.
*/
- BrowserExtension *browserExtension() const;
+ BrowserExtension* browserExtension() const;
/**
* Returns a pointer to the HTML document's view.
*/
- FrameView *view() const;
+ FrameView* view() const;
virtual void setView(FrameView*);
/**
* Enable/disable the automatic forwarding by <meta http-equiv="refresh" ....>
*/
- void setMetaRefreshEnabled( bool enable );
+ void setMetaRefreshEnabled(bool enable);
/**
* Returns @p true if automtaic forwarding is enabled.
*
* @note Request will be ignored if called before @ref begin().
*/
- void setAutoloadImages( bool enable );
+ void setAutoloadImages(bool enable);
/**
* Returns whether images contained in the document are loaded automatically
* or not.
bool autoloadImages() const;
KURL baseURL() const;
- DeprecatedString baseTarget() const;
+ String baseTarget() const;
/**
* Schedules a redirection after @p delay seconds.
*/
- void scheduleRedirection(double delay, const DeprecatedString &url, bool lockHistory = true);
+ void scheduleRedirection(double delay, const DeprecatedString& url, bool lockHistory = true);
/**
* Make a location change, or schedule one for later.
* These are used for JavaScript-triggered location changes.
*/
- void changeLocation(const DeprecatedString &URL, const DeprecatedString &referrer, bool lockHistory = true, bool userGesture = false);
- void scheduleLocationChange(const DeprecatedString &url, const DeprecatedString &referrer, bool lockHistory = true, bool userGesture = false);
+ void changeLocation(const DeprecatedString& URL, const DeprecatedString& referrer, bool lockHistory = true, bool userGesture = false);
+ void scheduleLocationChange(const DeprecatedString& url, const DeprecatedString& referrer, bool lockHistory = true, bool userGesture = false);
bool isScheduledLocationChangePending() const;
/**
* Schedules a history navigation operation (go forward, go back, etc.).
* This is used for JavaScript-triggered location changes.
*/
- void scheduleHistoryNavigation( int steps );
+ void scheduleHistoryNavigation(int steps);
/**
* Clears the widget and prepares it for new content.
* If you want @ref url() to return
* for example "file:/tmp/test.html", you can use the following code:
* <PRE>
- * view->begin( KURL("file:/tmp/test.html" ) );
+ * view->begin(KURL("file:/tmp/test.html"));
* </PRE>
*
* @param url is the url of the document to be displayed. Even if you
* All child frames and the old document are removed if you call
* this method.
*/
- virtual void begin( const KURL &url = KURL());
+ virtual void begin(const KURL& url = KURL());
/**
* Writes another part of the HTML code to the widget.
* you're using isn't utf-16, you can safely leave out the length
* parameter.
*
- * Attention: Don't mix calls to @ref write( const char *) with calls
- * to @ref write( const DeprecatedString & ).
+ * Attention: Don't mix calls to @ref write(const char*) with calls
+ * to @ref write(const DeprecatedString& ).
*
* The result might not be what you want.
*/
- virtual void write( const char *str, int len = -1 );
+ virtual void write(const char* str, int len = -1);
/**
* Writes another part of the HTML code to the widget.
* this function many times in sequence. But remember: The fewer calls
* you make, the faster the widget will be.
*/
- virtual void write( const DeprecatedString &str );
+ virtual void write(const DeprecatedString& str);
/**
* Call this after your last call to @ref write().
void paint(GraphicsContext*, const IntRect&);
- void setEncoding(const DeprecatedString &encoding, bool userChosen);
+ void setEncoding(const DeprecatedString& encoding, bool userChosen);
/**
* Returns the encoding the page currently uses.
* This gives a wide range of possibilities to
* change the layout of the page.
*/
- void setUserStyleSheet(const KURL &url);
+ void setUserStyleSheet(const KURL& url);
/**
* Sets a user defined style sheet to be used on top of the HTML 4
* This gives a wide range of possibilities to
* change the layout of the page.
*/
- void setUserStyleSheet(const DeprecatedString &styleSheet);
+ void setUserStyleSheet(const DeprecatedString& styleSheet);
/**
* Sets the standard font style.
*
* @param name The font name to use for standard text.
*/
- void setStandardFont( const DeprecatedString &name );
+ void setStandardFont(const String& name);
/**
* Sets the fixed font style.
* @param name The font name to use for fixed text, e.g.
* the <tt><pre></tt> tag.
*/
- void setFixedFont( const DeprecatedString &name );
+ void setFixedFont(const String& name);
/**
* Finds the anchor named @p name.
* scrolls to the closest position. Returns @p if the anchor has
* been found.
*/
- bool gotoAnchor( const DeprecatedString &name );
+ bool gotoAnchor(const String& name);
/**
* Sets the Zoom factor. The value is given in percent, larger values mean a
/**
* Returns the text the user has marked.
*/
- virtual DeprecatedString selectedText() const;
+ virtual String selectedText() const;
/**
* Returns the granularity of the selection (character, word, line, paragraph).
/**
* Returns the drag caret of the HTML.
*/
- const SelectionController &dragCaret() const;
+ const SelectionController& dragCaret() const;
/**
* Sets the current selection.
*/
- void setSelection(const SelectionController &, bool closeTyping = true, bool keepTypingStyle = false);
+ void setSelection(const SelectionController&, bool closeTyping = true, bool keepTypingStyle = false);
/**
* Returns whether selection can be changed.
*/
- bool shouldChangeSelection(const SelectionController &) const;
+ bool shouldChangeSelection(const SelectionController&) const;
/**
* Returns a mark, to be used as emacs uses it.
*/
- const Selection &mark() const;
+ const Selection& mark() const;
/**
* Returns the mark.
*/
- void setMark(const Selection &);
+ void setMark(const Selection&);
/**
* Sets the current drag caret.
*/
- void setDragCaret(const SelectionController &);
+ void setDragCaret(const SelectionController&);
/**
* Transposes characters either side of caret selection.
/**
* Returns whether editing should end in the given range
*/
- virtual bool shouldBeginEditing(const Range *) const;
+ virtual bool shouldBeginEditing(const Range*) const;
/**
* Returns whether editing should end in the given range
*/
- virtual bool shouldEndEditing(const Range *) const;
+ virtual bool shouldEndEditing(const Range*) const;
/**
* Called when editing has begun.
/**
* Called when editing has been applied.
*/
- void appliedEditing(EditCommandPtr &);
+ void appliedEditing(EditCommandPtr&);
/**
* Called when editing has been unapplied.
*/
- void unappliedEditing(EditCommandPtr &);
+ void unappliedEditing(EditCommandPtr&);
/**
* Called when editing has been reapplied.
*/
- void reappliedEditing(EditCommandPtr &);
+ void reappliedEditing(EditCommandPtr&);
/**
* Returns the typing style for the document.
*/
- CSSMutableStyleDeclaration *typingStyle() const;
+ CSSMutableStyleDeclaration* typingStyle() const;
/**
* Sets the typing style for the document.
*/
- void setTypingStyle(CSSMutableStyleDeclaration *);
+ void setTypingStyle(CSSMutableStyleDeclaration*);
/**
* Clears the typing style for the document.
/**
* Last-modified date (in raw string format), if received in the [HTTP] headers.
*/
- DeprecatedString lastModified() const;
+ String lastModified() const;
bool isPointInsideSelection(int x, int y);
void undo();
virtual bool canRedo() const = 0;
virtual bool canUndo() const = 0;
- void computeAndSetTypingStyle(CSSStyleDeclaration *, EditAction editingAction=EditActionUnspecified);
- void applyStyle(CSSStyleDeclaration *, EditAction editingAction=EditActionUnspecified);
- void applyParagraphStyle(CSSStyleDeclaration *, EditAction editingAction=EditActionUnspecified);
- TriState selectionHasStyle(CSSStyleDeclaration *) const;
- bool selectionStartHasStyle(CSSStyleDeclaration *) const;
+ void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
+ void applyStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
+ void applyParagraphStyle(CSSStyleDeclaration* , EditAction editingAction=EditActionUnspecified);
+ TriState selectionHasStyle(CSSStyleDeclaration*) const;
+ bool selectionStartHasStyle(CSSStyleDeclaration*) const;
String selectionStartStylePropertyValue(int stylePropertyID) const;
void applyEditingStyleToBodyElement() const;
void removeEditingStyleFromBodyElement() const;
- void applyEditingStyleToElement(Element *) const;
- void removeEditingStyleFromElement(Element *) const;
+ void applyEditingStyleToElement(Element*) const;
+ void removeEditingStyleFromElement(Element*) const;
virtual void print() = 0;
- virtual bool isCharacterSmartReplaceExempt(const QChar &, bool);
+ virtual bool isCharacterSmartReplaceExempt(const QChar&, bool);
// Used to keep the part alive when running a script that might destroy it.
void keepAlive();
* returns a KURL object for the given url. Use when
* you know what you're doing.
*/
- KURL completeURL( const DeprecatedString &url );
+ KURL completeURL(const DeprecatedString& url);
virtual void handleMouseReleaseDoubleClickEvent(const MouseEventWithHitTestResults&);
virtual void handleMousePressEvent(const MouseEventWithHitTestResults&);
void selectClosestWordFromMouseEvent(const PlatformMouseEvent&, Node* innerNode, int x, int y);
- virtual void urlSelected(const DeprecatedString& url, const DeprecatedString& target);
- virtual void urlSelected(const ResourceRequest&, const DeprecatedString& target);
+ virtual void urlSelected(const DeprecatedString& url, const String& target);
+ virtual void urlSelected(const ResourceRequest&, const String& target);
// Methods with platform-specific overrides (and no base class implementation).
- virtual void setTitle(const String &) = 0;
+ virtual void setTitle(const String&) = 0;
virtual void handledOnloadEvents() = 0;
- virtual DeprecatedString userAgent() const = 0;
- virtual DeprecatedString incomingReferrer() const = 0;
- virtual DeprecatedString mimeTypeForFileName(const DeprecatedString &) const = 0;
- virtual KJS::Bindings::Instance *getEmbedInstanceForWidget(Widget*) = 0;
- virtual KJS::Bindings::Instance *getObjectInstanceForWidget(Widget*) = 0;
- virtual KJS::Bindings::Instance *getAppletInstanceForWidget(Widget*) = 0;
- virtual void markMisspellingsInAdjacentWords(const VisiblePosition &) = 0;
- virtual void markMisspellings(const SelectionController &) = 0;
+ virtual String userAgent() const = 0;
+ virtual String incomingReferrer() const = 0;
+ virtual String mimeTypeForFileName(const String&) const = 0;
+ virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*) = 0;
+ virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*) = 0;
+ virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*) = 0;
+ virtual void markMisspellingsInAdjacentWords(const VisiblePosition&) = 0;
+ virtual void markMisspellings(const SelectionController&) = 0;
virtual void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID) = 0;
virtual void runJavaScriptAlert(const String& message) = 0;
virtual bool runJavaScriptConfirm(const String& message) = 0;
virtual void scheduleClose() = 0;
virtual void unfocusWindow() = 0;
virtual void createEmptyDocument() = 0;
- virtual Range *markedTextRange() const = 0;
- virtual void registerCommandForUndo(const EditCommandPtr &) = 0;
- virtual void registerCommandForRedo(const EditCommandPtr &) = 0;
+ virtual Range* markedTextRange() const = 0;
+ virtual void registerCommandForUndo(const EditCommandPtr&) = 0;
+ virtual void registerCommandForRedo(const EditCommandPtr&) = 0;
virtual void clearUndoRedoOperations() = 0;
virtual void issueUndoCommand() = 0;
virtual void issueRedoCommand() = 0;
virtual void issuePasteCommand() = 0;
virtual void issuePasteAndMatchStyleCommand() = 0;
virtual void issueTransposeCommand() = 0;
- virtual void respondToChangedSelection(const SelectionController &oldSelection, bool closeTyping) = 0;
+ virtual void respondToChangedSelection(const SelectionController& oldSelection, bool closeTyping) = 0;
virtual void respondToChangedContents() = 0;
- virtual bool shouldChangeSelection(const SelectionController &oldSelection, const SelectionController &newSelection, EAffinity affinity, bool stillSelecting) const = 0;
+ virtual bool shouldChangeSelection(const SelectionController& oldSelection, const SelectionController& newSelection, EAffinity affinity, bool stillSelecting) const = 0;
virtual void partClearedInBegin() = 0;
virtual void saveDocumentState() = 0;
virtual void restoreDocumentState() = 0;
virtual void submitForm(const ResourceRequest&) = 0;
virtual void urlSelected(const ResourceRequest&) = 0;
virtual bool passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframePart = 0) = 0;
- virtual bool passWheelEventToChildWidget(Node *) = 0;
+ virtual bool passWheelEventToChildWidget(Node*) = 0;
virtual bool lastEventIsMouseUp() const = 0;
- virtual DeprecatedString overrideMediaType() const = 0;
+ virtual String overrideMediaType() const = 0;
protected:
- virtual Plugin* createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const DeprecatedString& mimeType) = 0;
- virtual Frame* createFrame(const KURL& url, const DeprecatedString& name, RenderPart* renderer, const String& referrer) = 0;
- virtual ObjectContentType objectContentType(const KURL& url, const DeprecatedString& mimeType) = 0;
+ virtual Plugin* createPlugin(const KURL& url, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, const String& mimeType) = 0;
+ virtual Frame* createFrame(const KURL& url, const String& name, RenderPart* renderer, const String& referrer) = 0;
+ virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) = 0;
virtual void redirectionTimerFired(Timer<Frame>*);
void selectionLayoutChanged();
void caretBlinkTimerFired(Timer<Frame>*);
- bool shouldUsePlugin(Node* element, const KURL& url, const DeprecatedString& mimeType, bool hasFallback, bool& useFallback);
- bool loadPlugin(RenderPart* renderer, const KURL &url, const DeprecatedString &mimeType,
+ bool shouldUsePlugin(Node* element, const KURL& url, const String& mimeType, bool hasFallback, bool& useFallback);
+ bool loadPlugin(RenderPart* renderer, const KURL& url, const String& mimeType,
const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues, bool useFallback);
- Frame* loadSubframe(RenderPart* renderer, const KURL& url, const DeprecatedString& name, const String& referrer);
+ Frame* loadSubframe(RenderPart* renderer, const KURL& url, const String& name, const String& referrer);
public:
- void submitForm(const char *action, const DeprecatedString &url, const FormData &formData,
- const DeprecatedString &target, const DeprecatedString& contentType = DeprecatedString::null,
- const DeprecatedString& boundary = DeprecatedString::null );
+ void submitForm(const char* action, const String& url, const FormData& formData,
+ const String& target, const String& contentType = String(),
+ const String& boundary = String());
- bool requestObject(RenderPart *frame, const DeprecatedString &url, const DeprecatedString &frameName,
- const DeprecatedString &serviceType, const DeprecatedStringList ¶mNames, const DeprecatedStringList ¶mValues);
- bool requestFrame(RenderPart *frame, const DeprecatedString &url, const DeprecatedString &frameName);
+ bool requestObject(RenderPart* frame, const String& url, const AtomicString& frameName,
+ const String& serviceType, const DeprecatedStringList& paramNames, const DeprecatedStringList& paramValues);
+ bool requestFrame(RenderPart* frame, const String& url, const AtomicString& frameName);
- Document *document() const;
+ Document* document() const;
void setDocument(Document* newDoc);
// Workaround for the fact that it's hard to delete a frame.
void cancelRedirection(bool newLoadInProgress = false);
public:
- KJS::JSValue* executeScript(const DeprecatedString& filename, int baseLine, Node*, const DeprecatedString& script);
- KJSProxy *jScript();
- Frame *opener();
- void setOpener(Frame *_opener);
+ KJS::JSValue* executeScript(const String& filename, int baseLine, Node*, const DeprecatedString& script);
+ KJSProxy* jScript();
+ Frame* opener();
+ void setOpener(Frame* _opener);
bool openedByJS();
void setOpenedByJS(bool _openedByJS);
- void setSettings(KHTMLSettings *);
+ void setSettings(KHTMLSettings*);
void provisionalLoadStarted();
bool userGestureHint();
- void didNotOpenURL(const KURL &);
- void addData(const char *bytes, int length);
- void addMetaData(const DeprecatedString &key, const DeprecatedString &value);
- void setMediaType(const DeprecatedString &);
+ void didNotOpenURL(const KURL&);
+ void addData(const char* bytes, int length);
+ void addMetaData(const String& key, const String& value);
+ void setMediaType(const String&);
// root renderer for the document contained in this frame
RenderObject* renderer() const;
FloatRect visibleSelectionRect() const;
bool isFrameSet() const;
- HTMLFormElement *currentForm() const;
+ HTMLFormElement* currentForm() const;
- RenderStyle *styleForSelectionStart(Node *&nodeToRemove) const;
+ RenderStyle* styleForSelectionStart(Node* &nodeToRemove) const;
// Scrolls as necessary to reveal the selection
void revealSelection();
bool scrollOverflow(KWQScrollDirection direction, KWQScrollGranularity granularity);
- void adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float bottomLimit);
+ void adjustPageHeight(float* newBottom, float oldTop, float oldBottom, float bottomLimit);
bool canCachePage();
- KJS::PausedTimeouts *pauseTimeouts();
- void resumeTimeouts(KJS::PausedTimeouts *);
- void saveWindowProperties(KJS::SavedProperties *windowProperties);
- void saveLocationProperties(KJS::SavedProperties *locationProperties);
- void restoreWindowProperties(KJS::SavedProperties *windowProperties);
- void restoreLocationProperties(KJS::SavedProperties *locationProperties);
- void saveInterpreterBuiltins(KJS::SavedBuiltins &interpreterBuiltins);
- void restoreInterpreterBuiltins(const KJS::SavedBuiltins &interpreterBuiltins);
+ KJS::PausedTimeouts* pauseTimeouts();
+ void resumeTimeouts(KJS::PausedTimeouts*);
+ void saveWindowProperties(KJS::SavedProperties* windowProperties);
+ void saveLocationProperties(KJS::SavedProperties* locationProperties);
+ void restoreWindowProperties(KJS::SavedProperties* windowProperties);
+ void restoreLocationProperties(KJS::SavedProperties* locationProperties);
+ void saveInterpreterBuiltins(KJS::SavedBuiltins& interpreterBuiltins);
+ void restoreInterpreterBuiltins(const KJS::SavedBuiltins& interpreterBuiltins);
- static Frame *frameForWidget(const Widget *);
- static Node *nodeForWidget(const Widget *);
- static Frame *frameForNode(Node *);
+ static Frame* frameForWidget(const Widget*);
+ static Node* nodeForWidget(const Widget*);
+ static Frame* frameForNode(Node*);
- static void clearDocumentFocus(Widget *);
+ static void clearDocumentFocus(Widget*);
- static const DeprecatedPtrList<Frame> &instances() { return mutableInstances(); }
- static DeprecatedPtrList<Frame> &mutableInstances();
+ static const DeprecatedPtrList<Frame>& instances() { return mutableInstances(); }
+ static DeprecatedPtrList<Frame>& mutableInstances();
void updatePolicyBaseURL();
void setPolicyBaseURL(const String&);
void sendResizeEvent();
void sendScrollEvent();
bool scrollbarsVisible();
- void scrollToAnchor(const KURL &);
+ void scrollToAnchor(const KURL&);
bool canMouseDownStartSelect(Node*);
bool passWidgetMouseDownEventToWidget(const MouseEventWithHitTestResults&, bool isDoubleClick);
bool passWidgetMouseDownEventToWidget(RenderWidget*);
virtual bool passMouseDownEventToWidget(Widget*) = 0;
void clearTimers();
- static void clearTimers(FrameView *);
+ static void clearTimers(FrameView*);
bool displaysWithFocusAttributes() const;
virtual void setDisplaysWithFocusAttributes(bool flag);
DeprecatedValueList<MarkedTextUnderline> markedTextUnderlines() const;
bool markedTextUsesUnderlines() const;
- unsigned highlightAllMatchesForString(const DeprecatedString &, bool caseFlag);
+ unsigned highlightAllMatchesForString(const String&, bool caseFlag);
// Call this method before handling a new user action, like on a mouse down or key down.
// Currently, all this does is clear the "don't submit form twice" data member.
void prepareForUserAction();
- Node *mousePressNode();
+ Node* mousePressNode();
void clearRecordedFormValues();
void recordFormValue(const String& name, const String& value, PassRefPtr<HTMLFormElement>);
bool isComplete() const;
bool isLoadingMainResource() const;
- void replaceContentsWithScriptResult(const KURL &url);
+ void replaceContentsWithScriptResult(const KURL& url);
void disconnectOwnerRenderer();
void handleMousePressEventDoubleClick(const MouseEventWithHitTestResults&);
void handleMousePressEventTripleClick(const MouseEventWithHitTestResults&);
- CSSComputedStyleDeclaration *selectionComputedStyle(Node *&nodeToRemove) const;
+ CSSComputedStyleDeclaration* selectionComputedStyle(Node* &nodeToRemove) const;
virtual void setStatusBarText(const String&);
friend class FrameWin;
void checkEmitLoadEvent();
- bool didOpenURL(const KURL &);
+ bool didOpenURL(const KURL&);
virtual void didFirstLayout() {}
virtual void frameDetached();
String m_kjsStatusBarText;
String m_kjsDefaultStatusBarText;
- DeprecatedString m_lastModified;
+ String m_lastModified;
bool m_bComplete : 1;
bool m_bLoadingMainResource : 1;
struct SubmitForm {
const char* submitAction;
- DeprecatedString submitUrl;
+ String submitUrl;
FormData submitFormData;
- DeprecatedString target;
- DeprecatedString submitContentType;
- DeprecatedString submitBoundary;
+ String target;
+ String submitContentType;
+ String submitBoundary;
};
SubmitForm* m_submitForm;
: m_hasBorder(false)
, layoutTimer(view, &FrameView::layoutTimerFired)
, hoverTimer(view, &FrameView::hoverTimerFired)
+ , m_mediaType("screen")
{
repaintRects = 0;
isTransparent = false;
RefPtr<Node> dragTarget;
RefPtr<HTMLFrameSetElement> resizingFrameSet;
+
+ String m_mediaType;
};
FrameView::FrameView(Frame *frame)
- : _refCount(1)
+ : m_refCount(1)
, m_frame(frame)
, d(new FrameViewPrivate(this))
- , m_medium("screen")
{
init();
{
resetScrollBars();
- ASSERT(_refCount == 0);
+ ASSERT(m_refCount == 0);
if (d->hoverTimer.isActive())
d->hoverTimer.stop();
void FrameView::init()
{
- _marginWidth = -1; // undefined
- _marginHeight = -1;
- _width = 0;
- _height = 0;
+ m_margins = IntSize(-1, -1); // undefined
+ m_size = IntSize();
}
void FrameView::clear()
void FrameView::setMarginWidth(int w)
{
// make it update the rendering area when set
- _marginWidth = w;
+ m_margins.setWidth(w);
}
void FrameView::setMarginHeight(int h)
{
// make it update the rendering area when set
- _marginHeight = h;
+ m_margins.setHeight(h);
}
void FrameView::adjustViewSize()
Document *document = m_frame->document();
RenderCanvas* root = static_cast<RenderCanvas *>(document->renderer());
- if ( !root )
+ if (!root)
return;
int docw = root->docWidth();
d->delayedLayout = false;
if (!m_frame) {
- // FIXME: Do we need to set _width here?
- // FIXME: Should we set _height here too?
- _width = visibleWidth();
+ // FIXME: Do we need to set m_size.width here?
+ // FIXME: Should we set m_size.height here too?
+ m_size.setWidth(visibleWidth());
return;
}
Document* document = m_frame->document();
if (!document) {
- // FIXME: Should we set _height here too?
- _width = visibleWidth();
+ // FIXME: Should we set m_size.height here too?
+ m_size.setWidth(visibleWidth());
return;
}
RenderCanvas* root = static_cast<RenderCanvas*>(document->renderer());
if (!root) {
- // FIXME: Do we need to set _width or _height here?
+ // FIXME: Do we need to set m_size here?
d->layoutSchedulingEnabled = true;
return;
}
suppressScrollBars(false, true);
}
- int oldHeight = _height;
- int oldWidth = _width;
-
- _height = visibleHeight();
- _width = visibleWidth();
+ IntSize oldSize = m_size;
- if (oldHeight != _height || oldWidth != _width)
+ m_size = IntSize(visibleWidth(), visibleHeight());
+
+ if (oldSize != m_size)
d->doFullRepaint = true;
RenderLayer* layer = root->layer();
// if they ever do full repaints.
RenderObject::RepaintInfo* r;
DeprecatedPtrListIterator<RenderObject::RepaintInfo> it(*d->repaintRects);
- for ( ; (r = it.current()); ++it)
+ for (; (r = it.current()); ++it)
r->m_object->repaintRectangle(r->m_repaintRect);
d->repaintRects->clear();
}
#endif
if (root->needsLayout()) {
- //qDebug("needs layout, delaying repaint");
scheduleRelayout();
return;
}
invalidateClick();
}
-bool FrameView::dispatchDragEvent(const AtomicString &eventType, Node *dragTarget, const PlatformMouseEvent& event, Clipboard *clipboard)
+bool FrameView::dispatchDragEvent(const AtomicString& eventType, Node *dragTarget, const PlatformMouseEvent& event, Clipboard* clipboard)
{
int clientX, clientY;
viewportToContents(event.x(), event.y(), clientX, clientY);
return d->underMouse.get();
}
-bool FrameView::scrollTo(const IntRect &bounds)
+bool FrameView::scrollTo(const IntRect& bounds)
{
d->scrollingSelf = true; // so scroll events get ignored
xe = x + curWidth - d->borderX;
// is xpos of target left of the view's border?
- if (x < contentsX() + d->borderX )
+ if (x < contentsX() + d->borderX)
deltax = x - contentsX() - d->borderX;
// is xpos of target right of the view's right border?
else if (xe + d->borderX > contentsX() + curWidth)
- deltax = xe + d->borderX - ( contentsX() + curWidth );
+ deltax = xe + d->borderX - (contentsX() + curWidth);
else
deltax = 0;
deltay = y - contentsY() - d->borderY;
// is ypos of target below lower border?
else if (ye + d->borderY > contentsY() + curHeight)
- deltay = ye + d->borderY - ( contentsY() + curHeight );
+ deltay = ye + d->borderY - (contentsY() + curHeight);
else
deltay = 0;
m_frame->document()->setFocusNode(newFocusNode);
}
-void FrameView::setMediaType( const DeprecatedString &medium )
+void FrameView::setMediaType(const String& mediaType)
{
- m_medium = medium;
+ d->m_mediaType = mediaType;
}
-DeprecatedString FrameView::mediaType() const
+String FrameView::mediaType() const
{
// See if we have an override type.
- DeprecatedString overrideType = m_frame->overrideMediaType();
+ String overrideType = m_frame->overrideMediaType();
if (!overrideType.isNull())
return overrideType;
- return m_medium;
+ return d->m_mediaType;
}
-
void FrameView::useSlowRepaints()
{
d->useSlowRepaints = true;
suppressScrollBars(false);
}
-void FrameView::setResizingFrameSet(HTMLFrameSetElement *frameSet)
+void FrameView::setResizingFrameSet(HTMLFrameSetElement* frameSet)
{
d->resizingFrameSet = frameSet;
}
return swallowEvent;
}
-void FrameView::setIgnoreWheelEvents( bool e )
+void FrameView::setIgnoreWheelEvents(bool e)
{
d->ignoreWheelEvents = e;
}
Boston, MA 02111-1307, USA.
*/
-#ifndef FRAMEVIEW_H
-#define FRAMEVIEW_H
+#ifndef FrameView_H
+#define FrameView_H
-#include "DeprecatedString.h"
#include "ScrollView.h"
+#include "IntSize.h"
+#include "PlatformString.h"
+#include <kxmlcore/RefPtr.h>
class DeprecatedStringList;
class RenderStyle;
class RenderWidget;
class PlatformWheelEvent;
+class String;
template <typename T> class Timer;
Frame* frame() const { return m_frame.get(); }
- int frameWidth() const { return _width; }
-
- void setMarginWidth(int x);
-
- /**
- * Returns the margin width.
- *
- * A return value of -1 means the default value will be used.
- */
- int marginWidth() const { return _marginWidth; }
-
- void setMarginHeight(int y);
+ int frameWidth() const { return m_size.width(); }
/**
- * Returns the margin height.
+ * Gets/Sets the margin width/height
*
* A return value of -1 means the default value will be used.
*/
- int marginHeight() { return _marginHeight; }
+ int marginWidth() const { return m_margins.width(); }
+ int marginHeight() { return m_margins.height(); }
+ void setMarginWidth(int);
+ void setMarginHeight(int);
virtual void setVScrollBarMode(ScrollBarMode);
virtual void setHScrollBarMode(ScrollBarMode);
bool needsFullRepaint() const;
- void addRepaintInfo(RenderObject* o, const IntRect& r);
+ void addRepaintInfo(RenderObject*, const IntRect&);
void resetScrollBars();
- void clear();
+ void clear();
public:
void clearPart();
void updateDashboardRegions();
#endif
- void ref() { ++_refCount; }
- void deref() { if (!--_refCount) delete this; }
+ void ref() { ++m_refCount; }
+ void deref() { if (!--m_refCount) delete this; }
private:
void cleared();
* you only need to enable the media type in the view and if necessary
* add the media type dependent changes to the renderer.
*/
- void setMediaType(const DeprecatedString&);
- DeprecatedString mediaType() const;
+ void setMediaType(const String&);
+ String mediaType() const;
bool scrollTo(const IntRect&);
void restoreScrollBar();
- DeprecatedStringList formCompletionItems(const DeprecatedString &name) const;
- void addFormCompletionItem(const DeprecatedString &name, const DeprecatedString &value);
+ DeprecatedStringList formCompletionItems(const String& name) const;
+ void addFormCompletionItem(const String& name, const String& value);
MouseEventWithHitTestResults prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent&);
void updateBorder();
- unsigned _refCount;
-
- int _width;
- int _height;
-
- int _marginWidth;
- int _marginHeight;
-
+ unsigned m_refCount;
+
+ IntSize m_size;
+ IntSize m_margins;
+
RefPtr<Frame> m_frame;
FrameViewPrivate* d;
-
- DeprecatedString m_medium; // media type
};
}
const KURL& url() const { return m_url; }
void setURL(const KURL& url) { m_url = url; }
- DeprecatedString contentType() const { return m_contentType; }
- void setContentType(const DeprecatedString &t) { m_contentType = t; }
+ String contentType() const { return m_contentType; }
+ void setContentType(const String& t) { m_contentType = t; }
bool doPost() const { return m_doPost; }
void setDoPost(bool post) { m_doPost = post; }
// FIXME: these two parameters are specific to frame opening,
// should move to FrameRequest once we have that
- DeprecatedString frameName;
+ String frameName;
private:
bool m_lockHistory;
private:
KURL m_url;
String m_referrer;
- DeprecatedString m_contentType;
+ String m_contentType;
bool m_doPost;
};
#ifndef FONT_FAMILY_H
#define FONT_FAMILY_H
-#include "DeprecatedString.h"
#include "AtomicString.h"
#if __APPLE__
~Image();
static Image* loadResource(const char *name);
- static bool supportsType(const DeprecatedString& type);
+ static bool supportsType(const String& type);
bool isNull() const;
#include "KURL.h"
#include <kxmlcore/Assertions.h>
+#include "PlatformString.h"
#include "RegularExpression.h"
#include "TextEncoding.h"
#include <kxmlcore/Vector.h>
parse(url.ascii(), &url);
}
+KURL::KURL(const String& stringURL)
+{
+ DeprecatedString url = stringURL.deprecatedString();
+ if (!url.isEmpty() && url[0] == '/') {
+ // 5 for "file:", 1 for terminator
+ Vector<char, 2048> buffer(url.length() + 6);
+ buffer[0] = 'f';
+ buffer[1] = 'i';
+ buffer[2] = 'l';
+ buffer[3] = 'e';
+ buffer[4] = ':';
+ url.copyLatin1(&buffer[5]);
+ parse(buffer, 0);
+ } else
+ parse(url.ascii(), &url);
+}
+
KURL::KURL(const KURL &base, const DeprecatedString &relative, const WebCore::TextEncoding& encoding)
{
// Allow at lest absolute URLs to resolve against an empty URL.
// allocation.
if (originalString && strncmp(buffer, url, fragmentEndPos) == 0) {
urlString = *originalString;
- } else {
+ } else
urlString = DeprecatedString(buffer, fragmentEndPos);
- }
ASSERT(p - buffer <= (int)buffer.size());
}
if (ignoreRef) {
KURL aURL(a);
KURL bURL(b);
- if (aURL.m_isValid && bURL.m_isValid) {
+ if (aURL.m_isValid && bURL.m_isValid)
return aURL.urlString.left(aURL.queryEndPos) == bURL.urlString.left(bURL.queryEndPos);
- }
}
return a == b;
}
*p++ = '%';
*p++ = hexDigits[c >> 4];
*p++ = hexDigits[c & 0xF];
- } else {
+ } else
*p++ = c;
- }
}
DeprecatedString result(buffer, p - buffer);
// For host names bigger than this, we won't do IDN encoding, which is almost certainly OK.
const unsigned hostnameBufferLength = 2048;
- if (s.isAllASCII() || s.length() > hostnameBufferLength) {
+ if (s.isAllASCII() || s.length() > hostnameBufferLength)
return s;
- }
UChar buffer[hostnameBufferLength];
UErrorCode error = U_ZERO_ERROR;
#endif
#endif
+namespace WebCore {
+ class String;
+}
+
class KURL {
public:
KURL();
KURL(const char*);
KURL(const KURL&, const DeprecatedString&, const WebCore::TextEncoding& encoding = WebCore::TextEncoding(WebCore::UTF8Encoding));
KURL(const DeprecatedString&);
+ KURL(const WebCore::String&);
#if __APPLE__
KURL(NSURL*);
#endif
void remove(unsigned pos, int len = 1);
String substring(unsigned pos, unsigned len = UINT_MAX) const;
+ String left(unsigned len) const { return substring(0, len); }
+ String right(unsigned len) const { return substring(length() - len, len); }
// Splits the string into two. The original string gets truncated to pos, and the rest is returned.
String split(unsigned pos);
QChar *unicode() const;
DeprecatedString deprecatedString() const;
- int toInt() const;
+ int toInt(bool* ok = 0) const;
Length* toLengthArray(int& len) const;
Length* toCoordsArray(int& len) const;
bool percentage(int &_percentage) const;
return DeprecatedString(m_impl->s, m_impl->l);
}
-int String::toInt() const
+int String::toInt(bool* ok) const
{
- if (!m_impl)
+ if (!m_impl) {
+ if (ok)
+ *ok = false;
return 0;
- return m_impl->toInt();
+ }
+ return m_impl->toInt(ok);
}
String String::copy() const
// Allow leading spaces.
for (; i != l; ++i) {
- if (!s[i].isSpace()) {
+ if (!s[i].isSpace())
break;
- }
}
// Allow sign.
- if (i != l) {
- if (s[i] == '+' || s[i] == '-') {
- ++i;
- }
- }
+ if (i != l && (s[i] == '+' || s[i] == '-'))
+ ++i;
// Allow digits.
for (; i != l; ++i) {
- if (!s[i].isDigit()) {
+ if (!s[i].isDigit())
break;
- }
}
return QConstString(s, i).string().toInt(ok);
d->status = e;
}
-DeprecatedString TransferJob::errorText() const
-{
- LOG(NotYetImplemented, "not yet implemented");
- return DeprecatedString::null;
-}
-
-DeprecatedString TransferJob::queryMetaData(const DeprecatedString &key) const
+String TransferJob::queryMetaData(const String& key) const
{
if (key == "HTTP-Headers") {
assembleResponseHeaders();
//&