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/Android.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/platform/graphics/Gradient.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h4
-rw-r--r--Source/WebCore/platform/graphics/android/GradientAndroid.cpp116
-rw-r--r--Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp71
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/ImageTexture.h2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/Surface.h2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp41
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h4
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp11
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h6
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TilePainter.h3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp6
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/TileTexture.h4
-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.cpp47
-rw-r--r--Source/WebKit/android/jni/WebViewCore.h1
49 files changed, 472 insertions, 501 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/Android.mk b/Source/WebCore/Android.mk
index 3cf8d54..794a4a8 100644
--- a/Source/WebCore/Android.mk
+++ b/Source/WebCore/Android.mk
@@ -634,7 +634,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/WidthIterator.cpp \
\
platform/graphics/android/BitmapAllocatorAndroid.cpp \
- platform/graphics/android/GradientAndroid.cpp \
platform/graphics/android/GraphicsLayerAndroid.cpp \
platform/graphics/android/GLWebViewState.cpp \
platform/graphics/android/ImageAndroid.cpp \
@@ -728,6 +727,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/skia/FloatPointSkia.cpp \
platform/graphics/skia/FloatRectSkia.cpp \
platform/graphics/skia/GlyphPageTreeNodeSkia.cpp \
+ platform/graphics/skia/GradientSkia.cpp \
platform/graphics/skia/IntPointSkia.cpp \
platform/graphics/skia/IntRectSkia.cpp \
platform/graphics/skia/NativeImageSkia.cpp \
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/platform/graphics/Gradient.cpp b/Source/WebCore/platform/graphics/Gradient.cpp
index 7541646..7e3984f 100644
--- a/Source/WebCore/platform/graphics/Gradient.cpp
+++ b/Source/WebCore/platform/graphics/Gradient.cpp
@@ -221,7 +221,7 @@ void Gradient::setGradientSpaceTransform(const AffineTransform& gradientSpaceTra
setPlatformGradientSpaceTransform(gradientSpaceTransformation);
}
-#if !(USE(SKIA) && !PLATFORM(ANDROID)) && !USE(CAIRO)
+#if !USE(SKIA) && !USE(CAIRO)
void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&)
{
}
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 36e25c9..8581a8e 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -70,7 +70,7 @@ GLWebViewState::GLWebViewState()
, m_goingLeft(false)
, m_scale(1)
, m_layersRenderingMode(kAllTextures)
- , m_surfaceCollectionManager(this)
+ , m_surfaceCollectionManager()
{
m_viewport.setEmpty();
@@ -302,9 +302,10 @@ int GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
bool shouldDraw)
{
TilesManager* tilesManager = TilesManager::instance();
- tilesManager->getProfiler()->nextFrame(viewport.fLeft, viewport.fTop,
- viewport.fRight, viewport.fBottom,
- scale);
+ if (shouldDraw)
+ tilesManager->getProfiler()->nextFrame(viewport.fLeft, viewport.fTop,
+ viewport.fRight, viewport.fBottom,
+ scale);
tilesManager->incDrawGLCount();
ALOGV("drawGL, rect/viewRect(%d, %d, %d, %d), viewport/visibleRect(%.2f, %.2f, %.2f, %.2f)",
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index 6d969dd..2b28619 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -192,10 +192,6 @@ public:
bool goingDown() { return m_goingDown; }
bool goingLeft() { return m_goingLeft; }
- void setDirection(bool goingDown, bool goingLeft) {
- m_goingDown = goingDown;
- m_goingLeft = goingLeft;
- }
float scale() { return m_scale; }
diff --git a/Source/WebCore/platform/graphics/android/GradientAndroid.cpp b/Source/WebCore/platform/graphics/android/GradientAndroid.cpp
deleted file mode 100644
index 7bc69c5..0000000
--- a/Source/WebCore/platform/graphics/android/GradientAndroid.cpp
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2006, The Android Open Source Project
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "Gradient.h"
-
-#include "CSSParser.h"
-#include "GraphicsContext.h"
-#include "NotImplemented.h"
-#include "SkCanvas.h"
-#include "SkColorShader.h"
-#include "SkGradientShader.h"
-#include "SkPaint.h"
-
-namespace WebCore {
-
-void Gradient::platformDestroy()
-{
- delete m_gradient;
- m_gradient = 0;
-}
-
-static U8CPU F2B(float x)
-{
- return (int)(x * 255);
-}
-
-SkShader* Gradient::platformGradient()
-{
- if (m_gradient)
- return m_gradient;
-
- // need to ensure that the m_stops array is sorted. We call getColor()
- // which, as a side effect, does the sort.
- // TODO: refactor Gradient.h to formally expose a sort method
- {
- float r, g, b, a;
- this->getColor(0, &r, &g, &b, &a);
- }
-
- SkShader::TileMode mode = SkShader::kClamp_TileMode;
- switch (m_spreadMethod) {
- case SpreadMethodReflect:
- mode = SkShader::kMirror_TileMode;
- break;
- case SpreadMethodRepeat:
- mode = SkShader::kRepeat_TileMode;
- break;
- case SpreadMethodPad:
- mode = SkShader::kClamp_TileMode;
- break;
- }
-
- SkPoint pts[2] = { m_p0, m_p1 }; // convert to SkPoint
-
- const size_t count = m_stops.size();
- SkAutoMalloc storage(count * (sizeof(SkColor) + sizeof(SkScalar)));
- SkColor* colors = (SkColor*)storage.get();
- SkScalar* pos = (SkScalar*)(colors + count);
-
- Vector<ColorStop>::iterator iter = m_stops.begin();
- for (int i = 0; iter != m_stops.end(); i++) {
- pos[i] = SkFloatToScalar(iter->stop);
- colors[i] = SkColorSetARGB(F2B(iter->alpha), F2B(iter->red),
- F2B(iter->green), F2B(iter->blue));
- ++iter;
- }
-
- if (m_radial) {
- m_gradient = SkGradientShader::CreateTwoPointRadial(pts[0],
- SkFloatToScalar(m_r0),
- pts[1],
- SkFloatToScalar(m_r1),
- colors, pos, count, mode);
- } else
- m_gradient = SkGradientShader::CreateLinear(pts, colors, pos, count, mode);
-
- if (!m_gradient)
- m_gradient = new SkColorShader(0);
-
- SkMatrix matrix = m_gradientSpaceTransformation;
- m_gradient->setLocalMatrix(matrix);
-
- return m_gradient;
-}
-
-void Gradient::fill(GraphicsContext* context, const FloatRect& rect)
-{
- context->setFillGradient(this);
- context->fillRect(rect);
-}
-
-
-} //namespace
diff --git a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp
index 12b53a3..f2d1400 100644
--- a/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/context/GraphicsContextAndroid.cpp
@@ -66,13 +66,31 @@ private:
PlatformGraphicsContext* m_context;
};
-static SkShader* extractShader(Pattern* pat, Gradient* grad)
+static void syncPlatformContext(GraphicsContext* gc)
{
- if (pat)
- return pat->platformPattern(AffineTransform());
- else if (grad)
- return grad->platformGradient();
- return 0;
+ // Stroke and fill sometimes reference each other, so always
+ // sync them both to make sure our state is consistent.
+
+ PlatformGraphicsContext* pgc = gc->platformContext();
+ Gradient* grad = gc->state().fillGradient.get();
+ Pattern* pat = gc->state().fillPattern.get();
+
+ if (grad)
+ pgc->setFillShader(grad->platformGradient());
+ else if (pat)
+ pgc->setFillShader(pat->platformPattern(AffineTransform()));
+ else
+ pgc->setFillColor(gc->state().fillColor);
+
+ grad = gc->state().strokeGradient.get();
+ pat = gc->state().strokePattern.get();
+
+ if (grad)
+ pgc->setStrokeShader(grad->platformGradient());
+ else if (pat)
+ pgc->setStrokeShader(pat->platformPattern(AffineTransform()));
+ else
+ pgc->setStrokeColor(gc->state().strokeColor);
}
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -137,6 +155,7 @@ void GraphicsContext::drawRect(const IntRect& rect)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawRect(rect);
}
@@ -146,6 +165,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawLine(point1, point2);
}
@@ -154,6 +174,7 @@ void GraphicsContext::drawLineForText(const FloatPoint& pt, float width, bool /*
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawLineForText(pt, width);
}
@@ -163,6 +184,7 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width,
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawLineForTextChecking(pt, width, style);
}
@@ -172,6 +194,7 @@ void GraphicsContext::drawEllipse(const IntRect& rect)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawEllipse(rect);
}
@@ -180,6 +203,7 @@ void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->strokeArc(r, startAngle, angleSpan);
}
@@ -189,6 +213,7 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints, const FloatPoint* poin
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawConvexPolygon(numPoints, points, shouldAntialias);
}
@@ -199,6 +224,7 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->fillRoundedRect(rect, topLeft, topRight,
bottomLeft, bottomRight, color, colorSpace);
}
@@ -208,6 +234,7 @@ void GraphicsContext::fillRect(const FloatRect& rect)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->fillRect(rect);
}
@@ -216,6 +243,7 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& color, ColorS
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->fillRect(rect, color, colorSpace);
}
@@ -308,6 +336,7 @@ void GraphicsContext::setupFillPaint(SkPaint* paint)
{
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->setupPaintFill(paint);
}
@@ -315,6 +344,7 @@ void GraphicsContext::setupStrokePaint(SkPaint* paint)
{
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->setupPaintStroke(paint, 0);
}
@@ -322,14 +352,12 @@ bool GraphicsContext::setupShadowPaint(SkPaint* paint, SkPoint* offset)
{
if (paintingDisabled())
return false;
+ syncPlatformContext(this);
return platformContext()->setupPaintShadow(paint, offset);
}
void GraphicsContext::setPlatformStrokeColor(const Color& c, ColorSpace)
{
- if (paintingDisabled())
- return;
- platformContext()->setStrokeColor(c);
}
void GraphicsContext::setPlatformStrokeThickness(float f)
@@ -348,9 +376,6 @@ void GraphicsContext::setPlatformStrokeStyle(StrokeStyle style)
void GraphicsContext::setPlatformFillColor(const Color& c, ColorSpace)
{
- if (paintingDisabled())
- return;
- platformContext()->setFillColor(c);
}
void GraphicsContext::setPlatformShadow(const FloatSize& size, float blur, const Color& color, ColorSpace)
@@ -384,6 +409,7 @@ void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawFocusRing(rects, width, offset, color);
}
@@ -424,6 +450,7 @@ void GraphicsContext::clearRect(const FloatRect& rect)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->clearRect(rect);
}
@@ -432,6 +459,7 @@ void GraphicsContext::strokeRect(const FloatRect& rect, float lineWidth)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->strokeRect(rect, lineWidth);
}
@@ -520,34 +548,18 @@ void GraphicsContext::setPlatformShouldAntialias(bool useAA)
void GraphicsContext::setPlatformFillGradient(Gradient* fillGradient)
{
- if (paintingDisabled())
- return;
- SkShader* shader = extractShader(0, fillGradient);
- platformContext()->setFillShader(shader);
}
void GraphicsContext::setPlatformFillPattern(Pattern* fillPattern)
{
- if (paintingDisabled())
- return;
- SkShader* shader = extractShader(fillPattern, 0);
- platformContext()->setFillShader(shader);
}
void GraphicsContext::setPlatformStrokeGradient(Gradient* strokeGradient)
{
- if (paintingDisabled())
- return;
- SkShader* shader = extractShader(0, strokeGradient);
- platformContext()->setStrokeShader(shader);
}
void GraphicsContext::setPlatformStrokePattern(Pattern* strokePattern)
{
- if (paintingDisabled())
- return;
- SkShader* shader = extractShader(strokePattern, 0);
- platformContext()->setStrokeShader(shader);
}
AffineTransform GraphicsContext::getCTM() const
@@ -579,6 +591,7 @@ void GraphicsContext::fillPath(const Path& pathToFill)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->fillPath(pathToFill, fillRule());
}
@@ -587,6 +600,7 @@ void GraphicsContext::strokePath(const Path& pathToStroke)
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->strokePath(pathToStroke);
}
@@ -634,6 +648,7 @@ void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run,
if (paintingDisabled())
return;
+ syncPlatformContext(this);
platformContext()->drawHighlightForText(font, run, point, h, backgroundColor,
colorSpace, from, to, isActive);
}
diff --git a/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp b/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp
index 833aea9..8bb1755 100644
--- a/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/BaseRenderer.cpp
@@ -112,7 +112,7 @@ void BaseRenderer::renderTiledContent(TileRenderInfo& renderInfo)
setupPartialInval(renderInfo, &canvas);
canvas.translate(-renderInfo.x * tileSize.width(), -renderInfo.y * tileSize.height());
canvas.scale(renderInfo.scale, renderInfo.scale);
- renderInfo.tilePainter->paint(renderInfo.baseTile, &canvas);
+ renderInfo.tilePainter->paint(&canvas);
if (renderInfo.baseTile && renderInfo.baseTile->backTexture())
checkForPureColor(renderInfo, &canvas);
else
diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
index 9890331..cd43c03 100644
--- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.cpp
@@ -215,14 +215,14 @@ float ImageTexture::opacity()
return m_layer->drawOpacity();
}
-bool ImageTexture::paint(Tile* tile, SkCanvas* canvas)
+bool ImageTexture::paint(SkCanvas* canvas)
{
if (!m_picture) {
ALOGV("IT %p COULDNT PAINT, NO PICTURE", this);
return false;
}
- ALOGV("IT %p painting tile %d, %d with picture %p", this, tile->x(), tile->y(), m_picture);
+ ALOGV("IT %p painting with picture %p", this, m_picture);
canvas->drawPicture(*m_picture);
return true;
diff --git a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h
index 34430f1..9e1de32 100644
--- a/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h
+++ b/Source/WebCore/platform/graphics/android/rendering/ImageTexture.h
@@ -86,7 +86,7 @@ public:
bool equalsCRC(unsigned crc);
// methods used by TileGrid
- virtual bool paint(Tile* tile, SkCanvas* canvas);
+ virtual bool paint(SkCanvas* canvas);
virtual float opacity();
int nbTextures();
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
index 43b0b77..a9ebd1e 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.cpp
@@ -298,7 +298,7 @@ bool Surface::isBase()
return getFirstLayer()->subclassType() == LayerAndroid::BaseLayer;
}
-bool Surface::paint(Tile* tile, SkCanvas* canvas)
+bool Surface::paint(SkCanvas* canvas)
{
if (singleLayer()) {
getFirstLayer()->contentDraw(canvas, Layer::UnmergedLayers);
diff --git a/Source/WebCore/platform/graphics/android/rendering/Surface.h b/Source/WebCore/platform/graphics/android/rendering/Surface.h
index d197d43..0fced47 100644
--- a/Source/WebCore/platform/graphics/android/rendering/Surface.h
+++ b/Source/WebCore/platform/graphics/android/rendering/Surface.h
@@ -63,7 +63,7 @@ public:
bool isBase();
// TilePainter methods
- virtual bool paint(Tile* tile, SkCanvas* canvas);
+ virtual bool paint(SkCanvas* canvas);
virtual float opacity();
virtual Color* background();
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
index 7c8f570..b8d751c 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
@@ -42,6 +42,7 @@ SurfaceBacking::SurfaceBacking(bool isBaseSurface)
{
m_frontTexture = new TileGrid(isBaseSurface);
m_backTexture = new TileGrid(isBaseSurface);
+ m_lowResTexture = new TileGrid(isBaseSurface);
m_scale = -1;
m_futureScale = -1;
m_zooming = false;
@@ -51,6 +52,7 @@ SurfaceBacking::~SurfaceBacking()
{
delete m_frontTexture;
delete m_backTexture;
+ delete m_lowResTexture;
}
void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom,
@@ -70,6 +72,9 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom,
m_futureScale = scale;
m_zoomUpdateTime = WTF::currentTime() + SurfaceBacking::s_zoomUpdateDelay;
m_zooming = true;
+
+ // release back texture's TileTextures, so they can be reused immediately
+ m_backTexture->discardTextures();
}
bool useExpandPrefetch = aggressiveRendering;
@@ -77,39 +82,43 @@ void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom,
this, scale, m_scale, m_futureScale, m_zooming,
m_frontTexture, m_backTexture);
- if (!m_zooming) {
- m_frontTexture->prepareGL(state, m_scale,
- prepareArea, unclippedArea, painter, false, useExpandPrefetch);
- if (aggressiveRendering) {
- // prepare the back tiled texture to render content in low res
- float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER;
- m_backTexture->prepareGL(state, lowResPrefetchScale,
- prepareArea, unclippedArea, painter, true, useExpandPrefetch);
- m_backTexture->swapTiles();
- }
- } else if (m_zoomUpdateTime < WTF::currentTime()) {
+ if (m_zooming && (m_zoomUpdateTime < WTF::currentTime())) {
m_backTexture->prepareGL(state, m_futureScale,
- prepareArea, unclippedArea, painter, false, useExpandPrefetch);
+ prepareArea, unclippedArea, painter, false, false);
if (m_backTexture->isReady()) {
// zooming completed, swap the textures and new front tiles
swapTileGrids();
m_frontTexture->swapTiles();
m_backTexture->discardTextures();
+ m_lowResTexture->discardTextures();
m_scale = m_futureScale;
m_zooming = false;
}
}
+
+ if (!m_zooming) {
+ m_frontTexture->prepareGL(state, m_scale,
+ prepareArea, unclippedArea, painter, false, useExpandPrefetch);
+ if (aggressiveRendering) {
+ // prepare low res content
+ float lowResPrefetchScale = m_scale * LOW_RES_PREFETCH_SCALE_MODIFIER;
+ m_lowResTexture->prepareGL(state, lowResPrefetchScale,
+ prepareArea, unclippedArea, painter,
+ true, useExpandPrefetch);
+ m_lowResTexture->swapTiles();
+ }
+ }
}
void SurfaceBacking::drawGL(const IntRect& visibleArea, float opacity,
const TransformationMatrix* transform,
bool aggressiveRendering, const Color* background)
{
- // draw low res prefetch page, if needed
- if (aggressiveRendering && !m_zooming && m_frontTexture->isMissingContent())
- m_backTexture->drawGL(visibleArea, opacity, transform);
+ // draw low res prefetch page if zooming or front texture missing content
+ if (aggressiveRendering && isMissingContent())
+ m_lowResTexture->drawGL(visibleArea, opacity, transform);
m_frontTexture->drawGL(visibleArea, opacity, transform, background);
}
@@ -118,12 +127,14 @@ void SurfaceBacking::markAsDirty(const SkRegion& dirtyArea)
{
m_backTexture->markAsDirty(dirtyArea);
m_frontTexture->markAsDirty(dirtyArea);
+ m_lowResTexture->markAsDirty(dirtyArea);
}
void SurfaceBacking::swapTiles()
{
m_backTexture->swapTiles();
m_frontTexture->swapTiles();
+ m_lowResTexture->swapTiles();
}
void SurfaceBacking::computeTexturesAmount(TexturesResult* result, LayerAndroid* layer)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
index ec01dbe..bbac9b5 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.h
@@ -61,7 +61,7 @@ public:
bool isMissingContent()
{
- return !m_zooming && m_frontTexture->isMissingContent();
+ return m_zooming || m_frontTexture->isMissingContent();
}
int nbTextures(IntRect& area, float scale)
@@ -80,6 +80,8 @@ private:
TileGrid* m_frontTexture;
TileGrid* m_backTexture;
+ TileGrid* m_lowResTexture;
+
float m_scale;
float m_futureScale;
double m_zoomUpdateTime;
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
index 8c9cad5..52a8e44 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
@@ -36,9 +36,8 @@
namespace WebCore {
-SurfaceCollectionManager::SurfaceCollectionManager(GLWebViewState* state)
- : m_state(state)
- , m_drawingCollection(0)
+SurfaceCollectionManager::SurfaceCollectionManager()
+ : m_drawingCollection(0)
, m_paintingCollection(0)
, m_queuedCollection(0)
, m_fastSwapMode(false)
@@ -59,8 +58,6 @@ void SurfaceCollectionManager::swap()
// swap can't be called unless painting just finished
ASSERT(m_paintingCollection);
- android::Mutex::Autolock lock(m_paintSwapLock);
-
ALOGV("SWAPPING, D %p, P %p, Q %p",
m_drawingCollection, m_paintingCollection, m_queuedCollection);
@@ -90,8 +87,6 @@ void SurfaceCollectionManager::swap()
// clear all of the content in the three collections held by the collection manager
void SurfaceCollectionManager::clearCollections()
{
- ALOGV("SurfaceCollectionManager %p removing PS from state %p", this, m_state);
-
SkSafeUnref(m_drawingCollection);
m_drawingCollection = 0;
SkSafeUnref(m_paintingCollection);
@@ -109,8 +104,6 @@ bool SurfaceCollectionManager::updateWithSurfaceCollection(SurfaceCollection* ne
// can't have a queued collection unless have a painting collection too
ASSERT(m_paintingCollection || !m_queuedCollection);
- android::Mutex::Autolock lock(m_paintSwapLock);
-
if (!newCollection || brandNew) {
clearCollections();
if (brandNew) {
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h
index cc98899..125bf02 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.h
@@ -41,7 +41,7 @@ class SurfaceCollection;
class TEST_EXPORT SurfaceCollectionManager {
public:
- SurfaceCollectionManager(GLWebViewState* state);
+ SurfaceCollectionManager();
~SurfaceCollectionManager();
@@ -58,10 +58,6 @@ private:
void swap();
void clearCollections();
- android::Mutex m_paintSwapLock;
-
- GLWebViewState* m_state;
-
SurfaceCollection* m_drawingCollection;
SurfaceCollection* m_paintingCollection;
SurfaceCollection* m_queuedCollection;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
index 398db72..00cc656 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TileGrid.cpp
@@ -341,7 +341,6 @@ void TileGrid::drawMissingRegion(const SkRegion& region, float opacity,
SkRegion::Iterator iterator(region);
const float tileWidth = TilesManager::tileWidth() / m_scale;
const float tileHeight = TilesManager::tileHeight() / m_scale;
- ShaderProgram* shader = TilesManager::instance()->shader();
while (!iterator.done()) {
SkIRect r = iterator.rect();
SkRect rect;
diff --git a/Source/WebCore/platform/graphics/android/rendering/TilePainter.h b/Source/WebCore/platform/graphics/android/rendering/TilePainter.h
index d992aee..53dfadc 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TilePainter.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TilePainter.h
@@ -33,14 +33,13 @@ class SkCanvas;
namespace WebCore {
-class Tile;
class Color;
class TilePainter : public SkRefCnt {
// TODO: investigate webkit threadsafe ref counting
public:
virtual ~TilePainter() { }
- virtual bool paint(Tile* tile, SkCanvas* canvas) = 0;
+ virtual bool paint(SkCanvas* canvas) = 0;
virtual float opacity() { return 1.0; }
enum SurfaceType { Painted, Image };
virtual SurfaceType type() { return Painted; }
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp b/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp
index 39effd7..126a7ac 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/TileTexture.cpp
@@ -77,15 +77,15 @@ void TileTexture::discardGLTexture()
}
}
-bool TileTexture::acquire(TextureOwner* owner, bool force)
+bool TileTexture::acquire(TextureOwner* owner)
{
if (m_owner == owner)
return true;
- return setOwner(owner, force);
+ return setOwner(owner);
}
-bool TileTexture::setOwner(TextureOwner* owner, bool force)
+bool TileTexture::setOwner(TextureOwner* owner)
{
bool proceed = true;
if (m_owner && m_owner != owner)
diff --git a/Source/WebCore/platform/graphics/android/rendering/TileTexture.h b/Source/WebCore/platform/graphics/android/rendering/TileTexture.h
index 5fe43b0..b008b7d 100644
--- a/Source/WebCore/platform/graphics/android/rendering/TileTexture.h
+++ b/Source/WebCore/platform/graphics/android/rendering/TileTexture.h
@@ -51,11 +51,11 @@ public:
// allows consumer thread to assign ownership of the texture to the tile. It
// returns false if ownership cannot be transferred because the tile is busy
- bool acquire(TextureOwner* owner, bool force = false);
+ bool acquire(TextureOwner* owner);
bool release(TextureOwner* owner);
// set the texture owner if not busy. Return false if busy, true otherwise.
- bool setOwner(TextureOwner* owner, bool force = false);
+ bool setOwner(TextureOwner* owner);
// private member accessor functions
TextureOwner* owner() { return m_owner; } // only used by the consumer thread
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..9f66d7e 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);
@@ -3124,6 +3132,32 @@ void WebViewCore::chromeTakeFocus(FocusDirection direction)
env->CallVoidMethod(javaObject.get(), m_javaGlue->m_chromeTakeFocus, direction);
}
+void WebViewCore::setInitialFocus(const WebCore::PlatformKeyboardEvent& platformEvent)
+{
+ Frame* frame = focusedFrame();
+ Document* document = frame->document();
+ if (document)
+ document->setFocusedNode(0);
+ FocusDirection direction;
+ switch (platformEvent.nativeVirtualKeyCode()) {
+ case AKEYCODE_DPAD_LEFT:
+ direction = FocusDirectionLeft;
+ break;
+ case AKEYCODE_DPAD_RIGHT:
+ direction = FocusDirectionRight;
+ break;
+ case AKEYCODE_DPAD_UP:
+ direction = FocusDirectionUp;
+ break;
+ default:
+ direction = FocusDirectionDown;
+ break;
+ }
+ RefPtr<KeyboardEvent> webkitEvent = KeyboardEvent::create(platformEvent, 0);
+ m_mainFrame->page()->focusController()->setInitialFocus(direction,
+ webkitEvent.get());
+}
+
#if USE(ACCELERATED_COMPOSITING)
GraphicsLayerAndroid* WebViewCore::graphicsRootLayer() const
{
@@ -4393,6 +4427,14 @@ static jboolean Key(JNIEnv* env, jobject obj, jint nativeClass, jint keyCode,
unichar, repeatCount, isDown, isShift, isAlt, isSym));
}
+static void SetInitialFocus(JNIEnv* env, jobject obj, jint nativeClass,
+ jint keyDirection)
+{
+ WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass);
+ viewImpl->setInitialFocus(PlatformKeyboardEvent(keyDirection,
+ 0, 0, false, false, false, false));
+}
+
static void ContentInvalidateAll(JNIEnv* env, jobject obj, jint nativeClass)
{
reinterpret_cast<WebViewCore*>(nativeClass)->contentInvalidateAll();
@@ -5065,6 +5107,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) FindAll },
{ "nativeFindNext", "(IZ)I",
(void*) FindNext },
+ { "nativeSetInitialFocus", "(II)V", (void*) SetInitialFocus },
};
int registerWebViewCore(JNIEnv* env)
diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h
index 82a65cf..eec98b0 100644
--- a/Source/WebKit/android/jni/WebViewCore.h
+++ b/Source/WebKit/android/jni/WebViewCore.h
@@ -321,6 +321,7 @@ namespace android {
bool key(const WebCore::PlatformKeyboardEvent& event);
bool chromeCanTakeFocus(WebCore::FocusDirection direction);
void chromeTakeFocus(WebCore::FocusDirection direction);
+ void setInitialFocus(const WebCore::PlatformKeyboardEvent& event);
/**
* Handle touch event