[webkit-changes] cvs commit: WebCore/kwq KWQKHTMLPart.mm
KWQPainter.mm WebCoreBridge.h WebCoreBridge.mm
David
hyatt at opensource.apple.com
Tue Aug 9 16:52:21 PDT 2005
hyatt 05/08/09 16:52:21
Modified: . Tag: Safari-2-0-branch ChangeLog
khtml Tag: Safari-2-0-branch khtml_part.cpp khtml_part.h
khtmlpart_p.h khtmlview.cpp khtmlview.h
khtml/css Tag: Safari-2-0-branch html4.css
khtml/html Tag: Safari-2-0-branch dtd.cpp dtd.h
html_headimpl.cpp html_headimpl.h
html_objectimpl.cpp html_objectimpl.h
htmlparser.cpp htmltokenizer.cpp
khtml/rendering Tag: Safari-2-0-branch render_block.cpp
render_block.h render_box.cpp render_box.h
render_frames.cpp render_frames.h
render_replaced.cpp render_table.cpp
khtml/xml Tag: Safari-2-0-branch dom_elementimpl.cpp
kwq Tag: Safari-2-0-branch KWQKHTMLPart.mm
KWQPainter.mm WebCoreBridge.h WebCoreBridge.mm
Log:
Land all the necessary changes to pass Acid2.
* khtml/css/html4.css:
* khtml/html/dtd.cpp:
(DOM::checkChild):
* khtml/html/dtd.h:
* khtml/html/html_headimpl.cpp:
(HTMLLinkElementImpl::HTMLLinkElementImpl):
(HTMLLinkElementImpl::parseHTMLAttribute):
(HTMLLinkElementImpl::tokenizeRelAttribute):
(HTMLLinkElementImpl::process):
* khtml/html/html_headimpl.h:
* khtml/html/html_objectimpl.cpp:
(HTMLObjectElementImpl::HTMLObjectElementImpl):
(HTMLObjectElementImpl::parseHTMLAttribute):
(HTMLObjectElementImpl::rendererIsNeeded):
(HTMLObjectElementImpl::createRenderer):
(HTMLObjectElementImpl::attach):
(HTMLObjectElementImpl::detach):
(HTMLObjectElementImpl::recalcStyle):
(HTMLObjectElementImpl::childrenChanged):
(HTMLObjectElementImpl::isImageType):
(HTMLObjectElementImpl::renderFallbackContent):
* khtml/html/html_objectimpl.h:
* khtml/html/htmlparser.cpp:
(KHTMLParser::insertNode):
* khtml/html/htmltokenizer.cpp:
(khtml::HTMLTokenizer::parseComment):
* khtml/khtml_part.cpp:
(KHTMLPart::requestObject):
(KHTMLPart::processObjectRequest):
(KHTMLPart::handleFallbackContent):
* khtml/khtml_part.h:
* khtml/khtmlpart_p.h:
(khtml::ChildFrame::ChildFrame):
* khtml/khtmlview.cpp:
(KHTMLView::applyOverflowToViewport):
(KHTMLView::layout):
* khtml/khtmlview.h:
* khtml/rendering/render_block.cpp:
(khtml::RenderBlock::isSelfCollapsingBlock):
(khtml::RenderBlock::layoutBlock):
* khtml/rendering/render_block.h:
(khtml::RenderBlock::firstRootBox):
(khtml::RenderBlock::lastRootBox):
* khtml/rendering/render_box.cpp:
(RenderBox::setStyle):
(RenderBox::calcHeight):
(RenderBox::calcHeightUsing):
(RenderBox::calcAbsoluteHorizontal):
(RenderBox::calcAbsoluteHorizontalValues):
(RenderBox::calcAbsoluteVertical):
(RenderBox::calcAbsoluteVerticalValues):
* khtml/rendering/render_box.h:
* khtml/rendering/render_frames.cpp:
(RenderPartObject::RenderPartObject):
(RenderPartObject::updateWidget):
* khtml/rendering/render_frames.h:
(khtml::RenderPart::hasFallbackContent):
* khtml/rendering/render_replaced.cpp:
(RenderReplaced::RenderReplaced):
* khtml/rendering/render_table.cpp:
(RenderTable::layout):
(RenderTableSection::calcRowHeight):
(RenderTableCell::baselinePosition):
* khtml/xml/dom_elementimpl.cpp:
(ElementImpl::childAllowed):
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::createPart):
* kwq/KWQPainter.mm:
(QPainter::_drawPoints):
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge mainResourceError]):
Revision Changes Path
No revision
No revision
1.4104.2.105 +77 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4104.2.104
retrieving revision 1.4104.2.105
diff -u -r1.4104.2.104 -r1.4104.2.105
--- ChangeLog 9 Aug 2005 21:55:50 -0000 1.4104.2.104
+++ ChangeLog 9 Aug 2005 23:52:03 -0000 1.4104.2.105
@@ -1,3 +1,80 @@
+2005-08-09 David Hyatt <hyatt at apple.com>
+
+ Land all the necessary changes to pass Acid2.
+
+ * khtml/css/html4.css:
+ * khtml/html/dtd.cpp:
+ (DOM::checkChild):
+ * khtml/html/dtd.h:
+ * khtml/html/html_headimpl.cpp:
+ (HTMLLinkElementImpl::HTMLLinkElementImpl):
+ (HTMLLinkElementImpl::parseHTMLAttribute):
+ (HTMLLinkElementImpl::tokenizeRelAttribute):
+ (HTMLLinkElementImpl::process):
+ * khtml/html/html_headimpl.h:
+ * khtml/html/html_objectimpl.cpp:
+ (HTMLObjectElementImpl::HTMLObjectElementImpl):
+ (HTMLObjectElementImpl::parseHTMLAttribute):
+ (HTMLObjectElementImpl::rendererIsNeeded):
+ (HTMLObjectElementImpl::createRenderer):
+ (HTMLObjectElementImpl::attach):
+ (HTMLObjectElementImpl::detach):
+ (HTMLObjectElementImpl::recalcStyle):
+ (HTMLObjectElementImpl::childrenChanged):
+ (HTMLObjectElementImpl::isImageType):
+ (HTMLObjectElementImpl::renderFallbackContent):
+ * khtml/html/html_objectimpl.h:
+ * khtml/html/htmlparser.cpp:
+ (KHTMLParser::insertNode):
+ * khtml/html/htmltokenizer.cpp:
+ (khtml::HTMLTokenizer::parseComment):
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::requestObject):
+ (KHTMLPart::processObjectRequest):
+ (KHTMLPart::handleFallbackContent):
+ * khtml/khtml_part.h:
+ * khtml/khtmlpart_p.h:
+ (khtml::ChildFrame::ChildFrame):
+ * khtml/khtmlview.cpp:
+ (KHTMLView::applyOverflowToViewport):
+ (KHTMLView::layout):
+ * khtml/khtmlview.h:
+ * khtml/rendering/render_block.cpp:
+ (khtml::RenderBlock::isSelfCollapsingBlock):
+ (khtml::RenderBlock::layoutBlock):
+ * khtml/rendering/render_block.h:
+ (khtml::RenderBlock::firstRootBox):
+ (khtml::RenderBlock::lastRootBox):
+ * khtml/rendering/render_box.cpp:
+ (RenderBox::setStyle):
+ (RenderBox::calcHeight):
+ (RenderBox::calcHeightUsing):
+ (RenderBox::calcAbsoluteHorizontal):
+ (RenderBox::calcAbsoluteHorizontalValues):
+ (RenderBox::calcAbsoluteVertical):
+ (RenderBox::calcAbsoluteVerticalValues):
+ * khtml/rendering/render_box.h:
+ * khtml/rendering/render_frames.cpp:
+ (RenderPartObject::RenderPartObject):
+ (RenderPartObject::updateWidget):
+ * khtml/rendering/render_frames.h:
+ (khtml::RenderPart::hasFallbackContent):
+ * khtml/rendering/render_replaced.cpp:
+ (RenderReplaced::RenderReplaced):
+ * khtml/rendering/render_table.cpp:
+ (RenderTable::layout):
+ (RenderTableSection::calcRowHeight):
+ (RenderTableCell::baselinePosition):
+ * khtml/xml/dom_elementimpl.cpp:
+ (ElementImpl::childAllowed):
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::createPart):
+ * kwq/KWQPainter.mm:
+ (QPainter::_drawPoints):
+ * kwq/WebCoreBridge.h:
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge mainResourceError]):
+
2005-08-09 Adele Peterson <adele at apple.com>
Merged fix from TOT to Safari-2-0-branch
No revision
No revision
1.311.8.12 +20 -6 WebCore/khtml/khtml_part.cpp
Index: khtml_part.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.311.8.11
retrieving revision 1.311.8.12
diff -u -r1.311.8.11 -r1.311.8.12
--- khtml_part.cpp 3 Aug 2005 00:02:28 -0000 1.311.8.11
+++ khtml_part.cpp 9 Aug 2005 23:52:10 -0000 1.311.8.12
@@ -52,6 +52,7 @@
#include "html/html_baseimpl.h"
#include "html/html_miscimpl.h"
#include "html/html_imageimpl.h"
+#include "html/html_objectimpl.h"
#include "rendering/render_block.h"
#include "rendering/render_text.h"
#include "rendering/render_frames.h"
@@ -3188,6 +3189,7 @@
(*it).m_type = khtml::ChildFrame::Object;
(*it).m_paramNames = paramNames;
(*it).m_paramValues = paramValues;
+ (*it).m_hasFallbackContent = frame->hasFallbackContent();
KURL completedURL;
if (!url.isEmpty())
@@ -3302,12 +3304,7 @@
KParts::ReadOnlyPart *part = createPart( d->m_view->viewport(), child->m_name.ascii(), this, child->m_name.ascii(), mimetype, child->m_serviceName, child->m_services, child->m_params );
#endif
- if ( !part )
- {
- if ( child->m_frame )
- if (child->m_frame->partLoadingErrorNotify( child, url, mimetype ))
- return true; // we succeeded after all (a fallback was used)
-
+ if (!part) {
checkEmitLoadEvent();
return false;
}
@@ -5937,5 +5934,22 @@
parent->setSelection(Selection(beforeOwnerElement, afterOwnerElement));
}
+void KHTMLPart::handleFallbackContent()
+{
+ KHTMLPart *parent = parentPart();
+ if (!parent)
+ return;
+ ChildFrame *childFrame = parent->childFrame(this);
+ if (!childFrame || childFrame->m_type != ChildFrame::Object)
+ return;
+ khtml::RenderPart *renderPart = childFrame->m_frame;
+ if (!renderPart)
+ return;
+ HTMLObjectElementImpl* elt = static_cast<HTMLObjectElementImpl *>(renderPart->element());
+ if (!elt)
+ return;
+ elt->renderFallbackContent();
+}
+
using namespace KParts;
#include "khtml_part.moc"
1.127.8.4 +2 -0 WebCore/khtml/khtml_part.h
Index: khtml_part.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.h,v
retrieving revision 1.127.8.3
retrieving revision 1.127.8.4
diff -u -r1.127.8.3 -r1.127.8.4
--- khtml_part.h 26 Jul 2005 21:14:22 -0000 1.127.8.3
+++ khtml_part.h 9 Aug 2005 23:52:11 -0000 1.127.8.4
@@ -1302,6 +1302,8 @@
// Call this after doing user-triggered selections to make it easy to delete the frame you entirely selected.
void selectFrameElementInParentIfFullySelected();
+ void handleFallbackContent();
+
private:
khtml::ChildFrame *childFrame( const QObject *obj );
1.52.8.2 +2 -1 WebCore/khtml/khtmlpart_p.h
Index: khtmlpart_p.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtmlpart_p.h,v
retrieving revision 1.52.8.1
retrieving revision 1.52.8.2
diff -u -r1.52.8.1 -r1.52.8.2
--- khtmlpart_p.h 2 Jul 2005 01:32:55 -0000 1.52.8.1
+++ khtmlpart_p.h 9 Aug 2005 23:52:11 -0000 1.52.8.2
@@ -61,7 +61,7 @@
{
enum Type { Frame, IFrame, Object };
- ChildFrame() { m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; }
+ ChildFrame() { m_bCompleted = false; m_bPreloaded = false; m_type = Frame; m_bNotify = false; m_hasFallbackContent = false; }
#if !APPLE_CHANGES
~ChildFrame() { if (m_run) m_run->abort(); }
@@ -85,6 +85,7 @@
QStringList m_paramNames;
QStringList m_paramValues;
bool m_bNotify;
+ bool m_hasFallbackContent;
};
}
1.128.8.3 +11 -7 WebCore/khtml/khtmlview.cpp
Index: khtmlview.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtmlview.cpp,v
retrieving revision 1.128.8.2
retrieving revision 1.128.8.3
diff -u -r1.128.8.2 -r1.128.8.3
--- khtmlview.cpp 9 Aug 2005 01:20:34 -0000 1.128.8.2
+++ khtmlview.cpp 9 Aug 2005 23:52:11 -0000 1.128.8.3
@@ -518,13 +518,12 @@
}
}
-void KHTMLView::applyBodyScrollQuirk(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode)
+void KHTMLView::applyOverflowToViewport(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode)
{
- // Handle the overflow:hidden/scroll quirk for the body elements. WinIE treats
+ // Handle the overflow:hidden/scroll case for the body/html elements. WinIE treats
// overflow:hidden and overflow:scroll on <body> as applying to the document's
- // scrollbars. The CSS2.1 draft has even added a sentence, "HTML UAs may apply overflow
- // specified on the body or HTML elements to the viewport." Since WinIE and Mozilla both
- // do it, we will do it too for <body> elements.
+ // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
+ // use the root element.
switch(o->style()->overflow()) {
case OHIDDEN:
hMode = vMode = AlwaysOff;
@@ -604,6 +603,7 @@
ScrollBarMode hMode = d->hmode;
ScrollBarMode vMode = d->vmode;
+ RenderObject* rootRenderer = document->documentElement()->renderer();
if (document->isHTMLDocument()) {
NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
if (body && body->renderer()) {
@@ -612,10 +612,14 @@
vMode = AlwaysOff;
hMode = AlwaysOff;
}
- else if (body->id() == ID_BODY)
- applyBodyScrollQuirk(body->renderer(), hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
+ else if (body->id() == ID_BODY) {
+ RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer;
+ applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
+ }
}
}
+ else
+ applyOverflowToViewport(rootRenderer, hMode, vMode); // XML/XHTML UAs use the root element.
#ifdef INSTRUMENT_LAYOUT_SCHEDULING
if (d->firstLayout && !document->ownerElement())
1.45.8.1 +1 -1 WebCore/khtml/khtmlview.h
Index: khtmlview.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtmlview.h,v
retrieving revision 1.45
retrieving revision 1.45.8.1
diff -u -r1.45 -r1.45.8.1
--- khtmlview.h 14 Dec 2004 00:10:07 -0000 1.45
+++ khtmlview.h 9 Aug 2005 23:52:11 -0000 1.45.8.1
@@ -288,7 +288,7 @@
int mouseEventType);
bool dispatchDragEvent(int eventId, DOM::NodeImpl *dragTarget, const QPoint &loc, DOM::ClipboardImpl *clipboard);
- void applyBodyScrollQuirk(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
+ void applyOverflowToViewport(khtml::RenderObject* o, ScrollBarMode& hMode, ScrollBarMode& vMode);
#if APPLE_CHANGES
virtual bool isKHTMLView() const;
No revision
No revision
1.68.10.1 +0 -5 WebCore/khtml/css/html4.css
Index: html4.css
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/html4.css,v
retrieving revision 1.68
retrieving revision 1.68.10.1
diff -u -r1.68 -r1.68.10.1
--- html4.css 1 Nov 2004 19:21:24 -0000 1.68
+++ html4.css 9 Aug 2005 23:52:12 -0000 1.68.10.1
@@ -87,11 +87,6 @@
/* FIXME: content: close-quote; */
}
-iframe, embed, object {
- width: 300px;
- height: 150px
-}
-
center {
display: block;
/* special centering to be able to emulate the html4/netscape behaviour */
No revision
No revision
1.37.6.1 +2 -2 WebCore/khtml/html/Attic/dtd.cpp
Index: dtd.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/Attic/dtd.cpp,v
retrieving revision 1.37
retrieving revision 1.37.6.1
diff -u -r1.37 -r1.37.6.1
--- dtd.cpp 19 Feb 2005 01:13:01 -0000 1.37
+++ dtd.cpp 9 Aug 2005 23:52:13 -0000 1.37.6.1
@@ -553,7 +553,7 @@
}
-bool DOM::checkChild(ushort tagID, ushort childID)
+bool DOM::checkChild(ushort tagID, ushort childID, bool strict)
{
//kdDebug( 6030 ) << "checkChild: " << tagID << "/" << childID << endl;
@@ -597,7 +597,7 @@
return check_array(childID, tag_list_1);
case ID_P:
// P: ( _0 | TABLE ) *
- return check_array(childID, tag_list_0) || childID == ID_TABLE;
+ return check_array(childID, tag_list_0) || (!strict && childID == ID_TABLE);
case ID_H1:
case ID_H2:
case ID_H3:
1.4.6.1 +1 -1 WebCore/khtml/html/Attic/dtd.h
Index: dtd.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/Attic/dtd.h,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -r1.4 -r1.4.6.1
--- dtd.h 19 Feb 2005 01:13:01 -0000 1.4
+++ dtd.h 9 Aug 2005 23:52:13 -0000 1.4.6.1
@@ -33,7 +33,7 @@
enum tagStatus { OPTIONAL, REQUIRED, FORBIDDEN };
-bool checkChild(ushort tagID, ushort childID);
+bool checkChild(ushort tagID, ushort childID, bool strict);
extern const unsigned short tagPriorityArray[];
extern const tagStatus endTagArray[];
1.43.16.3 +36 -20 WebCore/khtml/html/html_headimpl.cpp
Index: html_headimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.cpp,v
retrieving revision 1.43.16.2
retrieving revision 1.43.16.3
diff -u -r1.43.16.2 -r1.43.16.3
--- html_headimpl.cpp 12 Jul 2005 18:29:04 -0000 1.43.16.2
+++ html_headimpl.cpp 9 Aug 2005 23:52:13 -0000 1.43.16.3
@@ -114,7 +114,7 @@
m_sheet = 0;
m_loading = false;
m_cachedSheet = 0;
- m_alternate = false;
+ m_isStyleSheet = m_isIcon = m_alternate = false;
m_disabledState = 0;
}
@@ -172,7 +172,7 @@
switch (attr->id())
{
case ATTR_REL:
- m_rel = attr->value();
+ tokenizeRelAttribute(attr->value());
process();
break;
case ATTR_HREF:
@@ -195,43 +195,59 @@
}
}
+void HTMLLinkElementImpl::tokenizeRelAttribute(const AtomicString& relStr)
+{
+ m_isStyleSheet = m_isIcon = m_alternate = false;
+ QString rel = relStr.string().lower();
+ if (rel == "stylesheet")
+ m_isStyleSheet = true;
+ else if (rel == "icon" || rel == "shortcut icon")
+ m_isIcon = true;
+ else if (rel == "alternate stylesheet" || rel == "stylesheet alternate")
+ m_isStyleSheet = m_alternate = true;
+ else {
+ // Tokenize the rel attribute and set bits based on specific keywords that we find.
+ rel.replace('\n', ' ');
+ QStringList list = QStringList::split(' ', rel);
+ for (QStringList::Iterator i = list.begin(); i != list.end(); ++i) {
+ if (*i == "stylesheet")
+ m_isStyleSheet = true;
+ else if (*i == "alternate")
+ m_alternate = true;
+ else if (*i == "icon")
+ m_isIcon = true;
+ }
+ }
+}
+
void HTMLLinkElementImpl::process()
{
if (!inDocument())
return;
QString type = m_type.string().lower();
- QString rel = m_rel.string().lower();
-
+
KHTMLPart* part = getDocument()->part();
// IE extension: location of small icon for locationbar / bookmarks
-#if APPLE_CHANGES
- if ( part && rel == "shortcut icon" && !m_url.isEmpty() && !part->parentPart())
- part->browserExtension()->setIconURL( KURL(m_url.string()) );
-
- // Mozilla extension to IE extension: icon specified with type
- if ( part && rel == "icon" && !m_url.isEmpty() && !part->parentPart())
- part->browserExtension()->setTypedIconURL( KURL(m_url.string()), type );
-#else
- // Uses both "shortcut icon" and "icon"
-
- if ( part && rel.contains("icon") && !m_url.isEmpty() && !part->parentPart())
- part->browserExtension()->setIconURL( KURL(m_url.string()) );
-#endif
+ if (part && m_isIcon && !m_url.isEmpty() && !part->parentPart()) {
+ if (!type.isEmpty()) // Mozilla extension to IE extension: icon specified with type
+ part->browserExtension()->setTypedIconURL(KURL(m_url.string()), type);
+ else
+ part->browserExtension()->setIconURL(KURL(m_url.string()));
+ }
// Stylesheet
// This was buggy and would incorrectly match <link rel="alternate">, which has a different specified meaning. -dwh
- if(m_disabledState != 2 && (type.contains("text/css") || rel == "stylesheet" || (rel.contains("alternate") && rel.contains("stylesheet"))) && getDocument()->part()) {
+ if (m_disabledState != 2 && (type.contains("text/css") || m_isStyleSheet) && getDocument()->part()) {
// no need to load style sheets which aren't for the screen output
// ### there may be in some situations e.g. for an editor or script to manipulate
// also, don't load style sheets for standalone documents
- if( m_media.isNull() || m_media.contains("screen") || m_media.contains("all") || m_media.contains("print") ) {
+ if (m_media.isNull() || m_media.contains("screen") || m_media.contains("all") || m_media.contains("print")) {
m_loading = true;
// Add ourselves as a pending sheet, but only if we aren't an alternate
// stylesheet. Alternate stylesheets don't hold up render tree construction.
- m_alternate = rel.contains("alternate");
if (!isAlternate())
getDocument()->addPendingSheet();
1.15.16.3 +6 -3 WebCore/khtml/html/html_headimpl.h
Index: html_headimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.h,v
retrieving revision 1.15.16.2
retrieving revision 1.15.16.3
diff -u -r1.15.16.2 -r1.15.16.3
--- html_headimpl.h 12 Jul 2005 18:29:04 -0000 1.15.16.2
+++ html_headimpl.h 9 Aug 2005 23:52:13 -0000 1.15.16.3
@@ -100,16 +100,19 @@
virtual bool isURLAttribute(AttributeImpl *attr) const;
+ void tokenizeRelAttribute(const AtomicString& rel);
+
protected:
khtml::CachedCSSStyleSheet *m_cachedSheet;
CSSStyleSheetImpl *m_sheet;
DOMString m_url;
DOMString m_type;
QString m_media;
- DOMString m_rel;
int m_disabledState; // 0=unset(default), 1=enabled via script, 2=disabled
- bool m_loading;
- bool m_alternate;
+ bool m_loading : 1;
+ bool m_alternate : 1;
+ bool m_isStyleSheet : 1;
+ bool m_isIcon : 1;
QString m_data; // needed for temporarily storing the loaded style sheet data
};
1.60.8.1 +45 -11 WebCore/khtml/html/html_objectimpl.cpp
Index: html_objectimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.60
retrieving revision 1.60.8.1
diff -u -r1.60 -r1.60.8.1
--- html_objectimpl.cpp 10 Mar 2005 21:09:24 -0000 1.60
+++ html_objectimpl.cpp 9 Aug 2005 23:52:13 -0000 1.60.8.1
@@ -388,6 +388,7 @@
#endif
{
needWidgetUpdate = false;
+ m_useFallbackContent = false;
}
HTMLObjectElementImpl::~HTMLObjectElementImpl()
@@ -458,7 +459,7 @@
serviceType = serviceType.left( pos );
if (m_render)
needWidgetUpdate = true;
- if (!canRenderImageType(serviceType) && m_imageLoader) {
+ if (!isImageType() && m_imageLoader) {
delete m_imageLoader;
m_imageLoader = 0;
}
@@ -467,7 +468,7 @@
url = khtml::parseURL( val ).string();
if (m_render)
needWidgetUpdate = true;
- if (m_render && canRenderImageType(serviceType)) {
+ if (m_render && isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
@@ -505,9 +506,8 @@
bool HTMLObjectElementImpl::rendererIsNeeded(RenderStyle *style)
{
- if (canRenderImageType(serviceType)) {
+ if (m_useFallbackContent || isImageType())
return HTMLElementImpl::rendererIsNeeded(style);
- }
KHTMLPart* part = getDocument()->part();
if (!part || !part->pluginsEnabled()) {
@@ -528,9 +528,10 @@
RenderObject *HTMLObjectElementImpl::createRenderer(RenderArena *arena, RenderStyle *style)
{
- if (canRenderImageType(serviceType)) {
+ if (m_useFallbackContent)
+ return RenderObject::createObject(this, style);
+ if (isImageType())
return new (arena) RenderImage(this);
- }
return new (arena) RenderPartObject(this);
}
@@ -538,8 +539,8 @@
{
HTMLElementImpl::attach();
- if (m_render) {
- if (canRenderImageType(serviceType)) {
+ if (m_render && !m_useFallbackContent) {
+ if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
@@ -565,7 +566,7 @@
void HTMLObjectElementImpl::detach()
{
// Only bother with an unload event if we had a render object. - dwh
- if (attached() && m_render)
+ if (attached() && m_render && !m_useFallbackContent)
// ### do this when we are actualy removed from document instead
dispatchHTMLEvent(EventImpl::UNLOAD_EVENT,false,false);
@@ -574,7 +575,7 @@
void HTMLObjectElementImpl::recalcStyle(StyleChange ch)
{
- if (needWidgetUpdate && m_render && !canRenderImageType(serviceType)) {
+ if (!m_useFallbackContent && needWidgetUpdate && m_render && !isImageType()) {
// Set needWidgetUpdate to false before calling updateWidget because updateWidget may cause
// this method or attach (which also calls updateWidget) to be called.
needWidgetUpdate = false;
@@ -586,7 +587,7 @@
void HTMLObjectElementImpl::childrenChanged()
{
- if (inDocument()) {
+ if (inDocument() && !m_useFallbackContent) {
needWidgetUpdate = true;
setChanged();
}
@@ -597,6 +598,39 @@
return (attr->id() == ATTR_DATA || (attr->id() == ATTR_USEMAP && attr->value().domString()[0] != '#'));
}
+bool HTMLObjectElementImpl::isImageType()
+{
+ if (serviceType.isEmpty() && url.startsWith("data:")) {
+ // Extract the MIME type from the data URL.
+ int index = url.find(';');
+ if (index == -1)
+ index = url.find(',');
+ if (index != -1) {
+ int len = index - 5;
+ if (len > 0)
+ serviceType = url.mid(5, len);
+ else
+ serviceType = "text/plain"; // Data URLs with no MIME type are considered text/plain.
+ }
+ }
+
+ return canRenderImageType(serviceType);
+}
+
+void HTMLObjectElementImpl::renderFallbackContent()
+{
+ if (m_useFallbackContent)
+ return;
+
+ // Mark ourselves as using the fallback content.
+ m_useFallbackContent = true;
+
+ // Now do a detach and reattach.
+ // FIXME: Style gets recalculated which is suboptimal.
+ detach();
+ attach();
+}
+
// -------------------------------------------------------------------------
HTMLParamElementImpl::HTMLParamElementImpl(DocumentPtr *doc)
1.28.8.1 +6 -1 WebCore/khtml/html/html_objectimpl.h
Index: html_objectimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.h,v
retrieving revision 1.28
retrieving revision 1.28.8.1
diff -u -r1.28 -r1.28.8.1
--- html_objectimpl.h 10 Mar 2005 21:09:24 -0000 1.28
+++ html_objectimpl.h 9 Aug 2005 23:52:13 -0000 1.28.8.1
@@ -139,6 +139,10 @@
virtual bool isURLAttribute(AttributeImpl *attr) const;
+ bool isImageType();
+
+ void renderFallbackContent();
+
#if APPLE_CHANGES
KJS::Bindings::Instance *getObjectInstance() const;
#endif
@@ -146,7 +150,8 @@
QString serviceType;
QString url;
QString classId;
- bool needWidgetUpdate;
+ bool needWidgetUpdate : 1;
+ bool m_useFallbackContent : 1;
HTMLImageLoader* m_imageLoader;
#if APPLE_CHANGES
1.92.6.4 +1 -1 WebCore/khtml/html/htmlparser.cpp
Index: htmlparser.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmlparser.cpp,v
retrieving revision 1.92.6.3
retrieving revision 1.92.6.4
diff -u -r1.92.6.3 -r1.92.6.4
--- htmlparser.cpp 4 Aug 2005 21:34:38 -0000 1.92.6.3
+++ htmlparser.cpp 9 Aug 2005 23:52:14 -0000 1.92.6.4
@@ -650,7 +650,7 @@
( parent->id() == ID_THEAD ||
parent->id() == ID_TBODY ||
parent->id() == ID_TFOOT ) && parentparent->id() == ID_TABLE ) ||
- ( !checkChild( ID_TR, id ) && ( node->id() == ID_THEAD || node->id() == ID_TBODY || node->id() == ID_TFOOT ) &&
+ ( !checkChild(ID_TR, id, !doc()->inCompatMode()) && ( node->id() == ID_THEAD || node->id() == ID_TBODY || node->id() == ID_TFOOT ) &&
parent->id() == ID_TABLE ))
{
node = (node->id() == ID_TABLE) ? node :
1.84.6.4 +30 -10 WebCore/khtml/html/htmltokenizer.cpp
Index: htmltokenizer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/htmltokenizer.cpp,v
retrieving revision 1.84.6.3
retrieving revision 1.84.6.4
diff -u -r1.84.6.3 -r1.84.6.4
--- htmltokenizer.cpp 9 Aug 2005 21:45:45 -0000 1.84.6.3
+++ htmltokenizer.cpp 9 Aug 2005 23:52:14 -0000 1.84.6.4
@@ -642,6 +642,10 @@
void HTMLTokenizer::parseComment(TokenizerString &src)
{
+ // FIXME: Why does this code even run for comments inside <script>? This seems bogus.
+ bool strict = !parser->doc()->inCompatMode() && !script;
+ int delimiterCount = 0;
+ bool canClose = false;
checkScriptBuffer(src.length());
while ( !src.isEmpty() ) {
scriptCode[ scriptCodeSize++ ] = *src;
@@ -649,19 +653,35 @@
qDebug("comment is now: *%s*",
QConstString((QChar*)src.current(), QMIN(16, src.length())).string().latin1());
#endif
- if (src->unicode() == '>') {
+
+ if (strict) {
+ if (src->unicode() == '-') {
+ delimiterCount++;
+ if (delimiterCount == 2) {
+ delimiterCount = 0;
+ canClose = !canClose;
+ }
+ }
+ else
+ delimiterCount = 0;
+ }
+
+ if ((!strict || canClose) && src->unicode() == '>') {
bool handleBrokenComments = brokenComments && !(script || style);
int endCharsCount = 1; // start off with one for the '>' character
- if (scriptCodeSize > 2 && scriptCode[scriptCodeSize-3] == '-' && scriptCode[scriptCodeSize-2] == '-') {
- endCharsCount = 3;
- }
- else if (scriptCodeSize > 3 && scriptCode[scriptCodeSize-4] == '-' && scriptCode[scriptCodeSize-3] == '-' &&
- scriptCode[scriptCodeSize-2] == '!') {
- // Other browsers will accept --!> as a close comment, even though it's
- // not technically valid.
- endCharsCount = 4;
+ if (!strict) {
+ // In quirks mode just check for -->
+ if (scriptCodeSize > 2 && scriptCode[scriptCodeSize-3] == '-' && scriptCode[scriptCodeSize-2] == '-') {
+ endCharsCount = 3;
+ }
+ else if (scriptCodeSize > 3 && scriptCode[scriptCodeSize-4] == '-' && scriptCode[scriptCodeSize-3] == '-' &&
+ scriptCode[scriptCodeSize-2] == '!') {
+ // Other browsers will accept --!> as a close comment, even though it's
+ // not technically valid.
+ endCharsCount = 4;
+ }
}
- if (handleBrokenComments || endCharsCount > 1) {
+ if (canClose || handleBrokenComments || endCharsCount > 1) {
++src;
if (!( script || xmp || textarea || style)) {
if (includesCommentsInDOM) {
No revision
No revision
1.179.8.4 +11 -3 WebCore/khtml/rendering/render_block.cpp
Index: render_block.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
retrieving revision 1.179.8.3
retrieving revision 1.179.8.4
diff -u -r1.179.8.3 -r1.179.8.4
--- render_block.cpp 5 Aug 2005 18:01:22 -0000 1.179.8.3
+++ render_block.cpp 9 Aug 2005 23:52:15 -0000 1.179.8.4
@@ -388,10 +388,18 @@
style()->marginTopCollapse() == MSEPARATE || style()->marginBottomCollapse() == MSEPARATE)
return false;
+ bool hasAutoHeight = style()->height().isVariable();
+ if (style()->height().isPercent() && !style()->htmlHacks()) {
+ hasAutoHeight = true;
+ for (RenderBlock* cb = containingBlock(); !cb->isCanvas(); cb = cb->containingBlock()) {
+ if (cb->style()->height().isFixed() || cb->isTableCell())
+ hasAutoHeight = false;
+ }
+ }
+
// If the height is 0 or auto, then whether or not we are a self-collapsing block depends
// on whether we have content that is all self-collapsing or not.
- if (style()->height().isVariable() ||
- (style()->height().isFixed() && style()->height().value == 0)) {
+ if (hasAutoHeight || ((style()->height().isFixed() || style()->height().isPercent()) && style()->height().value == 0)) {
// If the block has inline children, see if we generated any line boxes. If we have any
// line boxes, then we can't be self-collapsing, since we have content.
if (childrenInline())
@@ -528,7 +536,7 @@
m_height = m_overflowHeight + borderBottom() + paddingBottom();
}
- if (hasOverhangingFloats() && (isFloating() || isTableCell())) {
+ if (hasOverhangingFloats() && ((isFloating() && style()->height().isVariable()) || isTableCell())) {
m_height = floatBottom();
m_height += borderBottom() + paddingBottom();
}
1.64.8.2 +2 -2 WebCore/khtml/rendering/render_block.h
Index: render_block.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.h,v
retrieving revision 1.64.8.1
retrieving revision 1.64.8.2
diff -u -r1.64.8.1 -r1.64.8.2
--- render_block.h 5 Aug 2005 18:01:23 -0000 1.64.8.1
+++ render_block.h 9 Aug 2005 23:52:16 -0000 1.64.8.2
@@ -198,8 +198,8 @@
virtual int getBaselineOfFirstLineBox() const;
- RootInlineBox* firstRootBox() { return static_cast<RootInlineBox*>(m_firstLineBox); }
- RootInlineBox* lastRootBox() { return static_cast<RootInlineBox*>(m_lastLineBox); }
+ RootInlineBox* firstRootBox() const { return static_cast<RootInlineBox*>(m_firstLineBox); }
+ RootInlineBox* lastRootBox() const { return static_cast<RootInlineBox*>(m_lastLineBox); }
// Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline
// children.
1.149.6.1 +185 -123 WebCore/khtml/rendering/render_box.cpp
Index: render_box.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_box.cpp,v
retrieving revision 1.149
retrieving revision 1.149.6.1
diff -u -r1.149 -r1.149.6.1
--- render_box.cpp 18 Mar 2005 20:41:58 -0000 1.149
+++ render_box.cpp 9 Aug 2005 23:52:16 -0000 1.149.6.1
@@ -98,9 +98,9 @@
// FIXME: Note that we restrict overflow to blocks for now. One day table bodies and cells
// will need to support overflow.
- // We also deal with the body scroll quirk here, since it sets the scrollbars for the document.
- if (_style->overflow() != OVISIBLE && isBlockFlow() && !isTableCell() &&
- (!document()->isHTMLDocument() || !isBody()))
+ // We also handle <body> and <html>, whose overflow applies to the viewport.
+ if (_style->overflow() != OVISIBLE && isBlockFlow() && !isTableCell() && !isRoot() &&
+ (!isBody() || !document()->isHTMLDocument() || !(parent() && parent()->style()->overflow() == OVISIBLE)))
setHasOverflowClip();
if (requiresLayer()) {
@@ -989,8 +989,12 @@
int height;
if (checkMinMaxHeight) {
height = calcHeightUsing(style()->height());
- int minH = calcHeightUsing(style()->minHeight());
+ if (height == -1)
+ height = m_height;
+ int minH = calcHeightUsing(style()->minHeight()); // Leave as -1 if unset.
int maxH = style()->maxHeight().value == UNDEFINED ? height : calcHeightUsing(style()->maxHeight());
+ if (maxH == -1)
+ maxH = height;
height = kMin(maxH, height);
height = kMax(minH, height);
}
@@ -1027,8 +1031,8 @@
int RenderBox::calcHeightUsing(const Length& h)
{
+ int height = -1;
if (!h.isVariable()) {
- int height = -1;
if (h.isFixed())
height = h.value;
else if (h.isPercent())
@@ -1038,7 +1042,7 @@
return height;
}
}
- return m_height;
+ return height;
}
int RenderBox::calcPercentageHeight(const Length& height)
@@ -1240,34 +1244,23 @@
void RenderBox::calcAbsoluteHorizontal()
{
const int AUTO = -666666;
- int l,r,w,ml,mr,cw;
+ int l, r, cw;
int pab = borderLeft()+ borderRight()+ paddingLeft()+ paddingRight();
- l=r=ml=mr=w=AUTO;
+ l = r = AUTO;
// We don't use containingBlock(), since we may be positioned by an enclosing relpositioned inline.
RenderObject* cb = container();
cw = containingBlockWidth() + cb->paddingLeft() + cb->paddingRight();
- if(!style()->left().isVariable())
+ if (!style()->left().isVariable())
l = style()->left().width(cw);
- if(!style()->right().isVariable())
+ if (!style()->right().isVariable())
r = style()->right().width(cw);
- if(!style()->width().isVariable())
- w = style()->width().width(cw);
- else if (isReplaced())
- w = intrinsicWidth();
- if(!style()->marginLeft().isVariable())
- ml = style()->marginLeft().width(cw);
- if(!style()->marginRight().isVariable())
- mr = style()->marginRight().width(cw);
-
-
-// printf("h1: w=%d, l=%d, r=%d, ml=%d, mr=%d\n",w,l,r,ml,mr);
int static_distance=0;
- if ((parent()->style()->direction()==LTR && (l==AUTO && r==AUTO ))
+ if ((parent()->style()->direction()==LTR && (l == AUTO && r == AUTO))
|| style()->left().isStatic())
{
static_distance = m_staticX - cb->borderLeft(); // Should already have been set through layout of the parent().
@@ -1275,7 +1268,7 @@
for (; po && po != cb; po = po->parent())
static_distance += po->xPos();
- if (l==AUTO || style()->left().isStatic())
+ if (l == AUTO || style()->left().isStatic())
l = static_distance;
}
@@ -1293,14 +1286,60 @@
r = static_distance;
}
+ calcAbsoluteHorizontalValues(Width, cb, cw, pab, static_distance, l, r, m_width, m_marginLeft, m_marginRight, m_x);
- if (l!=AUTO && w!=AUTO && r!=AUTO)
- {
+ // Avoid doing any work in the common case (where the values of min-width and max-width are their defaults).
+ int minW = m_width, minML, minMR, minX;
+ calcAbsoluteHorizontalValues(MinWidth, cb, cw, pab, static_distance, l, r, minW, minML, minMR, minX);
+
+ int maxW = m_width, maxML, maxMR, maxX;
+ if (style()->maxWidth().value != UNDEFINED)
+ calcAbsoluteHorizontalValues(MaxWidth, cb, cw, static_distance, pab, l, r, maxW, maxML, maxMR, maxX);
+
+ if (m_width > maxW) {
+ m_width = maxW;
+ m_marginLeft = maxML;
+ m_marginRight = maxMR;
+ m_x = maxX;
+ }
+
+ if (m_width < minW) {
+ m_width = minW;
+ m_marginLeft = minML;
+ m_marginRight = minMR;
+ m_x = minX;
+ }
+}
+
+void RenderBox::calcAbsoluteHorizontalValues(WidthType widthType, RenderObject* cb, int cw, int pab, int static_distance,
+ int l, int r, int& w, int& ml, int& mr, int& x)
+{
+ const int AUTO = -666666;
+ w = ml = mr = AUTO;
+
+ if (!style()->marginLeft().isVariable())
+ ml = style()->marginLeft().width(cw);
+ if (!style()->marginRight().isVariable())
+ mr = style()->marginRight().width(cw);
+
+ Length width;
+ if (widthType == Width)
+ width = style()->width();
+ else if (widthType == MinWidth)
+ width = style()->minWidth();
+ else
+ width = style()->maxWidth();
+
+ if (!width.isVariable())
+ w = width.width(cw);
+ else if (isReplaced())
+ w = intrinsicWidth();
+
+ if (l != AUTO && w != AUTO && r != AUTO) {
// left, width, right all given, play with margins
int ot = l + w + r + pab;
- if (ml==AUTO && mr==AUTO)
- {
+ if (ml==AUTO && mr==AUTO) {
// both margins auto, solve for equality
ml = (cw - ot)/2;
mr = cw - ot - ml;
@@ -1311,10 +1350,9 @@
else if (mr==AUTO)
// solve for right margin
mr = cw - ot - ml;
- else
- {
+ else {
// overconstrained, solve according to dir
- if (style()->direction()==LTR)
+ if (style()->direction() == LTR)
r = cw - ( l + w + ml + mr + pab);
else
l = cw - ( r + w + ml + mr + pab);
@@ -1329,65 +1367,52 @@
if (mr==AUTO) mr = 0;
//1. solve left & width.
- if (l==AUTO && w==AUTO && r!=AUTO)
- {
+ if (l == AUTO && w == AUTO && r != AUTO) {
// From section 10.3.7 of the CSS2.1 specification.
// "The shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width)."
- w = QMIN(QMAX(m_minWidth-pab, cw - ( r + ml + mr + pab)), m_maxWidth-pab);
- l = cw - ( r + w + ml + mr + pab);
+ w = kMin(kMax(m_minWidth - pab, cw - (r + ml + mr + pab)), m_maxWidth - pab);
+ l = cw - (r + w + ml + mr + pab);
}
else
//2. solve left & right. use static positioning.
- if (l==AUTO && w!=AUTO && r==AUTO)
- {
- if (style()->direction()==RTL)
- {
+ if (l == AUTO && w != AUTO && r == AUTO) {
+ if (style()->direction()==RTL) {
r = static_distance;
- l = cw - ( r + w + ml + mr + pab);
+ l = cw - (r + w + ml + mr + pab);
}
- else
- {
+ else {
l = static_distance;
- r = cw - ( l + w + ml + mr + pab);
+ r = cw - (l + w + ml + mr + pab);
}
- }
- else
-
- //3. solve width & right.
- if (l!=AUTO && w==AUTO && r==AUTO)
- {
+ } //3. solve width & right.
+ else if (l != AUTO && w == AUTO && r == AUTO) {
// From section 10.3.7 of the CSS2.1 specification.
// "The shrink-to-fit width is: min(max(preferred minimum width, available width), preferred width)."
- w = QMIN(QMAX(m_minWidth-pab, cw - ( l + ml + mr + pab)), m_maxWidth-pab);
- r = cw - ( l + w + ml + mr + pab);
+ w = kMin(kMax(m_minWidth - pab, cw - (l + ml + mr + pab)), m_maxWidth - pab);
+ r = cw - (l + w + ml + mr + pab);
}
else
//4. solve left
if (l==AUTO && w!=AUTO && r!=AUTO)
- l = cw - ( r + w + ml + mr + pab);
+ l = cw - (r + w + ml + mr + pab);
else
-
//5. solve width
if (l!=AUTO && w==AUTO && r!=AUTO)
- w = cw - ( r + l + ml + mr + pab);
+ w = cw - (r + l + ml + mr + pab);
else
//6. solve right
if (l!=AUTO && w!=AUTO && r==AUTO)
- r = cw - ( l + w + ml + mr + pab);
+ r = cw - (l + w + ml + mr + pab);
}
- m_width = w + pab;
- m_marginLeft = ml;
- m_marginRight = mr;
- m_x = l + ml + cb->borderLeft();
-// printf("h: w=%d, l=%d, r=%d, ml=%d, mr=%d\n",w,l,r,ml,mr);
+ w += pab;
+ x = l + ml + cb->borderLeft();
}
-
void RenderBox::calcAbsoluteVertical()
{
// css2 spec 10.6.4 & 10.6.5
@@ -1398,9 +1423,9 @@
// that introduces static-position value for top, left & right
const int AUTO = -666666;
- int t,b,h,mt,mb,ch;
+ int t, b, ch;
- t=b=h=mt=mb=AUTO;
+ t = b = AUTO;
int pab = borderTop()+borderBottom()+paddingTop()+paddingBottom();
@@ -1412,34 +1437,84 @@
else
ch = cb->height() - cb->borderTop() - cb->borderBottom();
- if(!style()->top().isVariable())
+ if (!style()->top().isVariable())
t = style()->top().width(ch);
- if(!style()->bottom().isVariable())
+ if (!style()->bottom().isVariable())
b = style()->bottom().width(ch);
- if (isTable() && style()->height().isVariable())
+
+ int h, mt, mb, y;
+ calcAbsoluteVerticalValues(Height, cb, ch, pab, t, b, h, mt, mb, y);
+
+ // Avoid doing any work in the common case (where the values of min-height and max-height are their defaults).
+ int minH = h, minMT, minMB, minY;
+ calcAbsoluteVerticalValues(MinHeight, cb, ch, pab, t, b, minH, minMT, minMB, minY);
+
+ int maxH = h, maxMT, maxMB, maxY;
+ if (style()->maxHeight().value != UNDEFINED)
+ calcAbsoluteVerticalValues(MaxHeight, cb, ch, pab, t, b, maxH, maxMT, maxMB, maxY);
+
+ if (h > maxH) {
+ h = maxH;
+ mt = maxMT;
+ mb = maxMB;
+ y = maxY;
+ }
+
+ if (h < minH) {
+ h = minH;
+ mt = minMT;
+ mb = minMB;
+ y = minY;
+ }
+
+ // If our natural height exceeds the new height once we've set it, then we need to make sure to update
+ // overflow to track the spillout.
+ if (m_height > h)
+ setOverflowHeight(m_height);
+
+ // Set our final values.
+ m_height = h;
+ m_marginTop = mt;
+ m_marginBottom = mb;
+ m_y = y;
+}
+
+void RenderBox::calcAbsoluteVerticalValues(HeightType heightType, RenderObject* cb, int ch, int pab,
+ int t, int b, int& h, int& mt, int& mb, int& y)
+{
+ const int AUTO = -666666;
+ h = mt = mb = AUTO;
+
+ if (!style()->marginTop().isVariable())
+ mt = style()->marginTop().width(ch);
+ if (!style()->marginBottom().isVariable())
+ mb = style()->marginBottom().width(ch);
+
+ Length height;
+ if (heightType == Height)
+ height = style()->height();
+ else if (heightType == MinHeight)
+ height = style()->minHeight();
+ else
+ height = style()->maxHeight();
+
+ int ourHeight = m_height;
+
+ if (isTable() && height.isVariable())
// Height is never unsolved for tables. "auto" means shrink to fit. Use our
// height instead.
- h = m_height - pab;
- else if(!style()->height().isVariable())
+ h = ourHeight - pab;
+ else if (!height.isVariable())
{
- h = style()->height().width(ch);
-
- if (m_height-pab > h) {
- setOverflowHeight(m_height + pab - (paddingBottom() + borderBottom()));
- m_height = h+pab;
- }
+ h = height.width(ch);
+ if (ourHeight - pab > h)
+ ourHeight = h + pab;
}
else if (isReplaced())
h = intrinsicHeight();
- if(!style()->marginTop().isVariable())
- mt = style()->marginTop().width(ch);
- if(!style()->marginBottom().isVariable())
- mb = style()->marginBottom().width(ch);
-
int static_top=0;
- if ((t==AUTO && b==AUTO ) || style()->top().isStatic())
- {
+ if ((t == AUTO && b == AUTO) || style()->top().isStatic()) {
// calc hypothetical location in the normal flow
// used for 1) top=static-position
// 2) top, bottom, height are all auto -> calc top -> 3.
@@ -1449,17 +1524,15 @@
for (; po && po != cb; po = po->parent())
static_top += po->yPos();
- if (h==AUTO || style()->top().isStatic())
+ if (h == AUTO || style()->top().isStatic())
t = static_top;
}
- if (t!=AUTO && h!=AUTO && b!=AUTO)
- {
+ if (t != AUTO && h != AUTO && b != AUTO) {
// top, height, bottom all given, play with margins
int ot = h + t + b + pab;
- if (mt==AUTO && mb==AUTO)
- {
+ if (mt == AUTO && mb == AUTO) {
// both margins auto, solve for equality
mt = (ch - ot)/2;
mb = ch - ot - mt;
@@ -1472,71 +1545,60 @@
mb = ch - ot - mt;
else
// overconstrained, solve for bottom
- b = ch - ( h+t+mt+mb+pab);
+ b = ch - (h + t + mt + mb + pab);
}
- else
- {
+ else {
// one or two of (top, height, bottom) missing, solve
// auto margins are ignored
- if (mt==AUTO) mt = 0;
- if (mb==AUTO) mb = 0;
+ if (mt == AUTO)
+ mt = 0;
+ if (mb == AUTO)
+ mb = 0;
//1. solve top & height. use content height.
- if (t==AUTO && h==AUTO && b!=AUTO)
- {
- h = m_height-pab;
- t = ch - ( h+b+mt+mb+pab);
+ if (t == AUTO && h == AUTO && b != AUTO) {
+ h = ourHeight - pab;
+ t = ch - (h + b + mt + mb + pab);
}
- else
-
- //2. solve top & bottom. use static positioning.
- if (t==AUTO && h!=AUTO && b==AUTO)
+ else if (t == AUTO && h != AUTO && b == AUTO) //2. solve top & bottom. use static positioning.
{
t = static_top;
- b = ch - ( h+t+mt+mb+pab);
+ b = ch - (h + t + mt + mb + pab);
}
- else
-
- //3. solve height & bottom. use content height.
- if (t!=AUTO && h==AUTO && b==AUTO)
+ else if (t != AUTO && h == AUTO && b == AUTO) //3. solve height & bottom. use content height.
{
- h = m_height-pab;
- b = ch - ( h+t+mt+mb+pab);
+ h = ourHeight - pab;
+ b = ch - (h + t + mt + mb + pab);
}
else
-
//4. solve top
- if (t==AUTO && h!=AUTO && b!=AUTO)
- t = ch - ( h+b+mt+mb+pab);
+ if (t == AUTO && h != AUTO && b != AUTO)
+ t = ch - (h + b + mt + mb + pab);
else
//5. solve height
- if (t!=AUTO && h==AUTO && b!=AUTO)
- h = ch - ( t+b+mt+mb+pab);
+ if (t != AUTO && h == AUTO && b != AUTO)
+ h = ch - (t + b + mt + mb + pab);
else
//6. solve bottom
- if (t!=AUTO && h!=AUTO && b==AUTO)
- b = ch - ( h+t+mt+mb+pab);
+ if (t != AUTO && h != AUTO && b == AUTO)
+ b = ch - (h + t + mt + mb + pab);
}
- if (m_height<h+pab) //content must still fit
- m_height = h+pab;
+ if (ourHeight < h + pab) //content must still fit
+ ourHeight = h + pab;
- if (hasOverflowClip() && m_height > h+pab)
- m_height = h+pab;
+ if (hasOverflowClip() && ourHeight > h + pab)
+ ourHeight = h + pab;
// Do not allow the height to be negative. This can happen when someone specifies both top and bottom
// but the containing block height is less than top, e.g., top:20px, bottom:0, containing block height 16.
- m_height = kMax(0, m_height);
+ ourHeight = kMax(0, ourHeight);
- m_marginTop = mt;
- m_marginBottom = mb;
- m_y = t + mt + cb->borderTop();
-
-// printf("v: h=%d, t=%d, b=%d, mt=%d, mb=%d, m_y=%d\n",h,t,b,mt,mb,m_y);
-
+ h = ourHeight;
+ y = t + mt + cb->borderTop();
}
QRect RenderBox::caretRect(int offset, EAffinity affinity, int *extraWidthToEndOfLine)
1.53.8.1 +5 -1 WebCore/khtml/rendering/render_box.h
Index: render_box.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_box.h,v
retrieving revision 1.53
retrieving revision 1.53.8.1
diff -u -r1.53 -r1.53.8.1
--- render_box.h 7 Dec 2004 00:34:02 -0000 1.53
+++ render_box.h 9 Aug 2005 23:52:16 -0000 1.53.8.1
@@ -157,7 +157,11 @@
void calcAbsoluteHorizontal();
void calcAbsoluteVertical();
-
+ void calcAbsoluteHorizontalValues(WidthType widthType, RenderObject* cb, int cw, int pab, int static_distance,
+ int l, int r, int& w, int& ml, int& mr, int& x);
+ void calcAbsoluteVerticalValues(HeightType heightType, RenderObject* cb, int ch, int pab,
+ int t, int b, int& h, int& mt, int& mb, int& y);
+
virtual QRect getOverflowClipRect(int tx, int ty);
virtual QRect getClipRect(int tx, int ty);
1.66.8.1 +11 -21 WebCore/khtml/rendering/render_frames.cpp
Index: render_frames.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_frames.cpp,v
retrieving revision 1.66
retrieving revision 1.66.8.1
diff -u -r1.66 -r1.66.8.1
--- render_frames.cpp 2 Mar 2005 01:38:17 -0000 1.66
+++ render_frames.cpp 9 Aug 2005 23:52:16 -0000 1.66.8.1
@@ -612,26 +612,6 @@
return false;
}
-int RenderPart::intrinsicWidth() const
-{
- // KDE may need a non-zero width here, although this will mess up pages (e.g., thinker.org).
-#if APPLE_CHANGES
- return 0;
-#else
- return 300;
-#endif
-}
-
-int RenderPart::intrinsicHeight() const
-{
- // KDE may need a non-zero height here, although this will mess up pages (e.g., thinker.org).
-#if APPLE_CHANGES
- return 0;
-#else
- return 200;
-#endif
-}
-
void RenderPart::slotViewCleared()
{
}
@@ -681,6 +661,7 @@
{
// init RenderObject attributes
setInline(true);
+ m_hasFallbackContent = false;
}
void RenderPartObject::updateWidget()
@@ -831,7 +812,16 @@
params.append( QString::fromLatin1("__KHTML__CODEBASE=\"%1\"").arg( o->getAttribute(ATTR_CODEBASE).string() ) );
#endif
- part->requestObject( this, url, serviceType, paramNames, paramValues );
+ // Find out if we support fallback content.
+ m_hasFallbackContent = false;
+ for (NodeImpl *child = o->firstChild(); child && !m_hasFallbackContent; child = child->nextSibling()) {
+ if ((!child->isTextNode() && child->id() != ID_EMBED && child->id() != ID_PARAM) || // Discount <embed> and <param>
+ (child->isTextNode() && !child->containsOnlyWhitespace()))
+ m_hasFallbackContent = true;
+ }
+ bool success = part->requestObject( this, url, serviceType, paramNames, paramValues );
+ if (!success && m_hasFallbackContent)
+ o->renderFallbackContent();
} else if ( element()->id() == ID_EMBED ) {
HTMLEmbedElementImpl *o = static_cast<HTMLEmbedElementImpl *>(element());
1.15.10.1 +4 -2 WebCore/khtml/rendering/render_frames.h
Index: render_frames.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_frames.h,v
retrieving revision 1.15
retrieving revision 1.15.10.1
diff -u -r1.15 -r1.15.10.1
--- render_frames.h 23 Nov 2004 05:08:19 -0000 1.15
+++ render_frames.h 9 Aug 2005 23:52:16 -0000 1.15.10.1
@@ -119,11 +119,13 @@
*/
virtual bool partLoadingErrorNotify( khtml::ChildFrame *childFrame, const KURL& url, const QString& serviceType );
- virtual int intrinsicWidth() const;
- virtual int intrinsicHeight() const;
+ bool hasFallbackContent() const { return m_hasFallbackContent; }
public slots:
virtual void slotViewCleared();
+
+protected:
+ bool m_hasFallbackContent;
};
class RenderFrame : public RenderPart
1.75.8.2 +1 -1 WebCore/khtml/rendering/render_replaced.cpp
Index: render_replaced.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_replaced.cpp,v
retrieving revision 1.75.8.1
retrieving revision 1.75.8.2
diff -u -r1.75.8.1 -r1.75.8.2
--- render_replaced.cpp 5 Aug 2005 18:01:24 -0000 1.75.8.1
+++ render_replaced.cpp 9 Aug 2005 23:52:16 -0000 1.75.8.2
@@ -51,7 +51,7 @@
// init RenderObject attributes
setReplaced(true);
- m_intrinsicWidth = 200;
+ m_intrinsicWidth = 300;
m_intrinsicHeight = 150;
m_selectionState = SelectionNone;
}
1.123.8.1 +21 -11 WebCore/khtml/rendering/render_table.cpp
Index: render_table.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_table.cpp,v
retrieving revision 1.123
retrieving revision 1.123.8.1
diff -u -r1.123 -r1.123.8.1
--- render_table.cpp 16 Mar 2005 02:02:33 -0000 1.123
+++ render_table.cpp 9 Aug 2005 23:52:16 -0000 1.123.8.1
@@ -307,6 +307,11 @@
firstBody->calcRowHeight();
firstBody->layoutRows( th - calculatedHeight );
}
+ else if (!style()->htmlHacks()) {
+ // Completely empty tables (with no sections or anything) should at least honor specified height
+ // in strict mode.
+ m_height += th;
+ }
}
int bl = borderLeft();
@@ -1118,13 +1123,14 @@
|| va == SUPER || va == SUB)
{
int b=cell->baselinePosition();
-
- if (b>baseline)
- baseline=b;
-
- int td = rowPos[ indx ] + ch - b;
- if (td>bdesc)
- bdesc = td;
+ if (b > cell->borderTop() + cell->paddingTop()) {
+ if (b>baseline)
+ baseline=b;
+
+ int td = rowPos[ indx ] + ch - b;
+ if (td>bdesc)
+ bdesc = td;
+ }
}
}
@@ -1660,14 +1666,18 @@
short RenderTableCell::baselinePosition( bool ) const
{
- RenderObject *o = firstChild();
+ RenderObject* o = firstChild();
int offset = paddingTop() + borderTop();
- if ( !o ) return offset;
- while ( o->firstChild() ) {
- if ( !o->isInline() )
+ if (!o) return offset + contentHeight();
+ while (o->firstChild()) {
+ if (!o->isInline())
offset += o->paddingTop() + o->borderTop();
o = o->firstChild();
}
+
+ if (!o->isInline())
+ return paddingTop() + borderTop() + contentHeight();
+
offset += o->baselinePosition( true );
return offset;
}
No revision
No revision
1.61.6.4 +1 -1 WebCore/khtml/xml/dom_elementimpl.cpp
Index: dom_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
retrieving revision 1.61.6.3
retrieving revision 1.61.6.4
diff -u -r1.61.6.3 -r1.61.6.4
--- dom_elementimpl.cpp 4 Aug 2005 01:58:20 -0000 1.61.6.3
+++ dom_elementimpl.cpp 9 Aug 2005 23:52:18 -0000 1.61.6.4
@@ -528,7 +528,7 @@
// For XML documents, we are non-validating and do not check against a DTD, even for HTML elements.
if (getDocument()->isHTMLDocument())
- return checkChild(id(), newChild->id());
+ return checkChild(id(), newChild->id(), !getDocument()->inCompatMode());
return true;
}
No revision
No revision
1.628.6.6 +12 -4 WebCore/kwq/KWQKHTMLPart.mm
Index: KWQKHTMLPart.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQKHTMLPart.mm,v
retrieving revision 1.628.6.5
retrieving revision 1.628.6.6
diff -u -r1.628.6.5 -r1.628.6.6
--- KWQKHTMLPart.mm 2 Aug 2005 16:52:27 -0000 1.628.6.5
+++ KWQKHTMLPart.mm 9 Aug 2005 23:52:18 -0000 1.628.6.6
@@ -801,8 +801,17 @@
KWQ_BLOCK_EXCEPTIONS;
ReadOnlyPart *part;
- BOOL needFrame = [_bridge frameRequiredForMIMEType:mimeType.getNSString() URL:url.getNSURL()];
- if (child.m_type == ChildFrame::Object && !needFrame) {
+ ObjectElementType objectType = ObjectElementFrame;
+ if (child.m_type == ChildFrame::Object)
+ objectType = [_bridge determineObjectFromMIMEType:mimeType.getNSString() URL:url.getNSURL()];
+
+ if (objectType == ObjectElementNone) {
+ if (child.m_hasFallbackContent)
+ return NULL;
+ objectType = ObjectElementPlugin; // Since no fallback content exists, we'll make a plugin and show the error dialog.
+ }
+
+ if (objectType == ObjectElementPlugin) {
KWQPluginPart *newPart = new KWQPluginPart;
newPart->setWidget(new QWidget([_bridge viewForPluginWithURL:url.getNSURL()
attributeNames:child.m_paramNames.getNSArray()
@@ -830,9 +839,8 @@
// This call needs to return an object with a ref, since the caller will expect to own it.
// childBridge owns the only ref so far.
part = [childBridge part];
- if (part) {
+ if (part)
part->ref();
- }
}
return part;
1.124.8.2 +8 -1 WebCore/kwq/KWQPainter.mm
Index: KWQPainter.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/KWQPainter.mm,v
retrieving revision 1.124.8.1
retrieving revision 1.124.8.2
diff -u -r1.124.8.1 -r1.124.8.2
--- KWQPainter.mm 5 Aug 2005 18:01:28 -0000 1.124.8.1
+++ KWQPainter.mm 9 Aug 2005 23:52:19 -0000 1.124.8.2
@@ -436,7 +436,12 @@
{
if (data->state.paintingDisabled)
return;
-
+
+
+ NSGraphicsContext *graphicsContext = [NSGraphicsContext currentContext];
+ BOOL flag = [graphicsContext shouldAntialias];
+ [graphicsContext setShouldAntialias: NO];
+
int npoints = _npoints != -1 ? _npoints : _points.size()-index;
NSPoint points[npoints];
for (int i = 0; i < npoints; i++) {
@@ -461,6 +466,8 @@
}
[path release];
+
+ [graphicsContext setShouldAntialias: flag];
}
1.327.8.5 +11 -1 WebCore/kwq/WebCoreBridge.h
Index: WebCoreBridge.h
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.h,v
retrieving revision 1.327.8.4
retrieving revision 1.327.8.5
diff -u -r1.327.8.4 -r1.327.8.5
--- WebCoreBridge.h 26 Jul 2005 21:14:25 -0000 1.327.8.4
+++ WebCoreBridge.h 9 Aug 2005 23:52:19 -0000 1.327.8.5
@@ -164,6 +164,14 @@
WebUndoActionTyping,
} WebUndoAction;
+typedef enum
+{
+ ObjectElementNone,
+ ObjectElementImage,
+ ObjectElementFrame,
+ ObjectElementPlugin,
+} ObjectElementType;
+
// WebCoreBridge objects are used by WebCore to abstract away operations that need
// to be implemented by library clients, for example WebKit. The objects are also
// used in the opposite direction, for simple access to WebCore functions without dealing
@@ -218,6 +226,8 @@
- (void)end;
- (void)stop;
+- (void)mainResourceError;
+
- (NSURL *)URL;
- (NSURL *)baseURL;
- (NSString *)referrer;
@@ -553,7 +563,7 @@
- (int)getObjectCacheSize;
-- (BOOL)frameRequiredForMIMEType:(NSString*)MIMEType URL:(NSURL *)URL;
+- (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
- (void)loadEmptyDocumentSynchronously;
1.382.2.7 +5 -0 WebCore/kwq/WebCoreBridge.mm
Index: WebCoreBridge.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreBridge.mm,v
retrieving revision 1.382.2.6
retrieving revision 1.382.2.7
diff -u -r1.382.2.6 -r1.382.2.7
--- WebCoreBridge.mm 26 Jul 2005 21:14:25 -0000 1.382.2.6
+++ WebCoreBridge.mm 9 Aug 2005 23:52:19 -0000 1.382.2.7
@@ -506,6 +506,11 @@
_part->stop();
}
+- (void)mainResourceError
+{
+ _part->handleFallbackContent();
+}
+
- (void)createKHTMLViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh
{
// If we own the view, delete the old one - otherwise the render _part will take care of deleting the view.
More information about the webkit-changes
mailing list