This patch makes drawHighlightForText a completely cross-platform method
[WebKit-https.git] / WebCore / ChangeLog
1 2006-05-11  David Hyatt  <hyatt@apple.com>
2
3         This patch makes drawHighlightForText a completely cross-platform method
4         implemented by the GraphicsContext.  The platform-specific implementations
5         of the method in the Font class have been eliminated.
6
7         Reviewed by andersca
8
9         * platform/Font.h:
10         * platform/FontData.h:
11         Remove the drawHighlight methods.  Change the selectionRect method in
12         Font to return a FloatRect so that the GraphicsContext can do an accurate
13         fill.
14
15         * platform/GraphicsContext.cpp:
16         (WebCore::GraphicsContext::drawHighlightForText):
17         Implement the drawHighlightFunction in terms of the cross-platform
18         Font selectionRect functions and a new float-based fillRect graphics context
19         function.
20
21         * platform/GraphicsContext.h:
22         * platform/cairo/GraphicsContextCairo.cpp:
23         (WebCore::GraphicsContext::fillRect):
24         * platform/cg/GraphicsContextCG.cpp:
25         (WebCore::GraphicsContext::fillRect):
26         Add the new float-based fillRect function for Cairo and CG.
27
28         * platform/mac/FontData.mm:
29         (WebCore::CG_draw):
30         (WebCore::ATSU_draw):
31         Removed the CG and ATSU drawHighlight methods.  Remove the drawing of
32         the background from the deprecated draw methods (they'll be removed
33         soon).
34
35         * platform/mac/FontMac.mm:
36         (WebCore::Font::selectionRectForText):
37         * platform/win/FontWin.cpp:
38         (WebCore::Font::selectionRectForText):
39         Change selectionRectForText to return a FloatRect instead of an IntRect,
40         so that the GraphicsContext can do a precise fill.
41
42         * rendering/InlineTextBox.cpp:
43         (WebCore::InlineTextBox::selectionRect):
44         (WebCore::InlineTextBox::positionForOffset):
45         Modify the callers who expect an int-based selection rect so that they call
46         enclosingIntRect.
47
48 2006-05-11  Darin Adler  <darin@apple.com>
49
50         Reviewed by Adele.
51
52         - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8743
53           REGRESSION: focus() on input field selects all text within it
54           (was: cannot select cities on British Rail reservation site)
55
56         Test: fast/forms/double-focus.html
57
58         * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::focus):
59         Changed to only call setFocusNode, select, and revealSelection
60         if the element is not already focused. Also changed to use return
61         a bit more rather than else.
62
63 2006-05-11  Darin Adler  <darin@apple.com>
64
65         Reviewed by Tim Hatcher (earlier version).
66
67         - http://bugzilla.opendarwin.org/show_bug.cgi?id=8821
68           use the preprocessor for IDL files
69
70         * bindings/scripts/IDLParser.pm: Invoke the preprocessor via the "gcc"
71         driver script, passing "-E" so we only preprocess, "-P" so we don't get
72         "#line" directives, and "-x c++" so we handle both C and C++ comments.
73         Removed the code to eliminate comments since the preprocessor handles that.
74         * css/make-css-file-arrays.pl: This already invoked the preprocessor, but
75         updated it to do the same way as above.
76
77 2006-05-11  Anders Carlsson  <acarlsson@apple.com>
78
79         Reviewed by Darin.
80
81         http://bugzilla.opendarwin.org/show_bug.cgi?id=7838
82         Add support for mozilla-style node constructors as properties of the window object
83         
84         * DerivedSources.make:
85         * WebCore.xcodeproj/project.pbxproj:
86         Add new generated files.
87         
88         * bindings/js/JSCanvasRenderingContext2DBase.cpp:
89         (WebCore::JSCanvasRenderingContext2DBaseProtoFunc::callAsFunction):
90         * bindings/js/JSHTMLElementWrapperFactory.cpp:
91         (WebCore::createJSWrapper):
92         Specify the KJS namespace for JSHTMLElmement.
93                 
94         * bindings/js/kjs_dom.cpp:
95         (KJS::toJS):
96         Create a WebCore::JSHTMLDocument for document nodes. Also, create
97         JSDocumentFragments for document fragments (instead of plain node objects).
98         
99         * bindings/js/kjs_html.cpp:
100         (KJS::JSHTMLDocumentProtoFunc::callAsFunction):
101         (KJS::JSHTMLDocument::JSHTMLDocument):
102         (KJS::JSHTMLDocument::getOwnPropertySlot):
103         Add a prototype for JSHTMLDocument and move all functions there.
104         
105         (KJS::JSHTMLElement::JSHTMLElement):
106         (KJS::JSHTMLElement::getOwnPropertySlot):
107         Update since JSHTMLElement now inherits from WebCore::JSHTMLElement.
108         
109         (KJS::JSHTMLElement::getValueProperty):
110         (KJS::JSHTMLElement::putValueProperty):
111         Remove title setter and getter. Those are autogenerated now.
112         
113         * bindings/js/kjs_html.h:
114         (KJS::JSHTMLElement::):
115         Inherit from WebCore::JSHTMLElement. Clarify the inheritance chain.
116         
117         * bindings/scripts/CodeGeneratorJS.pm:
118         Always generate a prototype object, regardless of whether the object has any functions or
119         constants.
120         
121         Use the type of generator attributes to determine what constructor to use. This is useful for
122         the XMLDocument property in DOMWindow.idl, since that's just an alias for the Document constructor.
123         
124         * dom/DocumentFragment.idl: Added.        
125         * html/HTMLDocument.idl: Added.
126         * html/HTMLElement.idl: Added.
127         
128         * page/DOMWindow.idl:
129         Add constructors for DocumentFragment, HTMLElement, HTMLDocument and XMLDocument. XMLDocument is just
130         an alias for the Document constructor.
131         
132 2006-05-11  David Hyatt  <hyatt@apple.com>
133
134         Bug 8845.  Define a TextRun (similar to the old WebCoreTextRun) and
135         make it the new API for Font and GraphicsContext when drawing/measuring
136         text.
137
138         Reviewed by andersca
139
140         * platform/Font.cpp:
141         (WebCore::m_finalRoundingWidth):
142         (WebCore::WidthIterator::advance):
143         (WebCore::WidthIterator::normalizeVoicingMarks):
144         (WebCore::Font::width):
145         (WebCore::Font::canUseGlyphCache):
146         (WebCore::Font::drawSimpleText):
147         (WebCore::Font::drawText):
148         (WebCore::Font::floatWidth):
149         (WebCore::Font::floatWidthForSimpleText):
150         * platform/Font.h:
151         (WebCore::TextRun::m_to):
152         (WebCore::TextRun::operator[]):
153         (WebCore::TextRun::data):
154         (WebCore::TextRun::adjustFrom):
155         (WebCore::TextRun::adjustTo):
156         (WebCore::TextRun::characters):
157         (WebCore::TextRun::length):
158         (WebCore::TextRun::from):
159         (WebCore::TextRun::to):
160         * platform/GraphicsContext.cpp:
161         (WebCore::GraphicsContext::drawText):
162         (WebCore::GraphicsContext::drawHighlightForText):
163         * platform/GraphicsContext.h:
164         * platform/mac/FontMac.mm:
165         (WebCore::addDirectionalOverride):
166         (WebCore::overrideLayoutOperation):
167         (WebCore::ATSULayoutParameters::initialize):
168         (WebCore::Font::selectionRectForText):
169         (WebCore::Font::drawComplexText):
170         (WebCore::Font::drawHighlightForText):
171         (WebCore::Font::floatWidthForComplexText):
172         (WebCore::Font::checkSelectionPoint):
173         * platform/win/FontWin.cpp:
174         (WebCore::hackishExtentForString):
175         (WebCore::Font::floatWidth):
176         (WebCore::Font::drawText):
177         (WebCore::Font::drawHighlightForText):
178         (WebCore::Font::selectionRectForText):
179         (WebCore::Font::checkSelectionPoint):
180         * rendering/InlineTextBox.cpp:
181         (WebCore::InlineTextBox::selectionRect):
182         (WebCore::InlineTextBox::paint):
183         (WebCore::InlineTextBox::paintSelection):
184         (WebCore::InlineTextBox::paintMarkedTextBackground):
185         (WebCore::InlineTextBox::paintTextMatchMarker):
186         (WebCore::InlineTextBox::offsetForPosition):
187         (WebCore::InlineTextBox::positionForOffset):
188         * rendering/RenderBlock.cpp:
189         (WebCore::stripTrailingSpace):
190         * rendering/RenderFlexibleBox.cpp:
191         (WebCore::RenderFlexibleBox::layoutVerticalBox):
192         * rendering/RenderImage.cpp:
193         (WebCore::RenderImage::imageChanged):
194         (WebCore::RenderImage::paint):
195         * rendering/RenderText.cpp:
196         (WebCore::RenderText::cacheWidths):
197         (WebCore::RenderText::widthFromCache):
198         (WebCore::RenderText::trimmedMinMaxWidth):
199         (WebCore::RenderText::calcMinMaxWidth):
200         (WebCore::RenderText::width):
201         * rendering/RenderTextField.cpp:
202         (WebCore::RenderTextField::calcMinMaxWidth):
203         * rendering/bidi.cpp:
204         (WebCore::RenderBlock::tabWidth):
205         (WebCore::RenderBlock::checkLinesForTextOverflow):
206         * rendering/render_line.cpp:
207         (WebCore::EllipsisBox::paint):
208         * rendering/render_list.cpp:
209         (WebCore::RenderListMarker::paint):
210         (WebCore::RenderListMarker::calcMinMaxWidth):
211         (WebCore::RenderListMarker::getRelativeMarkerRect):
212
213 2006-05-10  Justin Garcia  <justin.garcia@apple.com>
214
215         Reviewed by darin
216
217         * editing/ReplaceSelectionCommand.cpp:
218         (WebCore::ReplaceSelectionCommand::doApply):
219         Removed the code to find out if we must later add smart replace whitespace.  We can 
220         wait until we've done the insertion to figure it out, and the position sampled (startPos)
221         to make the decision about trailing whitespace was wrong.
222         Changed the order that work is done during a paste: 1) Insert everything 2) Do one of
223         the following: a) handle a trailing interchange newline, b) uncollapse the last incoming
224         br if it has been collapsed because of quirks mode, c) do an end merge 3) Add smart replace
225         whitespace (2 and 3 were reversed because the end merge must happen before we can know
226         whether or not we need to add a trailing space).
227         Don't do an end merge if the last node inserted was a br because the end merge will 
228         clobber it.
229         
230         (WebCore::ReplaceSelectionCommand::removeEndBRIfNeeded):
231         brs where [br, 0] is at the end of a block and not at the start of the paragraph
232         are the ones that are collapsed because of quirks mode.
233
234 2006-05-10  David Hyatt  <hyatt@apple.com>
235
236         Rename isSpace to treatAsSpace.  Move it and the rounding hack function into
237         Font and make them static methods (inlined in the header).  Make the rounding
238         hack character table a static member as well.  Remove the redundant space/rounding
239         functions from FontData.mm.
240
241         Reviewed by darin
242
243         * platform/Font.cpp:
244         (WebCore::):
245         (WebCore::m_finalRoundingWidth):
246         (WebCore::WidthIterator::advance):
247         * platform/Font.h:
248         (WebCore::Font::treatAsSpace):
249         (WebCore::Font::isRoundingHackCharacter):
250         * platform/mac/FontData.mm:
251         (WebCore::overrideLayoutOperation):
252         (WebCore::createATSULayoutParameters):
253         (WebCore::initializeWidthIterator):
254         (WebCore::advanceWidthIterator):
255         * platform/mac/FontMac.mm:
256         (WebCore::overrideLayoutOperation):
257         (WebCore::ATSULayoutParameters::initialize):
258
259 2006-05-10  Darin Adler  <darin@apple.com>
260
261         * WebCore: Removed an extra WebCore subtree that somehow got checked in.
262
263 >>>>>>> .r14297
264 2006-05-10  David Carson <dacarson@gmail.com>
265
266         - Fix for bug 8833. Removed inline keyword from functions declared
267         in .mm and .cpp files. inline function code needs to reside in the
268         header file for the linker to find the code. 
269         http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.7
270
271         Reviewed by Darin, landed by Timothy.
272
273         * platform/Font.cpp:
274         (WebCore::isSpace):
275         * platform/mac/FontData.mm:
276         (WebCore::widthForGlyph):
277         (WebCore::isRoundingHackCharacter):
278         (WebCore::glyphForCharacter):
279
280 2006-05-10  Mitz Pettel  <opendarwin.org@mitzpettel.com>
281
282         Reviewed and landed by Anders.
283
284         - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8830
285           REGRESSION: Words render on top of each other when fallback font is used
286
287         Already covered by several pixel tests in fast/text
288
289         * platform/Font.cpp:
290         (WebCore::Font::drawSimpleText):
291
292 2006-05-10  David Hyatt  <hyatt@apple.com>
293
294         Fix for bug 8809, lift the Mac-specific WebTextRenderer code for
295         drawing and measuring of runs up into the Font class.  The fast code
296         path is in Font.cpp and is designed to be mostly cross-platform.  The
297         slow code path is in FontMac.cpp and is Mac-specific.
298
299         Reviewed by darin
300
301         * WebCore.xcodeproj/project.pbxproj:
302         * platform/Font.cpp:
303         (WebCore::isSpace):
304         (WebCore::):
305         (WebCore::isRoundingHackCharacter):
306         (WebCore::m_finalRoundingWidth):
307         (WebCore::WidthIterator::advance):
308         (WebCore::WidthIterator::normalizeVoicingMarks):
309         (WebCore::Font::primaryFont):
310         (WebCore::Font::setAlwaysUseComplexPath):
311         (WebCore::Font::canUseGlyphCache):
312         (WebCore::Font::drawSimpleText):
313         (WebCore::Font::drawText):
314         (WebCore::Font::floatWidth):
315         (WebCore::Font::floatWidthForSimpleText):
316         * platform/Font.h:
317         * platform/FontData.h:
318         (WebCore::FontData::platformData):
319         * platform/GlyphBuffer.h: Added.
320         (WebCore::GlyphBuffer::GlyphBuffer):
321         (WebCore::GlyphBuffer::isEmpty):
322         (WebCore::GlyphBuffer::size):
323         (WebCore::GlyphBuffer::glyphs):
324         (WebCore::GlyphBuffer::advances):
325         (WebCore::GlyphBuffer::fontDataAt):
326         (WebCore::GlyphBuffer::swap):
327         (WebCore::GlyphBuffer::glyphAt):
328         (WebCore::GlyphBuffer::advanceAt):
329         (WebCore::GlyphBuffer::add):
330         * platform/mac/FontData.mm:
331         (WebCore::isSpace):
332         (WebCore::isRoundingHackCharacter):
333         (WebCore::FontData::widthForGlyph):
334         (WebCore::m_ATSUMirrors):
335         (WebCore::FontData::xHeight):
336         (WebCore::FontData::smallCapsFontData):
337         (WebCore::findSubstituteFont):
338         (WebCore::rendererForAlternateFont):
339         (WebCore::findSubstituteRenderer):
340         (WebCore::FontData::findSubstituteFontData):
341         (WebCore::computeWidthForSpace):
342         (WebCore::FontData::updateGlyphMapEntry):
343         (WebCore::extendGlyphMap):
344         (WebCore::extendWidthMap):
345         (WebCore::createATSULayoutParameters):
346         (WebCore::FontData::glyphForCharacter):
347         (WebCore::advanceWidthIterator):
348         (WebCore::shouldUseATSU):
349         * platform/mac/FontMac.mm:
350         (WebCore::ATSULayoutParameters::m_padPerSpace):
351         (WebCore::addDirectionalOverride):
352         (WebCore::initializeATSUStyle):
353         (WebCore::overrideLayoutOperation):
354         (WebCore::ATSULayoutParameters::initialize):
355         (WebCore::disposeATSULayoutParameters):
356         (WebCore::Font::drawComplexText):
357         (WebCore::Font::floatWidthForComplexText):
358         (WebCore::Font::drawGlyphs):
359         * platform/mac/WebCoreTextRenderer.mm:
360         (WebCoreSetAlwaysUseATSU):
361
362 2006-05-10  Darin Adler  <darin@apple.com>
363
364         - another try at fixing the Windows build
365
366         * platform/win/FontWin.cpp: (WebCore::getFontData): Use characters()
367         instead of unicode().
368
369 == Rolled over to ChangeLog-2006-05-10 ==