source: webkit/trunk/JavaScriptCore/kjs/interpreter.cpp@ 1024

Last change on this file since 1024 was 1024, checked in by darin, 23 years ago

Merged KDE 3.0 final code in and:

JavaScriptCore:

  • kjs/internal.cpp:
  • kjs/property_map.cpp:
  • kjs/ustring.h: Removed some unneeded <config.h> includes so we are more similar to the real KDE sources.

Merged changes from KDE 3.0 final and did some build fixes.

  • kjs/grammar.*: Regenerated.
  • kjs/*.lut.h: Regenerated.

WebCore:

  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Remove some minor gratuitous diffs vs. KDE.
  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Richard updated to reflect changes in KDE.
  • src/kdelibs/khtml/css/css_valueimpl.cpp: (FontFamilyValueImpl::FontFamilyValueImpl): Fix comment.
  • src/kdelibs/khtml/css/cssstyleselector.cpp: Remove some gratuitous diffs vs. KDE.
  • src/kdelibs/khtml/html/html_objectimpl.cpp: (HTMLEmbedElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
  • src/kdelibs/khtml/html/html_tableimpl.cpp: (HTMLTableElementImpl::parseAttribute), (HTMLTablePartElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
  • src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::processToken): Redo the APPLE_CHANGES ifdef here.
  • src/kdelibs/khtml/khtmlpart_p.h: Update to latest kde.
  • src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::KHTMLView): Add ifdef APPLE_CHANGES. (KHTMLView::~KHTMLView): Add ifdef APPLE_CHANGES. (KHTMLView::print): Remove code left in here during merge process.
  • src/kwq/KWQKHTMLPart.mm: Remove unused setFontSizes(), fontSizes(), and resetFontSizes(). After the merge is landed, remove more.
  • src/libwebcore.exp: Export updateStyleSelector() for WebKit.

Fix text to it displays at the right font size.

  • src/kdelibs/khtml/css/cssstyleselector.cpp: (CSSStyleSelector::computeFontSizes): Apply the same SCREEN_RESOLUTION hack here that we do elsewhere.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::width): Use kMin instead of max (oops). (Font::update): Turn off font database chicanery.
  • src/kwq/KWQKHTMLPart.mm: (KHTMLPart::zoomFactor): Use zoom factor 100, not 1.

More fixes so text displays (still at wrong font size).

  • src/kdelibs/khtml/rendering/font.cpp: (max): New helper. (Font::drawText): Simplified implementation for now. (Font::width): Simplified implementation for now.
  • src/kwq/KWQColorGroup.mm: Reinstated QCOLOR_GROUP_SIZE.
  • src/kwq/qt/qfontmetrics.h: Removed charWidth and changed _width to take QChar *.
  • src/kwq/KWQFontMetrics.mm: Removed charWidth and changed _width to take QChar *.

Merged changes from KDE 3.0 final. Other fixes to get things compiling.

  • src/kdelibs/khtml/css/css_valueimpl.cpp: (CSSStyleDeclarationImpl::setProperty): Fix unused variable.
  • src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::contentsContextMenuEvent): Fix unused variable.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::drawText), (Font::width), (Font::update): Disable special "nsbp" logic for now. We can reenable it if necessary.
  • src/kdelibs/khtml/rendering/render_replaced.cpp: Fix mismerge.
  • src/kdelibs/khtml/rendering/render_text.cpp: (RenderText::nodeAtPoint): Fix unused variable.
  • src/kwq/KWQApplication.mm: (QDesktopWidget::width), (QApplication::desktop): Fix mismerge.
  • src/kwq/KWQColorGroup.mm: Fix QCOLOR_GROUP_SIZE.
  • src/kwq/KWQFontMetrics.mm: (QFontMetrics::lineSpacing): New. (QFontMetrics::width): Remove unused optimization.
  • src/kwq/qt/qfontmetrics.h: Add lineSpacing().

Merged changes from previous merge pass.

2002-03-25 Darin Adler <Darin Adler>

Last bit of making stuff compile and link. Probably will drop the merge now
and take it up again when it's time to merge in KDE 3.0 final.

  • src/kwq/KWQEvent.mm: (QFocusEvent::reason): New.
  • src/kwq/KWQPainter.mm: (QPainter::drawText): New overload.

2002-03-25 Darin Adler <Darin Adler>

  • src/kdelibs/khtml/rendering/font.cpp: (Font::width): Make it call _width so we don't lose the optimization.
  • src/kwq/KWQApplication.mm: (QDesktopWidget::screenNumber): New. (QDesktopWidget::screenGeometry): New. (QApplication::style): New.
  • src/kwq/KWQColorGroup.mm: (QColorGroup::highlight): New. (QColorGroup::highlightedText): New.
  • src/kwq/KWQFont.mm: (QFont::setPixelSize): New.
  • src/kwq/KWQFontMetrics.mm: (QFontMetrics::charWidth): New.
  • src/kwq/KWQKGlobal.mm: (KGlobal::locale): Implement. (KLocale::KLocale): New. (KLocale::languageList): New.
  • src/kwq/KWQKHTMLPart.mm: (KHTMLPart::sheetUsed): New. (KHTMLPart::setSheetUsed): New. (KHTMLPart::zoomFactor): New.
  • src/kwq/KWQKHTMLSettings.mm: (KHTMLSettings::mediumFontSize): New.
  • src/kwq/KWQScrollView.mm: (QScrollView::childX): New. (QScrollView::childY): New.
  • src/kwq/qt/qapplication.h: style() returns a QStyle &.
  • src/kwq/qt/qpalette.h: Add Highlight and HighlightedText.

2002-03-24 Darin Adler <Darin Adler>

More compiling. Still won't link.

  • src/kdelibs/khtml/khtmlview.cpp: Disable printing and drag and drop code.
  • src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration): Temporarily turn off our smarter underlining since it relies on access to the string, and TextSlave doesn't have that any more. (RenderText::nodeAtPoint): Get rid of a workaround we don't need any more for a bug that was fixed by KDE folks.
  • src/kwq/KWQApplication.mm: (QApplication::desktop): Make the desktop be a QDesktopWidget.
  • src/kwq/qt/qnamespace.h: Add MetaButton.
  • src/kwq/qt/qtooltip.h: Add a maybeTip virtual function member and a virtual destructor.

2002-03-24 Darin Adler <Darin Adler>

Some fixes to get more stuff to compile.

  • src/kdelibs/khtml/ecma/kjs_dom.cpp: (DOMDocument::getValueProperty): Don't try to look at the private m_bComplete to display "complete". Just do "loading" and "loaded".
  • src/kdelibs/khtml/khtmlpart_p.h: #ifdef this all out for APPLE_CHANGES.
  • src/kdelibs/khtml/rendering/font.cpp: (Font::update): Add an explicit cast to int to avoid float -> int warning.
  • src/kdelibs/khtml/rendering/render_table.cpp: (RenderTable::calcColMinMax): Add an explicit cast to int to avoid uint compared with int warning.
  • src/kdelibs/khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyleSelector): Use sheetUsed() and setSheetUsed() functions on KHTMLPart intead of getting at private fields the way the real KDE code does.
  • src/kwq/KWQKHTMLPart.h: Declare zoomFactor(), sheetUsed(), and setSheetUsed().
  • src/kwq/KWQStyle.h: Add PM_DefaultFramWidth as another metric.
  • src/kwq/kdecore/klocale.h: Add languageList().
  • src/kwq/khtml/khtml_settings.h: Add mediumFontSize().
  • src/kwq/qt/qapplication.h: Add style() and QDesktopWidget.
  • src/kwq/qt/qevent.h: Add reason().
  • src/kwq/qt/qfont.h: Add setPixelSize(int).
  • src/kwq/qt/qfontmetrics.h: Add charWidth() and _charWidth() functions.
  • src/kwq/qt/qpainter.h: Add drawText() overload with position parameter.
  • src/kwq/qt/qpalette.h: Add highlight() and highlightedText().
  • src/kwq/qt/qscrollview.h: Add childX() and childY().
  • src/kwq/KWQApplication.mm: Change KWQDesktopWidget to QDesktopWidget.

WebKit:

  • WebView.subproj/IFPreferences.h:
  • WebView.subproj/IFPreferences.mm: (+[IFPreferences load]): Remove the old WebKitFontSizes preference. (-[IFPreferences mediumFontSize]), (-[IFPreferences setMediumFontSize:]): New.
  • WebView.subproj/IFWebView.mm: (-[IFWebView reapplyStyles]): Call updateStyleSelector() instead of recalcStyle().

Merged changes from previous merge branch.

2002-03-25 Darin Adler <Darin Adler>

  • WebView.subproj/IFPreferences.mm: (+[IFPreferences load]): Add WebKitMediumFontSizePreferenceKey.

WebBrowser:

  • Preferences.subproj/TextPreferences.m: (-[TextPreferences defaultFontSize]), (-[TextPreferences setDefaultFontSize:]): Just get and set the new mediumFontSize preference rather than doing the whole fontSizes preference dance.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2001 Harri Porten ([email protected])
5 * Copyright (C) 2001 Peter Kelly ([email protected])
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 *
22 */
23
24#include "value.h"
25#include "object.h"
26#include "types.h"
27#include "interpreter.h"
28
29#include <assert.h>
30#include <math.h>
31#include <stdio.h>
32
33#include "internal.h"
34#include "collector.h"
35#include "operations.h"
36#include "error_object.h"
37#include "nodes.h"
38
39using namespace KJS;
40
41// ------------------------------ Context --------------------------------------
42
43Context::Context(ContextImp *c)
44{
45 rep = c;
46}
47
48Context::Context(const Context &c)
49{
50 rep = c.rep;
51}
52
53Context& Context::operator=(const Context &c)
54{
55 rep = c.rep;
56 return *this;
57}
58
59Context::~Context()
60{
61}
62
63bool Context::isNull() const
64{
65 return (rep == 0);
66}
67
68ContextImp *Context::imp() const
69{
70 return rep;
71}
72
73const List Context::scopeChain() const
74{
75 return rep->scopeChain();
76}
77
78Object Context::variableObject() const
79{
80 return rep->variableObject();
81}
82
83Object Context::thisValue() const
84{
85 return rep->thisValue();
86}
87
88const Context Context::callingContext() const
89{
90 return rep->callingContext();
91}
92
93// ------------------------------ Interpreter ----------------------------------
94
95Interpreter::Interpreter(const Object &global) : rep(0)
96{
97 rep = new InterpreterImp(this,global);
98}
99
100Interpreter::Interpreter()
101{
102 Object global(new ObjectImp());
103 rep = new InterpreterImp(this,global);
104}
105
106Interpreter::~Interpreter()
107{
108 delete rep;
109}
110
111Object Interpreter::globalObject() const
112{
113 return rep->globalObject();
114}
115
116void Interpreter::initGlobalObject()
117{
118 rep->initGlobalObject();
119}
120
121ExecState *Interpreter::globalExec()
122{
123 return rep->globalExec();
124}
125
126bool Interpreter::checkSyntax(const UString &code)
127{
128 return rep->checkSyntax(code);
129}
130
131Completion Interpreter::evaluate(const UString &code, const Value &thisV)
132{
133 return rep->evaluate(code,thisV);
134}
135
136InterpreterImp *Interpreter::imp()
137{
138 return rep;
139}
140
141Object Interpreter::builtinObject() const
142{
143 return rep->builtinObject();
144}
145
146Object Interpreter::builtinFunction() const
147{
148 return rep->builtinFunction();
149}
150
151Object Interpreter::builtinArray() const
152{
153 return rep->builtinArray();
154}
155
156Object Interpreter::builtinBoolean() const
157{
158 return rep->builtinBoolean();
159}
160
161Object Interpreter::builtinString() const
162{
163 return rep->builtinString();
164}
165
166Object Interpreter::builtinNumber() const
167{
168 return rep->builtinNumber();
169}
170
171Object Interpreter::builtinDate() const
172{
173 return rep->builtinDate();
174}
175
176Object Interpreter::builtinRegExp() const
177{
178 return rep->builtinRegExp();
179}
180
181Object Interpreter::builtinError() const
182{
183 return rep->builtinError();
184}
185
186Object Interpreter::builtinObjectPrototype() const
187{
188 return rep->builtinObjectPrototype();
189}
190
191Object Interpreter::builtinFunctionPrototype() const
192{
193 return rep->builtinFunctionPrototype();
194}
195
196Object Interpreter::builtinArrayPrototype() const
197{
198 return rep->builtinArrayPrototype();
199}
200
201Object Interpreter::builtinBooleanPrototype() const
202{
203 return rep->builtinBooleanPrototype();
204}
205
206Object Interpreter::builtinStringPrototype() const
207{
208 return rep->builtinStringPrototype();
209}
210
211Object Interpreter::builtinNumberPrototype() const
212{
213 return rep->builtinNumberPrototype();
214}
215
216Object Interpreter::builtinDatePrototype() const
217{
218 return rep->builtinDatePrototype();
219}
220
221Object Interpreter::builtinRegExpPrototype() const
222{
223 return rep->builtinRegExpPrototype();
224}
225
226Object Interpreter::builtinErrorPrototype() const
227{
228 return rep->builtinErrorPrototype();
229}
230
231Object Interpreter::builtinEvalError() const
232{
233 return rep->builtinEvalError();
234}
235
236Object Interpreter::builtinRangeError() const
237{
238 return rep->builtinRangeError();
239}
240
241Object Interpreter::builtinReferenceError() const
242{
243 return rep->builtinReferenceError();
244}
245
246Object Interpreter::builtinSyntaxError() const
247{
248 return rep->builtinSyntaxError();
249}
250
251Object Interpreter::builtinTypeError() const
252{
253 return rep->builtinTypeError();
254}
255
256Object Interpreter::builtinURIError() const
257{
258 return rep->builtinURIError();
259}
260
261Object Interpreter::builtinEvalErrorPrototype() const
262{
263 return rep->builtinEvalErrorPrototype();
264}
265
266Object Interpreter::builtinRangeErrorPrototype() const
267{
268 return rep->builtinRangeErrorPrototype();
269}
270
271Object Interpreter::builtinReferenceErrorPrototype() const
272{
273 return rep->builtinReferenceErrorPrototype();
274}
275
276Object Interpreter::builtinSyntaxErrorPrototype() const
277{
278 return rep->builtinSyntaxErrorPrototype();
279}
280
281Object Interpreter::builtinTypeErrorPrototype() const
282{
283 return rep->builtinTypeErrorPrototype();
284}
285
286Object Interpreter::builtinURIErrorPrototype() const
287{
288 return rep->builtinURIErrorPrototype();
289}
290
291void Interpreter::setCompatMode(CompatMode mode)
292{
293 rep->setCompatMode(mode);
294}
295
296Interpreter::CompatMode Interpreter::compatMode() const
297{
298 return rep->compatMode();
299}
300
301#ifdef KJS_DEBUG_MEM
302void Interpreter::finalCheck()
303{
304 fprintf(stderr,"Interpreter::finalCheck()\n");
305 // Garbage collect - as many times as necessary
306 // (we could delete an object which was holding another object, so
307 // the deref() will happen too late for deleting the impl of the 2nd object).
308 while( Collector::collect() )
309 ;
310
311 fprintf(stderr,"ListImp::count = %d\n", KJS::ListImp::count);
312 Node::finalCheck();
313 Collector::finalCheck();
314}
315#endif
316
317// ------------------------------ ExecState --------------------------------------
318
319namespace KJS {
320 class ExecStateImp
321 {
322 public:
323 ExecStateImp(Interpreter *interp, ContextImp *con)
324 : interpreter(interp), context(con) {};
325 Interpreter *interpreter;
326 ContextImp *context;
327 Value exception;
328 };
329};
330
331ExecState::~ExecState()
332{
333 delete rep;
334}
335
336Interpreter *ExecState::interpreter() const
337{
338 return rep->interpreter;
339}
340
341const Context ExecState::context() const
342{
343 return rep->context;
344}
345
346void ExecState::setException(const Value &e)
347{
348 rep->exception = e;
349}
350
351void ExecState::clearException()
352{
353 rep->exception = Value();
354}
355
356Value ExecState::exception() const
357{
358 return rep->exception;
359}
360
361bool ExecState::hadException() const
362{
363 return !rep->exception.isNull();
364}
365
366ExecState::ExecState(Interpreter *interp, ContextImp *con)
367{
368 rep = new ExecStateImp(interp,con);
369}
370
371void Interpreter::virtual_hook( int, void* )
372{ /*BASE::virtual_hook( id, data );*/ }
Note: See TracBrowser for help on using the repository browser.