summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/JavaScriptCore/wtf/Platform.h1
-rw-r--r--Source/WebCore/Android.derived.v8bindings.mk2
-rw-r--r--Source/WebCore/css/CSSParser.cpp2
-rw-r--r--Source/WebCore/css/CSSPrimitiveValue.cpp3
-rw-r--r--Source/WebCore/css/CSSStyleSelector.cpp30
-rw-r--r--Source/WebCore/css/WebKitCSSKeyframesRule.cpp3
-rw-r--r--Source/WebCore/dom/Document.cpp2
-rw-r--r--Source/WebCore/dom/Node.cpp12
-rw-r--r--Source/WebCore/dom/Node.h4
-rw-r--r--Source/WebCore/dom/Range.cpp15
-rw-r--r--Source/WebCore/editing/ApplyStyleCommand.cpp6
-rw-r--r--Source/WebCore/editing/CompositeEditCommand.cpp2
-rw-r--r--Source/WebCore/html/HTMLAttributeNames.in1
-rw-r--r--Source/WebCore/html/HTMLElement.cpp5
-rw-r--r--Source/WebCore/html/HTMLInputElement.cpp20
-rw-r--r--Source/WebCore/html/HTMLInputElement.h4
-rw-r--r--Source/WebCore/html/HTMLInputElement.idl3
-rw-r--r--Source/WebCore/html/HTMLMediaElement.cpp19
-rw-r--r--Source/WebCore/html/HTMLMediaElement.h2
-rw-r--r--Source/WebCore/html/shadow/TextControlInnerElements.h5
-rw-r--r--Source/WebCore/platform/FileChooser.h7
-rw-r--r--Source/WebCore/rendering/RenderBlock.cpp29
-rw-r--r--Source/WebCore/rendering/RenderFileUploadControl.cpp7
-rw-r--r--Source/WebCore/rendering/RenderFileUploadControl.h3
-rw-r--r--Source/WebCore/rendering/RenderFlexibleBox.cpp431
-rw-r--r--Source/WebCore/rendering/RenderObject.cpp4
-rw-r--r--Source/WebCore/rendering/RenderObject.h6
-rw-r--r--Source/WebKit/android/jni/AndroidHitTestResult.cpp5
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp12
29 files changed, 342 insertions, 303 deletions
diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h
index 7c59f1b..a1db9d6 100644
--- a/Source/JavaScriptCore/wtf/Platform.h
+++ b/Source/JavaScriptCore/wtf/Platform.h
@@ -735,6 +735,7 @@
#define ENABLE_NO_LISTBOX_RENDERING 1
#define ENABLE_LINK_PREFETCH 1
#define ENABLE_WEB_TIMING 1
+#define ENABLE_MEDIA_CAPTURE 1
// Android ENABLE guards not present upstream
#define ENABLE_COMPOSITED_FIXED_ELEMENTS 1 // FIXME: Rename to ENABLE_ANDROID_COMPOSITED_FIXED_ELEMENTS
diff --git a/Source/WebCore/Android.derived.v8bindings.mk b/Source/WebCore/Android.derived.v8bindings.mk
index 546cefe..509d21e 100644
--- a/Source/WebCore/Android.derived.v8bindings.mk
+++ b/Source/WebCore/Android.derived.v8bindings.mk
@@ -31,7 +31,7 @@ js_binding_scripts := \
$(LOCAL_PATH)/bindings/scripts/generate-bindings.pl
# Add ACCELERATED_COMPOSITING=1 and ENABLE_3D_RENDERING=1 for layers support
-FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1 ENABLE_DEVICE_ORIENTATION=1 ENABLE_FILE_READER=1 ENABLE_BLOB=1 ENABLE_WEB_TIMING=1
+FEATURE_DEFINES := ENABLE_ORIENTATION_EVENTS=1 ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_GEOLOCATION=1 ENABLE_CONNECTION=1 ENABLE_APPLICATION_INSTALLED=1 ENABLE_XPATH=1 ENABLE_XSLT=1 ENABLE_DEVICE_ORIENTATION=1 ENABLE_FILE_READER=1 ENABLE_BLOB=1 ENABLE_WEB_TIMING=1 ENABLE_MEDIA_CAPTURE=1
# The defines above should be identical to those for JSC.
FEATURE_DEFINES += V8_BINDING
diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp
index b78a6d0..06e895d 100644
--- a/Source/WebCore/css/CSSParser.cpp
+++ b/Source/WebCore/css/CSSParser.cpp
@@ -5383,6 +5383,8 @@ bool CSSParser::parseRadialGradient(RefPtr<CSSValue>& gradient, CSSGradientRepea
// parseFillPosition advances the args next pointer.
parseFillPosition(args, centerX, centerY);
a = args->current();
+ if (!a)
+ return false;
if (centerX || centerY) {
// Comma
diff --git a/Source/WebCore/css/CSSPrimitiveValue.cpp b/Source/WebCore/css/CSSPrimitiveValue.cpp
index 04f1089..237844e 100644
--- a/Source/WebCore/css/CSSPrimitiveValue.cpp
+++ b/Source/WebCore/css/CSSPrimitiveValue.cpp
@@ -316,7 +316,8 @@ double CSSPrimitiveValue::computeLengthDouble(RenderStyle* style, RenderStyle* r
break;
case CSS_REMS:
applyZoomMultiplier = false;
- factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
+ if (rootStyle)
+ factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize();
break;
case CSS_PX:
break;
diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp
index 0b6fd35..e49ad2a 100644
--- a/Source/WebCore/css/CSSStyleSelector.cpp
+++ b/Source/WebCore/css/CSSStyleSelector.cpp
@@ -1194,7 +1194,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
documentStyle->setVisuallyOrdered(document->visuallyOrdered());
documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1);
documentStyle->setPageScaleTransform(frame ? frame->pageScaleFactor() : 1);
-
+ documentStyle->setUserModify(document->inDesignMode() ? READ_WRITE : READ_ONLY);
+
Element* docElement = document->documentElement();
RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0;
if (docElementRenderer) {
@@ -1236,6 +1237,15 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
return documentStyle.release();
}
+static inline bool isAtShadowBoundary(Element* element)
+{
+ if (!element)
+ return false;
+
+ ContainerNode* parentNode = element->parentNode();
+ return parentNode && parentNode->isShadowBoundary();
+}
+
// If resolveForRootDefault is true, style based on user agent style sheet only. This is used in media queries, where
// relative units are interpreted according to document root element style, styled only with UA stylesheet
@@ -1278,6 +1288,10 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
initForStyleResolve(e, defaultParent);
}
+ // Don't propagate user-modify into shadow DOM
+ if (isAtShadowBoundary(e))
+ m_style->setUserModify(RenderStyle::initialUserModify());
+
m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
m_style = RenderStyle::create();
@@ -1772,15 +1786,6 @@ static void addIntrinsicMargins(RenderStyle* style)
}
}
-static inline bool isAtShadowBoundary(Element* element)
-{
- if (!element)
- return false;
-
- ContainerNode* parentNode = element->parentNode();
- return parentNode && parentNode->isShadowBoundary();
-}
-
void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e)
{
// Cache our original display.
@@ -4966,6 +4971,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
applyProperty(CSSPropertyFontStyle, font->style.get());
applyProperty(CSSPropertyFontVariant, font->variant.get());
applyProperty(CSSPropertyFontWeight, font->weight.get());
+ // The previous properties can dirty our font but they don't try to read the font's
+ // properties back, which is safe. However if font-size is using the 'ex' unit, it will
+ // need query the dirtied font's x-height to get the computed size. To be safe in this
+ // case, let's just update the font now.
+ updateFont();
applyProperty(CSSPropertyFontSize, font->size.get());
m_lineHeightValue = font->lineHeight.get();
diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
index 3b41f43..497bd19 100644
--- a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
+++ b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp
@@ -66,7 +66,8 @@ void WebKitCSSKeyframesRule::setName(const String& name)
// Since the name is used in the keyframe map list in CSSStyleSelector, we need
// to recompute the style sheet to get the updated name.
- stylesheet()->styleSheetChanged();
+ if (stylesheet())
+ stylesheet()->styleSheetChanged();
}
unsigned WebKitCSSKeyframesRule::length() const
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 1b5f55b..7fc628c 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -4083,6 +4083,8 @@ void Document::setTransformSource(PassOwnPtr<TransformSource> source)
void Document::setDesignMode(InheritedBool value)
{
m_designMode = value;
+ for (Frame* frame = m_frame; frame && frame->document(); frame = frame->tree()->traverseNext(m_frame))
+ frame->document()->scheduleForcedStyleRecalc();
}
Document::InheritedBool Document::getDesignMode() const
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 0967ef5..ec5c423 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -770,7 +770,7 @@ bool Node::isContentEditable() const
bool Node::rendererIsEditable(EditableLevel editableLevel) const
{
- if (document()->inDesignMode() || (document()->frame() && document()->frame()->page() && document()->frame()->page()->isEditable()))
+ if (document()->frame() && document()->frame()->page() && document()->frame()->page()->isEditable() && !shadowTreeRootNode())
return true;
// Ideally we'd call ASSERT(!needsStyleRecalc()) here, but
@@ -1614,7 +1614,7 @@ SVGUseElement* Node::svgShadowHost() const
}
#endif
-Node* Node::shadowAncestorNode()
+Node* Node::shadowAncestorNode() const
{
#if ENABLE(SVG)
// SVG elements living in a shadow tree only occur when <use> created them.
@@ -1622,18 +1622,18 @@ Node* Node::shadowAncestorNode()
// but the actual shadow tree element - as main difference to the HTML forms
// shadow tree concept. (This function _could_ be made virtual - opinions?)
if (isSVGElement())
- return this;
+ return const_cast<Node*>(this);
#endif
Node* root = shadowTreeRootNode();
if (root)
return root->shadowHost();
- return this;
+ return const_cast<Node*>(this);
}
-Node* Node::shadowTreeRootNode()
+Node* Node::shadowTreeRootNode() const
{
- Node* root = this;
+ Node* root = const_cast<Node*>(this);
while (root) {
if (root->isShadowRoot() || root->isSVGShadowRoot())
return root;
diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h
index 08b1921..76355c3 100644
--- a/Source/WebCore/dom/Node.h
+++ b/Source/WebCore/dom/Node.h
@@ -218,8 +218,8 @@ public:
virtual bool isShadowBoundary() const { return false; }
virtual bool canHaveLightChildRendererWithShadow() const { return false; }
- Node* shadowAncestorNode();
- Node* shadowTreeRootNode();
+ Node* shadowAncestorNode() const;
+ Node* shadowTreeRootNode() const;
bool isInShadowTree();
// Node's parent, shadow tree host, or SVG use.
ContainerNode* parentOrHostNode() const;
diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp
index 469a94a..268687f 100644
--- a/Source/WebCore/dom/Range.cpp
+++ b/Source/WebCore/dom/Range.cpp
@@ -51,6 +51,8 @@ using namespace std;
static WTF::RefCountedLeakCounter rangeCounter("Range");
#endif
+typedef Vector<RefPtr<Node> > NodeVector;
+
inline Range::Range(PassRefPtr<Document> ownerDocument)
: m_ownerDocument(ownerDocument)
, m_start(m_ownerDocument)
@@ -662,8 +664,6 @@ static inline unsigned lengthOfContentsInNode(Node* node)
PassRefPtr<DocumentFragment> Range::processContents(ActionType action, ExceptionCode& ec)
{
- typedef Vector<RefPtr<Node> > NodeVector;
-
RefPtr<DocumentFragment> fragment;
if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS)
fragment = DocumentFragment::create(m_ownerDocument.get());
@@ -873,9 +873,14 @@ PassRefPtr<Node> Range::processAncestorsAndTheirSiblings(ActionType action, Node
// FIXME: This assertion may fail if DOM is modified during mutation event
// FIXME: Share code with Range::processNodes
ASSERT(!firstChildInAncestorToProcess || firstChildInAncestorToProcess->parentNode() == ancestor);
- RefPtr<Node> next;
- for (Node* child = firstChildInAncestorToProcess.get(); child; child = next.get()) {
- next = direction == ProcessContentsForward ? child->nextSibling() : child->previousSibling();
+
+ NodeVector nodes;
+ for (Node* child = firstChildInAncestorToProcess.get(); child;
+ child = (direction == ProcessContentsForward) ? child->nextSibling() : child->previousSibling())
+ nodes.append(child);
+
+ for (NodeVector::const_iterator it = nodes.begin(); it != nodes.end(); it++) {
+ Node* child = it->get();
switch (action) {
case DELETE_CONTENTS:
ancestor->removeChild(child, ec);
diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp
index c9649d0..4f1bc93 100644
--- a/Source/WebCore/editing/ApplyStyleCommand.cpp
+++ b/Source/WebCore/editing/ApplyStyleCommand.cpp
@@ -1316,8 +1316,10 @@ void ApplyStyleCommand::surroundNodeRangeWithElement(PassRefPtr<Node> passedStar
RefPtr<Node> node = startNode;
while (node) {
RefPtr<Node> next = node->nextSibling();
- removeNode(node);
- appendNode(node, element);
+ if (node->isContentEditable()) {
+ removeNode(node);
+ appendNode(node, element);
+ }
if (node == endNode)
break;
node = next;
diff --git a/Source/WebCore/editing/CompositeEditCommand.cpp b/Source/WebCore/editing/CompositeEditCommand.cpp
index cf2959a..bf515d7 100644
--- a/Source/WebCore/editing/CompositeEditCommand.cpp
+++ b/Source/WebCore/editing/CompositeEditCommand.cpp
@@ -781,7 +781,7 @@ void CompositeEditCommand::cloneParagraphUnderNewElement(Position& start, Positi
appendNode(topNode, blockElement);
RefPtr<Node> lastNode = topNode;
- if (start.deprecatedNode() != outerNode) {
+ if (start.deprecatedNode() != outerNode && lastNode->isElementNode()) {
Vector<RefPtr<Node> > ancestors;
// Insert each node from innerNode to outerNode (excluded) in a list.
diff --git a/Source/WebCore/html/HTMLAttributeNames.in b/Source/WebCore/html/HTMLAttributeNames.in
index 5e0fe7b..578f717 100644
--- a/Source/WebCore/html/HTMLAttributeNames.in
+++ b/Source/WebCore/html/HTMLAttributeNames.in
@@ -58,6 +58,7 @@ bgcolor
bgproperties
border
bordercolor
+capture
cellpadding
cellspacing
char
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index b2b57a2..82e33d1 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -682,11 +682,6 @@ void HTMLElement::setContentEditable(Attribute* attr)
attr->decl()->removeProperty(CSSPropertyWordWrap, false);
attr->decl()->removeProperty(CSSPropertyWebkitNbspMode, false);
attr->decl()->removeProperty(CSSPropertyWebkitLineBreak, false);
- } else if (equalIgnoringCase(enabled, "inherit")) {
- addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueInherit);
- attr->decl()->removeProperty(CSSPropertyWordWrap, false);
- attr->decl()->removeProperty(CSSPropertyWebkitNbspMode, false);
- attr->decl()->removeProperty(CSSPropertyWebkitLineBreak, false);
} else if (equalIgnoringCase(enabled, "plaintext-only")) {
addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly);
addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord);
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 2b262e4..36cdf51 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -1588,4 +1588,24 @@ void HTMLInputElement::handleBeforeTextInsertedEvent(Event* event)
InputElement::handleBeforeTextInsertedEvent(m_data, this, this, event);
}
+#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE)
+String HTMLInputElement::capture() const
+{
+ if (!isFileUpload()) {
+ // capture has no meaning on anything other than file pickers.
+ return String();
+ }
+
+ String capture = fastGetAttribute(captureAttr).lower();
+ if (capture == "camera"
+ || capture == "camcorder"
+ || capture == "microphone"
+ || capture == "filesystem")
+ return capture;
+ // According to the HTML Media Capture specification, the invalid and
+ // missing default value is filesystem.
+ return "filesystem";
+}
+#endif
+
} // namespace
diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h
index 2a98b13..58d86ac 100644
--- a/Source/WebCore/html/HTMLInputElement.h
+++ b/Source/WebCore/html/HTMLInputElement.h
@@ -200,6 +200,10 @@ public:
void updateCheckedRadioButtons();
bool lastChangeWasUserEdit() const;
+
+#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE)
+ String capture() const;
+#endif
protected:
HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl
index f346e10..e1937e4 100644
--- a/Source/WebCore/html/HTMLInputElement.idl
+++ b/Source/WebCore/html/HTMLInputElement.idl
@@ -107,6 +107,9 @@ module html {
attribute [Reflect, EnabledAtRuntime] boolean webkitGrammar;
attribute [DontEnum] EventListener onwebkitspeechchange;
#endif
+#if defined(WTF_PLATFORM_ANDROID) && defined(ENABLE_MEDIA_CAPTURE) && ENABLE_MEDIA_CAPTURE
+ attribute [Reflect] DOMString capture;
+#endif
};
}
diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp
index 5cd2ddd..46e8a12 100644
--- a/Source/WebCore/html/HTMLMediaElement.cpp
+++ b/Source/WebCore/html/HTMLMediaElement.cpp
@@ -238,7 +238,9 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls)
#if !ENABLE(PLUGIN_PROXY_FOR_VIDEO)
if (controls()) {
if (!hasMediaControls()) {
- ensureMediaControls();
+ if (!createMediaControls())
+ return;
+
mediaControls()->reset();
}
mediaControls()->show();
@@ -2739,13 +2741,18 @@ bool HTMLMediaElement::hasMediaControls()
return node && node->isMediaControls();
}
-void HTMLMediaElement::ensureMediaControls()
+bool HTMLMediaElement::createMediaControls()
{
if (hasMediaControls())
- return;
+ return true;
ExceptionCode ec;
- ensureShadowRoot()->appendChild(MediaControls::create(this), ec);
+ RefPtr<MediaControls> controls = MediaControls::create(this);
+ if (!controls)
+ return false;
+
+ ensureShadowRoot()->appendChild(controls, ec);
+ return true;
}
void* HTMLMediaElement::preDispatchEventHandler(Event* event)
@@ -2753,7 +2760,9 @@ void* HTMLMediaElement::preDispatchEventHandler(Event* event)
if (event && event->type() == eventNames().webkitfullscreenchangeEvent) {
if (controls()) {
if (!hasMediaControls()) {
- ensureMediaControls();
+ if (!createMediaControls())
+ return 0;
+
mediaControls()->reset();
}
mediaControls()->show();
diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h
index 2144ea1..0b11861 100644
--- a/Source/WebCore/html/HTMLMediaElement.h
+++ b/Source/WebCore/html/HTMLMediaElement.h
@@ -325,7 +325,7 @@ private:
void refreshCachedTime() const;
bool hasMediaControls();
- void ensureMediaControls();
+ bool createMediaControls();
virtual void* preDispatchEventHandler(Event*);
diff --git a/Source/WebCore/html/shadow/TextControlInnerElements.h b/Source/WebCore/html/shadow/TextControlInnerElements.h
index 2340970..886fbf8 100644
--- a/Source/WebCore/html/shadow/TextControlInnerElements.h
+++ b/Source/WebCore/html/shadow/TextControlInnerElements.h
@@ -101,9 +101,8 @@ private:
virtual void detach();
virtual bool isSpinButtonElement() const { return true; }
- // FIXME: shadowAncestorNode() should be const.
- virtual bool isEnabledFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isEnabledFormControl(); }
- virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); }
+ virtual bool isEnabledFormControl() const { return static_cast<Element*>(shadowAncestorNode())->isEnabledFormControl(); }
+ virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(shadowAncestorNode())->isReadOnlyFormControl(); }
virtual void defaultEventHandler(Event*);
void startRepeatingTimer();
void stopRepeatingTimer();
diff --git a/Source/WebCore/platform/FileChooser.h b/Source/WebCore/platform/FileChooser.h
index ac5e0e6..6c382d1 100644
--- a/Source/WebCore/platform/FileChooser.h
+++ b/Source/WebCore/platform/FileChooser.h
@@ -50,6 +50,9 @@ public:
virtual String acceptTypes() = 0;
virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0;
virtual ~FileChooserClient();
+#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE)
+ virtual String capture() = 0;
+#endif
};
class FileChooser : public RefCounted<FileChooser> {
@@ -79,6 +82,10 @@ public:
// Acceptable MIME types. It's an 'accept' attribute value of the corresponding INPUT element.
String acceptTypes() const { return m_client ? m_client->acceptTypes() : String(); }
+#if PLATFORM(ANDROID) && ENABLE(MEDIA_CAPTURE)
+ String capture() const { return m_client ? m_client->capture() : String(); }
+#endif
+
private:
FileChooser(FileChooserClient*, const Vector<String>& initialFilenames);
void initialize();
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 42d68a0..a3bd41a 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -420,14 +420,18 @@ void RenderBlock::addChildToAnonymousColumnBlocks(RenderObject* newChild, Render
RenderBlock* RenderBlock::containingColumnsBlock(bool allowAnonymousColumnBlock)
{
+ RenderBlock* firstChildIgnoringAnonymousWrappers = 0;
for (RenderObject* curr = this; curr; curr = curr->parent()) {
if (!curr->isRenderBlock() || curr->isFloatingOrPositioned() || curr->isTableCell() || curr->isRoot() || curr->isRenderView() || curr->hasOverflowClip()
|| curr->isInlineBlockOrInlineTable())
return 0;
RenderBlock* currBlock = toRenderBlock(curr);
+ if (!currBlock->createsAnonymousWrapper())
+ firstChildIgnoringAnonymousWrappers = currBlock;
+
if (currBlock->style()->specifiesColumns() && (allowAnonymousColumnBlock || !currBlock->isAnonymousColumnsBlock()))
- return currBlock;
+ return firstChildIgnoringAnonymousWrappers;
if (currBlock->isAnonymousColumnSpanBlock())
return 0;
@@ -443,6 +447,8 @@ RenderBlock* RenderBlock::clone() const
else {
cloneBlock = new (renderArena()) RenderBlock(node());
cloneBlock->setStyle(style());
+ if (!childrenInline() && cloneBlock->firstChild() && cloneBlock->firstChild()->isInline())
+ cloneBlock->makeChildrenNonInline();
}
cloneBlock->setChildrenInline(childrenInline());
return cloneBlock;
@@ -657,12 +663,21 @@ RenderBlock* RenderBlock::columnsBlockForSpanningElement(RenderObject* newChild)
// cross the streams and have to cope with both types of continuations mixed together).
// This function currently supports (1) and (2).
RenderBlock* columnsBlockAncestor = 0;
- if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isFloatingOrPositioned()
- && !newChild->isInline() && !isAnonymousColumnSpanBlock()) {
- if (style()->specifiesColumns())
- columnsBlockAncestor = this;
- else if (parent() && parent()->isRenderBlock())
- columnsBlockAncestor = toRenderBlock(parent())->containingColumnsBlock(false);
+ if (!newChild->isText() && newChild->style()->columnSpan() && !newChild->isBeforeOrAfterContent()
+ && !newChild->isFloatingOrPositioned() && !newChild->isInline() && !isAnonymousColumnSpanBlock()) {
+ columnsBlockAncestor = containingColumnsBlock(false);
+ if (columnsBlockAncestor) {
+ // Make sure that none of the parent ancestors have a continuation.
+ // If yes, we do not want split the block into continuations.
+ RenderObject* curr = this;
+ while (curr && curr != columnsBlockAncestor) {
+ if (curr->isRenderBlock() && toRenderBlock(curr)->continuation()) {
+ columnsBlockAncestor = 0;
+ break;
+ }
+ curr = curr->parent();
+ }
+ }
}
return columnsBlockAncestor;
}
diff --git a/Source/WebCore/rendering/RenderFileUploadControl.cpp b/Source/WebCore/rendering/RenderFileUploadControl.cpp
index 8056662..109d219 100644
--- a/Source/WebCore/rendering/RenderFileUploadControl.cpp
+++ b/Source/WebCore/rendering/RenderFileUploadControl.cpp
@@ -122,6 +122,13 @@ String RenderFileUploadControl::acceptTypes()
return static_cast<HTMLInputElement*>(node())->accept();
}
+#if ENABLE(MEDIA_CAPTURE)
+String RenderFileUploadControl::capture()
+{
+ return static_cast<HTMLInputElement*>(node())->capture();
+}
+#endif
+
void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vector<String>& filenames)
{
if (Chrome* chromePointer = chrome())
diff --git a/Source/WebCore/rendering/RenderFileUploadControl.h b/Source/WebCore/rendering/RenderFileUploadControl.h
index e9fb7f0..b57260d 100644
--- a/Source/WebCore/rendering/RenderFileUploadControl.h
+++ b/Source/WebCore/rendering/RenderFileUploadControl.h
@@ -68,6 +68,9 @@ private:
#endif
String acceptTypes();
void chooseIconForFiles(FileChooser*, const Vector<String>&);
+#if ENABLE(MEDIA_CAPTURE)
+ String capture();
+#endif
Chrome* chrome() const;
int maxFilenameWidth() const;
diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp
index dc5c171..99c7e0b 100644
--- a/Source/WebCore/rendering/RenderFlexibleBox.cpp
+++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp
@@ -43,30 +43,30 @@ namespace WebCore {
class FlexBoxIterator {
public:
FlexBoxIterator(RenderFlexibleBox* parent)
+ : m_box(parent)
+ , m_lastOrdinal(1)
{
- box = parent;
- if (box->style()->boxOrient() == HORIZONTAL && !box->style()->isLeftToRightDirection())
- forward = box->style()->boxDirection() != BNORMAL;
+ if (m_box->style()->boxOrient() == HORIZONTAL && !m_box->style()->isLeftToRightDirection())
+ m_forward = m_box->style()->boxDirection() != BNORMAL;
else
- forward = box->style()->boxDirection() == BNORMAL;
- lastOrdinal = 1;
- if (!forward) {
+ m_forward = m_box->style()->boxDirection() == BNORMAL;
+ if (!m_forward) {
// No choice, since we're going backwards, we have to find out the highest ordinal up front.
- RenderBox* child = box->firstChildBox();
+ RenderBox* child = m_box->firstChildBox();
while (child) {
- if (child->style()->boxOrdinalGroup() > lastOrdinal)
- lastOrdinal = child->style()->boxOrdinalGroup();
+ if (child->style()->boxOrdinalGroup() > m_lastOrdinal)
+ m_lastOrdinal = child->style()->boxOrdinalGroup();
child = child->nextSiblingBox();
}
}
-
+
reset();
}
void reset()
{
- current = 0;
- currentOrdinal = forward ? 0 : lastOrdinal+1;
+ m_currentChild = 0;
+ m_currentOrdinal = m_forward ? 0 : m_lastOrdinal + 1;
}
RenderBox* first()
@@ -74,42 +74,42 @@ public:
reset();
return next();
}
-
+
RenderBox* next()
{
- do {
- if (!current) {
- if (forward) {
- currentOrdinal++;
- if (currentOrdinal > lastOrdinal)
+ do {
+ if (!m_currentChild) {
+ if (m_forward) {
+ ++m_currentOrdinal;
+ if (m_currentOrdinal > m_lastOrdinal)
return 0;
- current = box->firstChildBox();
+ m_currentChild = m_box->firstChildBox();
} else {
- currentOrdinal--;
- if (currentOrdinal == 0)
+ --m_currentOrdinal;
+ if (!m_currentOrdinal)
return 0;
- current = box->lastChildBox();
+ m_currentChild = m_box->lastChildBox();
}
}
else
- current = forward ? current->nextSiblingBox() : current->previousSiblingBox();
- if (current && current->style()->boxOrdinalGroup() > lastOrdinal)
- lastOrdinal = current->style()->boxOrdinalGroup();
- } while (!current || current->style()->boxOrdinalGroup() != currentOrdinal ||
- current->style()->visibility() == COLLAPSE);
- return current;
+ m_currentChild = m_forward ? m_currentChild->nextSiblingBox() : m_currentChild->previousSiblingBox();
+ if (m_currentChild && m_currentChild->style()->boxOrdinalGroup() > m_lastOrdinal)
+ m_lastOrdinal = m_currentChild->style()->boxOrdinalGroup();
+ } while (!m_currentChild || (!m_currentChild->isAnonymous()
+ && (m_currentChild->style()->boxOrdinalGroup() != m_currentOrdinal || m_currentChild->style()->visibility() == COLLAPSE)));
+ return m_currentChild;
}
private:
- RenderFlexibleBox* box;
- RenderBox* current;
- bool forward;
- unsigned int currentOrdinal;
- unsigned int lastOrdinal;
+ RenderFlexibleBox* m_box;
+ RenderBox* m_currentChild;
+ bool m_forward;
+ unsigned int m_currentOrdinal;
+ unsigned int m_lastOrdinal;
};
-
+
RenderFlexibleBox::RenderFlexibleBox(Node* node)
-:RenderBlock(node)
+ : RenderBlock(node)
{
setChildrenInline(false); // All of our children must be block-level
m_flexingChildren = m_stretchingChildren = false;
@@ -119,54 +119,48 @@ RenderFlexibleBox::~RenderFlexibleBox()
{
}
+static int marginWidthForChild(RenderBox* child)
+{
+ // A margin basically has three types: fixed, percentage, and auto (variable).
+ // Auto and percentage margins simply become 0 when computing min/max width.
+ // Fixed margins can be added in as is.
+ Length marginLeft = child->style()->marginLeft();
+ Length marginRight = child->style()->marginRight();
+ int margin = 0;
+ if (marginLeft.isFixed())
+ margin += marginLeft.value();
+ if (marginRight.isFixed())
+ margin += marginRight.value();
+ return margin;
+}
+
void RenderFlexibleBox::calcHorizontalPrefWidths()
{
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- // positioned children don't affect the minmaxwidth
+ // Positioned children and collapsed children don't affect the min/max width.
if (child->isPositioned() || child->style()->visibility() == COLLAPSE)
continue;
- // A margin basically has three types: fixed, percentage, and auto (variable).
- // Auto and percentage margins simply become 0 when computing min/max width.
- // Fixed margins can be added in as is.
- Length ml = child->style()->marginLeft();
- Length mr = child->style()->marginRight();
- int margin = 0, marginLeft = 0, marginRight = 0;
- if (ml.isFixed())
- marginLeft += ml.value();
- if (mr.isFixed())
- marginRight += mr.value();
- margin = marginLeft + marginRight;
-
+ int margin = marginWidthForChild(child);
m_minPreferredLogicalWidth += child->minPreferredLogicalWidth() + margin;
m_maxPreferredLogicalWidth += child->maxPreferredLogicalWidth() + margin;
- }
+ }
}
void RenderFlexibleBox::calcVerticalPrefWidths()
{
for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
- // Positioned children and collapsed children don't affect the min/max width
+ // Positioned children and collapsed children don't affect the min/max width.
if (child->isPositioned() || child->style()->visibility() == COLLAPSE)
continue;
- // A margin basically has three types: fixed, percentage, and auto (variable).
- // Auto/percentage margins simply become 0 when computing min/max width.
- // Fixed margins can be added in as is.
- Length ml = child->style()->marginLeft();
- Length mr = child->style()->marginRight();
- int margin = 0;
- if (ml.isFixed())
- margin += ml.value();
- if (mr.isFixed())
- margin += mr.value();
-
- int w = child->minPreferredLogicalWidth() + margin;
- m_minPreferredLogicalWidth = max(w, m_minPreferredLogicalWidth);
-
- w = child->maxPreferredLogicalWidth() + margin;
- m_maxPreferredLogicalWidth = max(w, m_maxPreferredLogicalWidth);
- }
+ int margin = marginWidthForChild(child);
+ int width = child->minPreferredLogicalWidth() + margin;
+ m_minPreferredLogicalWidth = max(width, m_minPreferredLogicalWidth);
+
+ width = child->maxPreferredLogicalWidth() + margin;
+ m_maxPreferredLogicalWidth = max(width, m_maxPreferredLogicalWidth);
+ }
}
void RenderFlexibleBox::computePreferredLogicalWidths()
@@ -197,7 +191,7 @@ void RenderFlexibleBox::computePreferredLogicalWidths()
m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
}
-
+
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
@@ -222,10 +216,10 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
int previousWidth = width();
int previousHeight = height();
-
+
computeLogicalWidth();
computeLogicalHeight();
-
+
m_overflow.clear();
if (previousWidth != width() || previousHeight != height() ||
@@ -280,7 +274,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
setMaxMarginBeforeValues(pos, neg);
setMaxMarginAfterValues(0, 0);
}
-
+
computeOverflow(oldClientAfterEdge);
statePusher.pop();
@@ -297,15 +291,14 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int /*pageHeight FIXM
// Repaint with our new bounds if they are different from our old bounds.
repainter.repaintAfterLayout();
-
+
setNeedsLayout(false);
}
// The first walk over our kids is to find out if we have any flexible children.
static void gatherFlexChildrenInfo(FlexBoxIterator& iterator, bool relayoutChildren, unsigned int& highestFlexGroup, unsigned int& lowestFlexGroup, bool& haveFlex)
{
- RenderBox* child = iterator.first();
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
// Check to see if this child flexes.
if (!child->isPositioned() && child->style()->boxFlex() > 0.0f) {
// We always have to lay out flexible objects again, since the flex distribution
@@ -322,7 +315,6 @@ static void gatherFlexChildrenInfo(FlexBoxIterator& iterator, bool relayoutChild
if (flexGroup > highestFlexGroup)
highestFlexGroup = flexGroup;
}
- child = iterator.next();
}
}
@@ -343,8 +335,6 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
bool haveFlex = false;
gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestFlexGroup, haveFlex);
- RenderBox* child;
-
RenderBlock::startDelayUpdateScrollInfo();
// We do 2 passes. The first pass is simply to lay everyone out at
@@ -354,31 +344,28 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
setHeight(yPos);
xPos = borderLeft() + paddingLeft();
-
+
// Our first pass is done without flexing. We simply lay the children
// out within the box. We have to do a layout first in order to determine
// our box's intrinsic height.
int maxAscent = 0, maxDescent = 0;
- child = iterator.first();
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
// make sure we relayout children if we need it.
if (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent())))
child->setChildNeedsLayout(true, false);
-
- if (child->isPositioned()) {
- child = iterator.next();
+
+ if (child->isPositioned())
continue;
- }
-
+
// Compute the child's vertical margins.
child->computeBlockDirectionMargins(this);
-
+
if (!child->needsLayout())
child->markForPaginationRelayoutIfNeeded();
// Now do the layout.
child->layoutIfNeeded();
-
+
// Update our height and overflow height.
if (style()->boxAlign() == BBASELINE) {
int ascent = child->firstLineBoxBaseline();
@@ -386,38 +373,35 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
ascent = child->height() + child->marginBottom();
ascent += child->marginTop();
int descent = (child->marginTop() + child->height() + child->marginBottom()) - ascent;
-
+
// Update our maximum ascent.
maxAscent = max(maxAscent, ascent);
-
+
// Update our maximum descent.
maxDescent = max(maxDescent, descent);
-
+
// Now update our height.
setHeight(max(yPos + maxAscent + maxDescent, height()));
}
else
setHeight(max(height(), yPos + child->marginTop() + child->height() + child->marginBottom()));
-
- child = iterator.next();
}
-
+
if (!iterator.first() && hasLineIfEmpty())
setHeight(height() + lineHeight(true, style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
-
+
setHeight(height() + toAdd);
-
+
oldHeight = height();
computeLogicalHeight();
relayoutChildren = false;
if (oldHeight != height())
heightSpecified = true;
-
+
// Now that our height is actually known, we can place our boxes.
m_stretchingChildren = (style()->boxAlign() == BSTRETCH);
- child = iterator.first();
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (child->isPositioned()) {
child->containingBlock()->insertPositionedObject(child);
RenderLayer* childLayer = child->layer();
@@ -427,10 +411,9 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode()))
child->setChildNeedsLayout(true, false);
}
- child = iterator.next();
continue;
}
-
+
// We need to see if this child's height has changed, since we make block elements
// fill the height of a containing box by default.
// Now do a layout.
@@ -438,18 +421,18 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
child->computeLogicalHeight();
if (oldChildHeight != child->height())
child->setChildNeedsLayout(true, false);
-
+
if (!child->needsLayout())
child->markForPaginationRelayoutIfNeeded();
child->layoutIfNeeded();
-
+
// We can place the child now, using our value of box-align.
xPos += child->marginLeft();
int childY = yPos;
switch (style()->boxAlign()) {
case BCENTER:
- childY += child->marginTop() + max(0, (contentHeight() - (child->height() + child->marginTop() + child->marginBottom()))/2);
+ childY += child->marginTop() + max(0, (contentHeight() - (child->height() + child->marginTop() + child->marginBottom())) / 2);
break;
case BBASELINE: {
int ascent = child->firstLineBoxBaseline();
@@ -468,14 +451,12 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
placeChild(child, xPos, childY);
-
+
xPos += child->width() + child->marginRight();
-
- child = iterator.next();
}
remainingSpace = borderLeft() + paddingLeft() + contentWidth() - xPos;
-
+
m_stretchingChildren = false;
if (m_flexingChildren)
haveFlex = false; // We're done.
@@ -500,24 +481,20 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
// forces a totalFlex recomputation).
int groupRemainingSpaceAtBeginning = groupRemainingSpace;
float totalFlex = 0.0f;
- child = iterator.first();
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i))
totalFlex += child->style()->boxFlex();
- child = iterator.next();
}
- child = iterator.first();
int spaceAvailableThisPass = groupRemainingSpace;
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
int allowedFlex = allowedChildFlex(child, expanding, i);
if (allowedFlex) {
int projectedFlex = (allowedFlex == INT_MAX) ? allowedFlex : (int)(allowedFlex * (totalFlex / child->style()->boxFlex()));
spaceAvailableThisPass = expanding ? min(spaceAvailableThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex);
}
- child = iterator.next();
}
- // The flex groups may not have any flexible objects this time around.
+ // The flex groups may not have any flexible objects this time around.
if (!spaceAvailableThisPass || totalFlex == 0.0f) {
// If we just couldn't grow/shrink any more, then it's time to transition to the next flex group.
groupRemainingSpace = 0;
@@ -525,8 +502,7 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
}
// Now distribute the space to objects.
- child = iterator.first();
- while (child && spaceAvailableThisPass && totalFlex) {
+ for (RenderBox* child = iterator.first(); child && spaceAvailableThisPass && totalFlex; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
int spaceAdd = (int)(spaceAvailableThisPass * (child->style()->boxFlex()/totalFlex));
if (spaceAdd) {
@@ -538,16 +514,14 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
spaceAvailableThisPass -= spaceAdd;
remainingSpace -= spaceAdd;
groupRemainingSpace -= spaceAdd;
-
+
totalFlex -= child->style()->boxFlex();
}
- child = iterator.next();
}
if (groupRemainingSpace == groupRemainingSpaceAtBeginning) {
- // this is not advancing, avoid getting stuck by distributing the remaining pixels
- child = iterator.first();
+ // This is not advancing, avoid getting stuck by distributing the remaining pixels.
int spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
- while (child && groupRemainingSpace) {
+ for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
child->setOverrideSize(child->overrideWidth() + spaceAdd);
m_flexingChildren = true;
@@ -555,7 +529,6 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
remainingSpace -= spaceAdd;
groupRemainingSpace -= spaceAdd;
}
- child = iterator.next();
}
}
} while (groupRemainingSpace);
@@ -578,59 +551,47 @@ void RenderFlexibleBox::layoutHorizontalBox(bool relayoutChildren)
if (style()->boxPack() == BJUSTIFY) {
// Determine the total number of children.
int totalChildren = 0;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
- totalChildren++;
- child = iterator.next();
+ ++totalChildren;
}
// Iterate over the children and space them out according to the
// justification level.
if (totalChildren > 1) {
- totalChildren--;
+ --totalChildren;
bool firstChild = true;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
if (firstChild) {
firstChild = false;
- child = iterator.next();
continue;
}
offset += remainingSpace/totalChildren;
remainingSpace -= (remainingSpace/totalChildren);
- totalChildren--;
+ --totalChildren;
- placeChild(child, child->x()+offset, child->y());
- child = iterator.next();
+ placeChild(child, child->x() + offset, child->y());
}
}
} else {
if (style()->boxPack() == BCENTER)
- offset += remainingSpace/2;
+ offset += remainingSpace / 2;
else // END for LTR, START for RTL
offset += remainingSpace;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
- placeChild(child, child->x()+offset, child->y());
- child = iterator.next();
+
+ placeChild(child, child->x() + offset, child->y());
}
}
}
-
+
// So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
@@ -655,8 +616,6 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
bool haveFlex = false;
gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestFlexGroup, haveFlex);
- RenderBox* child;
-
// We confine the line clamp ugliness to vertical flexible boxes (thus keeping it out of
// mainstream block layout); this is not really part of the XUL box model.
bool haveLineClamp = !style()->lineClamp().isNone();
@@ -673,12 +632,11 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
setHeight(borderTop() + paddingTop());
int minHeight = height() + toAdd;
- child = iterator.first();
- while (child) {
- // make sure we relayout children if we need it.
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ // Make sure we relayout children if we need it.
if (!haveLineClamp && (relayoutChildren || (child->isReplaced() && (child->style()->width().isPercent() || child->style()->height().isPercent()))))
child->setChildNeedsLayout(true, false);
-
+
if (child->isPositioned()) {
child->containingBlock()->insertPositionedObject(child);
RenderLayer* childLayer = child->layer();
@@ -688,28 +646,27 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode()))
child->setChildNeedsLayout(true, false);
}
- child = iterator.next();
continue;
- }
-
+ }
+
// Compute the child's vertical margins.
child->computeBlockDirectionMargins(this);
-
+
// Add in the child's marginTop to our height.
setHeight(height() + child->marginTop());
-
+
if (!child->needsLayout())
child->markForPaginationRelayoutIfNeeded();
// Now do a layout.
child->layoutIfNeeded();
-
+
// We can place the child now, using our value of box-align.
int childX = borderLeft() + paddingLeft();
switch (style()->boxAlign()) {
case BCENTER:
case BBASELINE: // Baseline just maps to center for vertical boxes
- childX += child->marginLeft() + max(0, (contentWidth() - (child->width() + child->marginLeft() + child->marginRight()))/2);
+ childX += child->marginLeft() + max(0, (contentWidth() - (child->width() + child->marginLeft() + child->marginRight())) / 2);
break;
case BEND:
if (!style()->isLeftToRightDirection())
@@ -724,19 +681,17 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
childX += contentWidth() - child->marginRight() - child->width();
break;
}
-
+
// Place the child.
placeChild(child, childX, height());
setHeight(height() + child->height() + child->marginBottom());
-
- child = iterator.next();
}
yPos = height();
-
+
if (!iterator.first() && hasLineIfEmpty())
setHeight(height() + lineHeight(true, style()->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes));
-
+
setHeight(height() + toAdd);
// Negative margins can cause our height to shrink below our minimal height (border/padding).
@@ -751,7 +706,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
heightSpecified = true;
remainingSpace = borderTop() + paddingTop() + contentHeight() - yPos;
-
+
if (m_flexingChildren)
haveFlex = false; // We're done.
else if (haveFlex) {
@@ -775,33 +730,28 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
// forces a totalFlex recomputation).
int groupRemainingSpaceAtBeginning = groupRemainingSpace;
float totalFlex = 0.0f;
- child = iterator.first();
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i))
totalFlex += child->style()->boxFlex();
- child = iterator.next();
}
- child = iterator.first();
int spaceAvailableThisPass = groupRemainingSpace;
- while (child) {
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
int allowedFlex = allowedChildFlex(child, expanding, i);
if (allowedFlex) {
int projectedFlex = (allowedFlex == INT_MAX) ? allowedFlex : (int)(allowedFlex * (totalFlex / child->style()->boxFlex()));
spaceAvailableThisPass = expanding ? min(spaceAvailableThisPass, projectedFlex) : max(spaceAvailableThisPass, projectedFlex);
}
- child = iterator.next();
}
- // The flex groups may not have any flexible objects this time around.
+ // The flex groups may not have any flexible objects this time around.
if (!spaceAvailableThisPass || totalFlex == 0.0f) {
// If we just couldn't grow/shrink any more, then it's time to transition to the next flex group.
groupRemainingSpace = 0;
continue;
}
-
+
// Now distribute the space to objects.
- child = iterator.first();
- while (child && spaceAvailableThisPass && totalFlex) {
+ for (RenderBox* child = iterator.first(); child && spaceAvailableThisPass && totalFlex; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
int spaceAdd = (int)(spaceAvailableThisPass * (child->style()->boxFlex()/totalFlex));
if (spaceAdd) {
@@ -813,16 +763,14 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
spaceAvailableThisPass -= spaceAdd;
remainingSpace -= spaceAdd;
groupRemainingSpace -= spaceAdd;
-
+
totalFlex -= child->style()->boxFlex();
}
- child = iterator.next();
}
if (groupRemainingSpace == groupRemainingSpaceAtBeginning) {
- // this is not advancing, avoid getting stuck by distributing the remaining pixels
- child = iterator.first();
+ // This is not advancing, avoid getting stuck by distributing the remaining pixels.
int spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
- while (child && groupRemainingSpace) {
+ for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
child->setOverrideSize(child->overrideHeight() + spaceAdd);
m_flexingChildren = true;
@@ -830,7 +778,6 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
remainingSpace -= spaceAdd;
groupRemainingSpace -= spaceAdd;
}
- child = iterator.next();
}
}
} while (groupRemainingSpace);
@@ -839,7 +786,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
// We didn't find any children that could grow.
if (haveFlex && !m_flexingChildren)
haveFlex = false;
- }
+ }
} while (haveFlex);
RenderBlock::finishDelayUpdateScrollInfo();
@@ -850,54 +797,42 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
if (style()->boxPack() == BJUSTIFY) {
// Determine the total number of children.
int totalChildren = 0;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
- totalChildren++;
- child = iterator.next();
+
+ ++totalChildren;
}
-
+
// Iterate over the children and space them out according to the
// justification level.
if (totalChildren > 1) {
- totalChildren--;
+ --totalChildren;
bool firstChild = true;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
-
+
if (firstChild) {
firstChild = false;
- child = iterator.next();
continue;
}
offset += remainingSpace/totalChildren;
remainingSpace -= (remainingSpace/totalChildren);
- totalChildren--;
- placeChild(child, child->x(), child->y()+offset);
- child = iterator.next();
+ --totalChildren;
+ placeChild(child, child->x(), child->y() + offset);
}
}
} else {
if (style()->boxPack() == BCENTER)
- offset += remainingSpace/2;
+ offset += remainingSpace / 2;
else // END
offset += remainingSpace;
- child = iterator.first();
- while (child) {
- if (child->isPositioned()) {
- child = iterator.next();
+ for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
+ if (child->isPositioned())
continue;
- }
- placeChild(child, child->x(), child->y()+offset);
- child = iterator.next();
+ placeChild(child, child->x(), child->y() + offset);
}
}
}
@@ -905,7 +840,7 @@ void RenderFlexibleBox::layoutVerticalBox(bool relayoutChildren)
// So that the computeLogicalHeight in layoutBlock() knows to relayout positioned objects because of
// a height change, we revert our height back to the intrinsic height before returning.
if (heightSpecified)
- setHeight(oldHeight);
+ setHeight(oldHeight);
}
void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutChildren)
@@ -940,16 +875,16 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
if (child->isPositioned() || !child->style()->height().isAuto() || !child->isBlockFlow())
continue;
-
+
RenderBlock* blockChild = toRenderBlock(child);
int lineCount = blockChild->lineCount();
if (lineCount <= numVisibleLines)
continue;
-
+
int newHeight = blockChild->heightForLineCount(numVisibleLines);
if (newHeight == child->height())
continue;
-
+
child->setChildNeedsLayout(true, false);
child->setOverrideSize(newHeight);
m_flexingChildren = true;
@@ -962,11 +897,11 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
continue;
// Get the last line
- RootInlineBox* lastLine = blockChild->lineAtIndex(lineCount-1);
+ RootInlineBox* lastLine = blockChild->lineAtIndex(lineCount - 1);
if (!lastLine)
continue;
- RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines-1);
+ RootInlineBox* lastVisibleLine = blockChild->lineAtIndex(numVisibleLines - 1);
if (!lastVisibleLine)
continue;
@@ -975,7 +910,7 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1));
const Font& font = style(numVisibleLines == 1)->font();
- // Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
+ // Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
int totalWidth;
InlineBox* anchorBox = lastLine->lastChild();
if (anchorBox && anchorBox->renderer()->style()->isLink())
@@ -988,7 +923,7 @@ void RenderFlexibleBox::applyLineClamp(FlexBoxIterator& iterator, bool relayoutC
// See if this width can be accommodated on the last visible line
RenderBlock* destBlock = toRenderBlock(lastVisibleLine->renderer());
RenderBlock* srcBlock = toRenderBlock(lastLine->renderer());
-
+
// FIXME: Directions of src/destBlock could be different from our direction and from one another.
if (!srcBlock->style()->isLeftToRightDirection())
continue;
@@ -1028,57 +963,55 @@ int RenderFlexibleBox::allowedChildFlex(RenderBox* child, bool expanding, unsign
{
if (child->isPositioned() || child->style()->boxFlex() == 0.0f || child->style()->boxFlexGroup() != group)
return 0;
-
+
if (expanding) {
if (isHorizontal()) {
// FIXME: For now just handle fixed values.
- int maxW = INT_MAX;
- int w = child->overrideWidth() - child->borderAndPaddingWidth();
- if (!child->style()->maxWidth().isUndefined() &&
- child->style()->maxWidth().isFixed())
- maxW = child->style()->maxWidth().value();
+ int maxWidth = INT_MAX;
+ int width = child->overrideWidth() - child->borderAndPaddingWidth();
+ if (!child->style()->maxWidth().isUndefined() && child->style()->maxWidth().isFixed())
+ maxWidth = child->style()->maxWidth().value();
else if (child->style()->maxWidth().type() == Intrinsic)
- maxW = child->maxPreferredLogicalWidth();
+ maxWidth = child->maxPreferredLogicalWidth();
else if (child->style()->maxWidth().type() == MinIntrinsic)
- maxW = child->minPreferredLogicalWidth();
- if (maxW == INT_MAX)
- return maxW;
- return max(0, maxW - w);
+ maxWidth = child->minPreferredLogicalWidth();
+ if (maxWidth == INT_MAX)
+ return maxWidth;
+ return max(0, maxWidth - width);
} else {
// FIXME: For now just handle fixed values.
- int maxH = INT_MAX;
- int h = child->overrideHeight() - child->borderAndPaddingHeight();
- if (!child->style()->maxHeight().isUndefined() &&
- child->style()->maxHeight().isFixed())
- maxH = child->style()->maxHeight().value();
- if (maxH == INT_MAX)
- return maxH;
- return max(0, maxH - h);
+ int maxHeight = INT_MAX;
+ int height = child->overrideHeight() - child->borderAndPaddingHeight();
+ if (!child->style()->maxHeight().isUndefined() && child->style()->maxHeight().isFixed())
+ maxHeight = child->style()->maxHeight().value();
+ if (maxHeight == INT_MAX)
+ return maxHeight;
+ return max(0, maxHeight - height);
}
}
// FIXME: For now just handle fixed values.
if (isHorizontal()) {
- int minW = child->minPreferredLogicalWidth();
- int w = child->overrideWidth() - child->borderAndPaddingWidth();
+ int minWidth = child->minPreferredLogicalWidth();
+ int width = child->overrideWidth() - child->borderAndPaddingWidth();
if (child->style()->minWidth().isFixed())
- minW = child->style()->minWidth().value();
+ minWidth = child->style()->minWidth().value();
else if (child->style()->minWidth().type() == Intrinsic)
- minW = child->maxPreferredLogicalWidth();
+ minWidth = child->maxPreferredLogicalWidth();
else if (child->style()->minWidth().type() == MinIntrinsic)
- minW = child->minPreferredLogicalWidth();
-
- int allowedShrinkage = min(0, minW - w);
+ minWidth = child->minPreferredLogicalWidth();
+
+ int allowedShrinkage = min(0, minWidth - width);
return allowedShrinkage;
} else {
if (child->style()->minHeight().isFixed()) {
- int minH = child->style()->minHeight().value();
- int h = child->overrideHeight() - child->borderAndPaddingHeight();
- int allowedShrinkage = min(0, minH - h);
+ int minHeight = child->style()->minHeight().value();
+ int height = child->overrideHeight() - child->borderAndPaddingHeight();
+ int allowedShrinkage = min(0, minHeight - height);
return allowedShrinkage;
}
}
-
+
return 0;
}
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index 8caef04..f37753e 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -2029,6 +2029,10 @@ RenderObject* RenderObject::container(RenderBoxModelObject* repaintContainer, bo
while (o && o->style()->position() == StaticPosition && !o->isRenderView() && !(o->hasTransform() && o->isRenderBlock())) {
if (repaintContainerSkipped && o == repaintContainer)
*repaintContainerSkipped = true;
+#if ENABLE(SVG)
+ if (o->isSVGForeignObject()) // foreignObject is the containing block for contents inside it
+ break;
+#endif
o = o->parent();
}
}
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h
index 005c453..f5fe562 100644
--- a/Source/WebCore/rendering/RenderObject.h
+++ b/Source/WebCore/rendering/RenderObject.h
@@ -312,6 +312,7 @@ public:
inline bool isBeforeContent() const;
inline bool isAfterContent() const;
+ inline bool isBeforeOrAfterContent() const;
static inline bool isBeforeContent(const RenderObject* obj) { return obj && obj->isBeforeContent(); }
static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); }
@@ -917,6 +918,11 @@ inline bool RenderObject::isAfterContent() const
return true;
}
+inline bool RenderObject::isBeforeOrAfterContent() const
+{
+ return isBeforeContent() || isAfterContent();
+}
+
inline void RenderObject::setNeedsLayout(bool b, bool markParents)
{
bool alreadyNeededLayout = m_needsLayout;
diff --git a/Source/WebKit/android/jni/AndroidHitTestResult.cpp b/Source/WebKit/android/jni/AndroidHitTestResult.cpp
index 9be5613..a135c42 100644
--- a/Source/WebKit/android/jni/AndroidHitTestResult.cpp
+++ b/Source/WebKit/android/jni/AndroidHitTestResult.cpp
@@ -141,9 +141,10 @@ void AndroidHitTestResult::buildHighlightRects()
IntPoint frameOffset = m_webViewCore->convertGlobalContentToFrameContent(IntPoint(), frame);
RenderObject* renderer = node->renderer();
Vector<FloatQuad> quads;
- renderer->absoluteFocusRingQuads(quads);
+ if (renderer->isInline())
+ renderer->absoluteFocusRingQuads(quads);
if (!quads.size())
- renderer->absoluteQuads(quads); // No fancy rings, grab some backups
+ renderer->absoluteQuads(quads); // No fancy rings, grab a bounding box
for (size_t i = 0; i < quads.size(); i++) {
IntRect boundingBox = quads[i].enclosingBoundingBox();
boundingBox.move(-frameOffset.x(), -frameOffset.y());
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index ae00941..7da8103 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -457,7 +457,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(IIZZ)V");
m_javaGlue->m_contentDraw = GetJMethod(env, clazz, "contentDraw", "()V");
m_javaGlue->m_requestListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[I[I)V");
- m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;)Ljava/lang/String;");
+ m_javaGlue->m_openFileChooser = GetJMethod(env, clazz, "openFileChooser", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;");
m_javaGlue->m_requestSingleListBox = GetJMethod(env, clazz, "requestListBox", "([Ljava/lang/String;[II)V");
m_javaGlue->m_jsAlert = GetJMethod(env, clazz, "jsAlert", "(Ljava/lang/String;Ljava/lang/String;)V");
m_javaGlue->m_jsConfirm = GetJMethod(env, clazz, "jsConfirm", "(Ljava/lang/String;Ljava/lang/String;)Z");
@@ -3008,11 +3008,19 @@ void WebViewCore::openFileChooser(PassRefPtr<WebCore::FileChooser> chooser)
return;
WTF::String acceptType = chooser->acceptTypes();
+ WTF::String capture;
+
+#if ENABLE(MEDIA_CAPTURE)
+ capture = chooser->capture();
+#endif
+
jstring jAcceptType = wtfStringToJstring(env, acceptType, true);
+ jstring jCapture = wtfStringToJstring(env, capture, true);
jstring jName = (jstring) env->CallObjectMethod(
- javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType);
+ javaObject.get(), m_javaGlue->m_openFileChooser, jAcceptType, jCapture);
checkException(env);
env->DeleteLocalRef(jAcceptType);
+ env->DeleteLocalRef(jCapture);
WTF::String wtfString = jstringToWtfString(env, jName);
env->DeleteLocalRef(jName);